Skip to content

Commit

Permalink
fixed issue with x3d sphere diffuse color
Browse files Browse the repository at this point in the history
The sphere was using the texture shader instead of the phong shader.
- added a constructor to GVRSphereSceneObject
- modify X3D parser to use Phong shader for sphere
  • Loading branch information
NolaDonato authored and liaxim committed Jan 30, 2018
1 parent 795e419 commit 9fd0ae3
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,6 @@ public GVRSphereSceneObject(GVRContext gvrContext, boolean facingOut) {
new GVRMaterial(gvrContext), 1);
}

/**
* Constructs a sphere scene object with a radius of 1 and 18 stacks, and 36
* slices.
*
* The sphere's triangles and normals are facing either in or out and the
* same texture will be applied to each side of the sphere.
*
* @param gvrContext
* current {@link GVRContext}
*
* @param facingOut
* whether the triangles and normals should be facing in or
* facing out.
*/
/**
* Constructs a sphere scene object 18 stacks, and 36
* slices.
Expand Down Expand Up @@ -233,6 +219,35 @@ public GVRSphereSceneObject(GVRContext gvrContext, boolean facingOut,
material, 1);
}

/**
* Constructs a sphere scene object with a radius of 1 and 18 stacks, and 36
* slices.
*
* The sphere's triangles and normals are facing either in or out and the
* same material will be applied to each side of the sphere.
*
* @param gvrContext
* current {@link GVRContext}
*
* @param facingOut
* whether the triangles and normals should be facing in or
* facing out.
*
* @param material
* the material for the sphere.
* @param radius
* sets the sphere with the radius parameter. Radius must be > 0
* otherwise, set it to the default of 1
*/
public GVRSphereSceneObject(GVRContext gvrContext, boolean facingOut,
GVRMaterial material, float radius)
{
super(gvrContext);

generateSphereObject(gvrContext, STACK_NUMBER, SLICE_NUMBER, facingOut,
material, radius);
}

/**
* Constructs a sphere scene object with a radius of 1 and user specified
* stack and slice numbers.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2612,7 +2612,7 @@ else if (qName.equalsIgnoreCase("Sphere")) {
solid = parseBooleanString(attributeValue);
}
GVRSphereSceneObject gvrSphereSceneObject = new GVRSphereSceneObject(
gvrContext, solid, radius);
gvrContext, solid, new GVRMaterial(gvrContext, GVRMaterial.GVRShaderType.Phong.ID), radius);
currentSceneObject.addChildObject(gvrSphereSceneObject);
meshAttachedSceneObject = gvrSphereSceneObject;

Expand Down

0 comments on commit 9fd0ae3

Please sign in to comment.