diff options
5 files changed, 36 insertions, 22 deletions
diff --git a/src/classes/org/jdesktop/j3d/examples/oriented_shape3d/OrientedPtTest.java b/src/classes/org/jdesktop/j3d/examples/oriented_shape3d/OrientedPtTest.java index 5577908..7a71b1a 100644 --- a/src/classes/org/jdesktop/j3d/examples/oriented_shape3d/OrientedPtTest.java +++ b/src/classes/org/jdesktop/j3d/examples/oriented_shape3d/OrientedPtTest.java @@ -146,7 +146,8 @@ public class OrientedPtTest extends Applet { cubeTrans.addChild(new ColorCube(0.3)); objTrans.addChild(cubeTrans); - TextureLoader stoneTex = new TextureLoader(stoneImage, new String("RGB"), this); + TextureLoader stoneTex = new TextureLoader(stoneImage, new String("RGB"), + TextureLoader.BY_REFERENCE | TextureLoader.Y_UP, this); if (stoneTex != null) apStone.setTexture(stoneTex.getTexture()); TextureAttributes texAttr = new TextureAttributes(); @@ -157,11 +158,12 @@ public class OrientedPtTest extends Applet { TransformGroup coneTrans = new TransformGroup(coneMat); coneMat.set(new Vector3d(0.0, 0.0, 0.0)); coneTrans.setTransform(coneMat); - coneTrans.addChild(new Cone(.2f, 0.8f,Cone.GENERATE_NORMALS | - Cone.GENERATE_TEXTURE_COORDS, apStone)); + coneTrans.addChild(new Cone(.2f, 0.8f,Cone.GENERATE_NORMALS | + Cone.GENERATE_TEXTURE_COORDS | Cone.GENERATE_TEXTURE_COORDS_YUP, apStone)); objTrans.addChild(coneTrans); - TextureLoader earthTex = new TextureLoader(earthImage, new String("RGB"), this); + TextureLoader earthTex = new TextureLoader(earthImage, new String("RGB"), + TextureLoader.BY_REFERENCE | TextureLoader.Y_UP, this); if (earthTex != null) apEarth.setTexture(earthTex.getTexture()); apEarth.setTextureAttributes(texAttr); @@ -170,14 +172,12 @@ public class OrientedPtTest extends Applet { cylinderMat.set(new Vector3d(-0.9, 0.5, -1.0)); cylinderTrans.setTransform(cylinderMat); cylinderTrans.addChild(new Cylinder(.35f, 2.0f,Cylinder.GENERATE_NORMALS | - Cylinder.GENERATE_TEXTURE_COORDS, apEarth)); + Cylinder.GENERATE_TEXTURE_COORDS | + Cylinder.GENERATE_TEXTURE_COORDS_YUP, apEarth)); objTrans.addChild(cylinderTrans); objTrans.addChild(objScale); - - - // Set up the background Color3f bgColor = new Color3f(0.05f, 0.05f, 0.5f); Background bgNode = new Background(bgColor); diff --git a/src/classes/org/jdesktop/j3d/examples/oriented_shape3d/OrientedTest.java b/src/classes/org/jdesktop/j3d/examples/oriented_shape3d/OrientedTest.java index 580ff1f..eb2a7f2 100644 --- a/src/classes/org/jdesktop/j3d/examples/oriented_shape3d/OrientedTest.java +++ b/src/classes/org/jdesktop/j3d/examples/oriented_shape3d/OrientedTest.java @@ -128,7 +128,8 @@ public class OrientedTest extends Applet { cubeTrans.addChild(new ColorCube(0.3)); objTrans.addChild(cubeTrans); - TextureLoader stoneTex = new TextureLoader(stoneImage, new String("RGB"), this); + TextureLoader stoneTex = new TextureLoader(stoneImage, new String("RGB"), + TextureLoader.BY_REFERENCE | TextureLoader.Y_UP, this); if (stoneTex != null) apStone.setTexture(stoneTex.getTexture()); TextureAttributes texAttr = new TextureAttributes(); @@ -140,11 +141,13 @@ public class OrientedTest extends Applet { TransformGroup coneTrans = new TransformGroup(coneMat); coneMat.set(new Vector3d(0.0, 0.0, 0.0)); coneTrans.setTransform(coneMat); - coneTrans.addChild(new Cone(.2f, 0.8f,Cone.GENERATE_NORMALS | - Cone.GENERATE_TEXTURE_COORDS, apStone)); + coneTrans.addChild(new Cone(.2f, 0.8f, Cone.GENERATE_NORMALS | + Cone.GENERATE_TEXTURE_COORDS | + Cone.GENERATE_TEXTURE_COORDS_YUP, apStone)); objTrans.addChild(coneTrans); - TextureLoader earthTex = new TextureLoader(earthImage, new String("RGB"), this); + TextureLoader earthTex = new TextureLoader(earthImage, new String("RGB"), + TextureLoader.BY_REFERENCE | TextureLoader.Y_UP, this); if (earthTex != null) apEarth.setTexture(earthTex.getTexture()); apEarth.setTextureAttributes(texAttr); @@ -153,8 +156,9 @@ public class OrientedTest extends Applet { TransformGroup cylinderTrans = new TransformGroup(cylinderMat); cylinderMat.set(new Vector3d(-0.9, 0.5, -1.0)); cylinderTrans.setTransform(cylinderMat); - cylinderTrans.addChild(new Cylinder(.35f, 2.0f,Cylinder.GENERATE_NORMALS | - Cylinder.GENERATE_TEXTURE_COORDS, apEarth)); + cylinderTrans.addChild(new Cylinder(.35f, 2.0f, Cylinder.GENERATE_NORMALS | + Cylinder.GENERATE_TEXTURE_COORDS | + Cylinder.GENERATE_TEXTURE_COORDS_YUP, apEarth)); objTrans.addChild(cylinderTrans); objTrans.addChild(objScale); diff --git a/src/classes/org/jdesktop/j3d/examples/texture/MultiTextureTest.java b/src/classes/org/jdesktop/j3d/examples/texture/MultiTextureTest.java index 9396a05..17c054d 100644 --- a/src/classes/org/jdesktop/j3d/examples/texture/MultiTextureTest.java +++ b/src/classes/org/jdesktop/j3d/examples/texture/MultiTextureTest.java @@ -147,12 +147,16 @@ public class MultiTextureTest extends Applet implements ItemListener{ TextureAttributes texAttr2 = new TextureAttributes(); texAttr2.setTextureMode(TextureAttributes.MODULATE); - TextureLoader tex = new TextureLoader(stoneImage, new String("RGB"), this); + TextureLoader tex = new TextureLoader(stoneImage, new String("RGB"), + TextureLoader.BY_REFERENCE | TextureLoader.Y_UP, + this); if (tex == null) return null; stoneTex = tex.getTexture(); - tex = new TextureLoader(skyImage, new String("RGB"), this); + tex = new TextureLoader(skyImage, new String("RGB"), + TextureLoader.BY_REFERENCE | TextureLoader.Y_UP, + this); if (tex == null) return null; skyTex = tex.getTexture(); @@ -170,7 +174,8 @@ public class MultiTextureTest extends Applet implements ItemListener{ //Create a Box Box BoxObj = new Box(1.5f, 1.5f, 0.8f, Box.GENERATE_NORMALS | - Box.GENERATE_TEXTURE_COORDS, ap, 2); + Box.GENERATE_TEXTURE_COORDS | + Box.GENERATE_TEXTURE_COORDS_YUP, ap, 2); // add it to the scene graph. objTrans.addChild(BoxObj); diff --git a/src/classes/org/jdesktop/j3d/examples/texture/TextureImage.java b/src/classes/org/jdesktop/j3d/examples/texture/TextureImage.java index cedf1d5..06b5e95 100644 --- a/src/classes/org/jdesktop/j3d/examples/texture/TextureImage.java +++ b/src/classes/org/jdesktop/j3d/examples/texture/TextureImage.java @@ -75,7 +75,9 @@ public class TextureImage extends Applet { // Create appearance object for textured cube Appearance app = new Appearance(); - Texture tex = new TextureLoader(texImage, this).getTexture(); + Texture tex = new TextureLoader(texImage, + TextureLoader.BY_REFERENCE | TextureLoader.Y_UP, + this).getTexture(); app.setTexture(tex); TextureAttributes texAttr = new TextureAttributes(); texAttr.setTextureMode(TextureAttributes.MODULATE); @@ -83,7 +85,8 @@ public class TextureImage extends Applet { // Create textured cube and add it to the scene graph. Box textureCube = new Box(0.4f, 0.4f, 0.4f, - Box.GENERATE_TEXTURE_COORDS, app); + Box.GENERATE_TEXTURE_COORDS | + Box.GENERATE_TEXTURE_COORDS_YUP, app); objTrans.addChild(textureCube); // Create a new Behavior object that will perform the desired diff --git a/src/classes/org/jdesktop/j3d/examples/texture/TextureImageNPOT.java b/src/classes/org/jdesktop/j3d/examples/texture/TextureImageNPOT.java index e5fae08..781c258 100644 --- a/src/classes/org/jdesktop/j3d/examples/texture/TextureImageNPOT.java +++ b/src/classes/org/jdesktop/j3d/examples/texture/TextureImageNPOT.java @@ -88,7 +88,8 @@ public class TextureImageNPOT extends Applet { // Create appearance object for textured cube Appearance app = new Appearance(); - int flags = 0; + int flags = TextureLoader.BY_REFERENCE | TextureLoader.Y_UP; + if (allowNonPowerOfTwo) { flags |= TextureLoader.ALLOW_NON_POWER_OF_TWO; } @@ -108,8 +109,9 @@ public class TextureImageNPOT extends Applet { app.setTextureAttributes(texAttr); // Create textured cube and add it to the scene graph. - Box textureCube = new Box(0.4f, 0.4f, 0.4f, - Box.GENERATE_TEXTURE_COORDS, app); + Box textureCube = new Box(0.4f, 0.4f, 0.4f, + Box.GENERATE_TEXTURE_COORDS | + Box.GENERATE_TEXTURE_COORDS_YUP, app); objScale.addChild(textureCube); // Create a new Behavior object that will perform the desired |