List of usage examples for javax.media.j3d RotationInterpolator RotationInterpolator
public RotationInterpolator(Alpha alpha, TransformGroup target, Transform3D axisOfTransform, float minimumAngle, float maximumAngle)
From source file:BoundsTest.java
protected BranchGroup createSceneBranchGroup() { BranchGroup objRoot = super.createSceneBranchGroup(); // do NOT auto compute bounds for this node objRoot.setBoundsAutoCompute(false); TransformGroup objTrans = new TransformGroup(); objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); Transform3D yAxis = new Transform3D(); Alpha rotationAlpha = new Alpha(-1, Alpha.INCREASING_ENABLE, 0, 0, 4000, 0, 0, 0, 0, 0); RotationInterpolator rotator = new RotationInterpolator(rotationAlpha, objTrans, yAxis, 0.0f, (float) Math.PI * 2.0f); rotator.setSchedulingBounds(createApplicationBounds()); objTrans.addChild(rotator);/*from w w w.j a v a 2 s .co m*/ objTrans.addChild(createColorCubes()); objTrans.addChild(createPoints()); objRoot.addChild(objTrans); return objRoot; }
From source file:Text2DTest.java
public BranchGroup createSceneGraph() { // Create the root of the branch graph BranchGroup objRoot = new BranchGroup(); // Create a Transformgroup to scale all objects so they // appear in the scene. TransformGroup objScale = new TransformGroup(); Transform3D t3d = new Transform3D(); t3d.setScale(0.4);//from w w w . ja va 2 s. c o m objScale.setTransform(t3d); objRoot.addChild(objScale); // Create the transform group node and initialize it to the // identity. Enable the TRANSFORM_WRITE capability so that // our behavior code can modify it at runtime. Add it to the // root of the subgraph. TransformGroup objTrans = new TransformGroup(); objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0); TransformGroup textTranslationGroup; Transform3D textTranslation; float yPos = -.5f; Shape3D textObject = new Text2D("Rotating Yellow Text", new Color3f(1f, 1f, 0f), "Serif", 60, Font.BOLD); Appearance app = textObject.getAppearance(); PolygonAttributes pa = app.getPolygonAttributes(); if (pa == null) pa = new PolygonAttributes(); pa.setCullFace(PolygonAttributes.CULL_NONE); if (app.getPolygonAttributes() == null) app.setPolygonAttributes(pa); objTrans.addChild(textObject); textTranslation = new Transform3D(); textTranslation.setTranslation(new Vector3f(0f, yPos, 0f)); textTranslationGroup = new TransformGroup(textTranslation); textTranslationGroup.addChild(objTrans); objScale.addChild(textTranslationGroup); yPos += .5f; /* Blue 40point text */ textObject = new Text2D("Blue 40point Text", new Color3f(0f, 0f, 1f), "Serif", 40, Font.BOLD); textTranslation = new Transform3D(); textTranslation.setTranslation(new Vector3f(0f, yPos, 0f)); textTranslationGroup = new TransformGroup(textTranslation); textTranslationGroup.addChild(textObject); objScale.addChild(textTranslationGroup); yPos += .5f; /* Green italic text */ textObject = new Text2D("Green Italic Text", new Color3f(0f, 1f, 0f), "Serif", 70, Font.ITALIC); textTranslation = new Transform3D(); textTranslation.setTranslation(new Vector3f(0f, yPos, 0f)); textTranslationGroup = new TransformGroup(textTranslation); textTranslationGroup.addChild(textObject); objScale.addChild(textTranslationGroup); yPos += .5f; // Create a new Behavior object that will perform the desired // operation on the specified transform object and add it into // the scene graph. Transform3D yAxis = new Transform3D(); Alpha rotationAlpha = new Alpha(-1, Alpha.INCREASING_ENABLE, 0, 0, 4000, 0, 0, 0, 0, 0); RotationInterpolator rotator = new RotationInterpolator(rotationAlpha, objTrans, yAxis, 0.0f, (float) Math.PI * 2.0f); rotator.setSchedulingBounds(bounds); objTrans.addChild(rotator); return objRoot; }
From source file:NodesTest.java
protected BranchGroup createSceneBranchGroup() { BranchGroup objRoot = super.createSceneBranchGroup(); double labelScale = 20; // create the top level Switch Node // we will use the Switch Node to switch the // other Nodes on and off. // 1: Switch//from w ww. j a v a2 s .com Switch switchGroup = new Switch(); switchGroup.setCapability(Switch.ALLOW_SWITCH_WRITE); switchGroup.addChild(createLabel("1. Switch Label", labelScale)); // 2: BranchGroup BranchGroup branchGroup = new BranchGroup(); branchGroup.addChild(createLabel("2. BranchGroup", labelScale)); switchGroup.addChild(branchGroup); // 3: OrderedGroup, OrderedGroup orderedGroup = new OrderedGroup(); orderedGroup.addChild(createLabel("3. OrderedGroup", labelScale)); orderedGroup.addChild(createLabel("Child 1", labelScale)); orderedGroup.addChild(createLabel("Child 2", labelScale)); switchGroup.addChild(orderedGroup); // 4: SharedGroup, SharedGroup sharedGroup1 = new SharedGroup(); sharedGroup1.addChild(createLabel("4. Shared Group 1", labelScale)); switchGroup.addChild(new Link(sharedGroup1)); // 5: Primitive, BranchGroup primitiveGroup = new BranchGroup(); primitiveGroup.addChild(createLabel("5. Primitive", labelScale)); primitiveGroup.addChild(new Sphere(2)); switchGroup.addChild(primitiveGroup); // 6: TransformGroup TransformGroup transformGroup = new TransformGroup(); transformGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); transformGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); Transform3D yAxis = new Transform3D(); Alpha rotationAlpha = new Alpha(-1, Alpha.INCREASING_ENABLE, 0, 0, 4000, 0, 0, 0, 0, 0); RotationInterpolator rotator = new RotationInterpolator(rotationAlpha, transformGroup, yAxis, 0.0f, (float) Math.PI * 2.0f); rotator.setSchedulingBounds(createApplicationBounds()); transformGroup.addChild(rotator); transformGroup.addChild(new ColorCube(2)); transformGroup.addChild(createLabel("6. TransformGroup", labelScale)); switchGroup.addChild(transformGroup); // 7: add another copy of the shared group switchGroup.addChild(new Link(sharedGroup1)); // create a SwitchValueInterpolator to // cycle through the child nodes in the Switch Node Alpha switchAlpha = new Alpha(-1, Alpha.INCREASING_ENABLE, 0, 0, 10000, 0, 0, 0, 0, 0); SwitchValueInterpolator switchInterpolator = new SwitchValueInterpolator(switchAlpha, switchGroup); switchInterpolator.setSchedulingBounds(createApplicationBounds()); switchInterpolator.setEnable(true); // WARNING: do not add the SwitchValueInterpolator to the Switch Node! objRoot.addChild(switchInterpolator); // finally add the Switch Node objRoot.addChild(switchGroup); return objRoot; }
From source file:RasterTest.java
protected BranchGroup createSceneBranchGroup() { // create some simple geometry (a rotating ColorCube) // and a Shape3D object for the Raster containing the Image BranchGroup objRoot = super.createSceneBranchGroup(); TransformGroup objTrans = new TransformGroup(); objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); Transform3D yAxis = new Transform3D(); yAxis.rotX(0.6);//from w w w. j a va 2 s . co m Alpha rotationAlpha = new Alpha(-1, Alpha.INCREASING_ENABLE, 0, 0, 4000, 0, 0, 0, 0, 0); RotationInterpolator rotator = new RotationInterpolator(rotationAlpha, objTrans, yAxis, 0.0f, (float) Math.PI * 2.0f); BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0); rotator.setSchedulingBounds(bounds); objTrans.addChild(rotator); // wrap the Raster in a Shape3D Shape3D shape = new Shape3D(m_RenderRaster); objRoot.addChild(shape); objTrans.addChild(new ColorCube(1.0)); objRoot.addChild(objTrans); return objRoot; }
From source file:LightTest.java
protected BranchGroup createSceneBranchGroup() { BranchGroup objRoot = super.createSceneBranchGroup(); // create the 4 lights - the actual creation // and UI managment is delegated to an object // that "shadows" (no pun intended) the functionality // of the particular light createLight(new AmbientLightObject(), objRoot); createLight(new PointLightObject(), objRoot); createLight(new DirectionalLightObject(), objRoot); createLight(new SpotLightObject(), objRoot); // rotate some of the spheres in the scene TransformGroup objTrans = new TransformGroup(); objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); Transform3D yAxis = new Transform3D(); Alpha rotationAlpha = new Alpha(-1, Alpha.INCREASING_ENABLE, 0, 0, 4000, 0, 0, 0, 0, 0); RotationInterpolator rotator = new RotationInterpolator(rotationAlpha, objTrans, yAxis, 0.0f, (float) Math.PI * 2.0f); rotator.setSchedulingBounds(getApplicationBounds()); objTrans.addChild(rotator);//from ww w .j av a 2 s. co m // create a large sphere in the center of the // scene and the floor as staionary objects objRoot.addChild(createSphere(0, 0, 0, 2)); objRoot.addChild(createFloor()); // create a smaller sphere at the corners of a cube final int nCubeSize = 3; objTrans.addChild(createSphere(nCubeSize, nCubeSize, nCubeSize, 1)); objTrans.addChild(createSphere(nCubeSize, nCubeSize, -nCubeSize, 1)); objTrans.addChild(createSphere(nCubeSize, -nCubeSize, nCubeSize, 1)); objTrans.addChild(createSphere(nCubeSize, -nCubeSize, -nCubeSize, 1)); objTrans.addChild(createSphere(-nCubeSize, nCubeSize, nCubeSize, 1)); objTrans.addChild(createSphere(-nCubeSize, nCubeSize, -nCubeSize, 1)); objTrans.addChild(createSphere(-nCubeSize, -nCubeSize, nCubeSize, 1)); objTrans.addChild(createSphere(-nCubeSize, -nCubeSize, -nCubeSize, 1)); // add some small spheres here and there to // make things interesting objRoot.addChild(createSphere(-6, -6, 2, 1)); objRoot.addChild(createSphere(8, -5, 3, 1)); objRoot.addChild(createSphere(6, 7, -1, 1)); objRoot.addChild(createSphere(-5, 6, -3.5f, 0.5f)); objRoot.addChild(objTrans); return objRoot; }
From source file:TickTockPicking.java
public BranchGroup createSceneGraph(Canvas3D c) { // Create the root of the branch graph BranchGroup objRoot = new BranchGroup(); // Create a Transformgroup to scale all objects so they // appear in the scene. TransformGroup objScale = new TransformGroup(); Transform3D t3d = new Transform3D(); t3d.setScale(0.4);// w ww. j a v a 2 s .c o m objScale.setTransform(t3d); objRoot.addChild(objScale); // Create a bounds for the background and behaviors BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0); // Set up the background Color3f bgColor = new Color3f(0.05f, 0.05f, 0.2f); Background bg = new Background(bgColor); bg.setApplicationBounds(bounds); objScale.addChild(bg); // Set up the global lights Color3f lColor1 = new Color3f(0.7f, 0.7f, 0.7f); Vector3f lDir1 = new Vector3f(-1.0f, -1.0f, -1.0f); Color3f alColor = new Color3f(0.2f, 0.2f, 0.2f); AmbientLight aLgt = new AmbientLight(alColor); aLgt.setInfluencingBounds(bounds); DirectionalLight lgt1 = new DirectionalLight(lColor1, lDir1); lgt1.setInfluencingBounds(bounds); objScale.addChild(aLgt); objScale.addChild(lgt1); // Create a pair of transform group nodes and initialize them to // identity. Enable the TRANSFORM_WRITE capability so that // our behaviors can modify them at runtime. Add them to the // root of the subgraph. TransformGroup objTrans1 = new TransformGroup(); objTrans1.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); objScale.addChild(objTrans1); TransformGroup objTrans2 = new TransformGroup(); objTrans2.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); objTrans1.addChild(objTrans2); // Create the positioning and scaling transform group node. Transform3D t = new Transform3D(); t.set(0.3, new Vector3d(0.0, -1.5, 0.0)); TransformGroup objTrans3 = new TransformGroup(t); objTrans2.addChild(objTrans3); // Create a simple shape leaf node, set it's appearance, and // add it to the scene graph. Shape3D shape = new Cube(); Appearance a = new Appearance(); Color3f black = new Color3f(0.0f, 0.0f, 0.0f); Color3f white = new Color3f(1.0f, 1.0f, 1.0f); Color3f objColor = new Color3f(0.8f, 0.0f, 0.0f); a.setMaterial(new Material(objColor, black, objColor, white, 80.0f)); shape.setAppearance(a); shape.setCapability(shape.ALLOW_APPEARANCE_READ); shape.setCapability(shape.ALLOW_APPEARANCE_WRITE); objTrans3.addChild(shape); // Create a new Behavior object that will perform the desired // rotation on the specified transform object and add it into // the scene graph. Transform3D yAxis1 = new Transform3D(); yAxis1.rotX(Math.PI / 2.0); Alpha tickTockAlpha = new Alpha(-1, Alpha.INCREASING_ENABLE | Alpha.DECREASING_ENABLE, 0, 0, 5000, 2500, 200, 5000, 2500, 200); RotationInterpolator tickTock = new RotationInterpolator(tickTockAlpha, objTrans1, yAxis1, -(float) Math.PI / 2.0f, (float) Math.PI / 2.0f); tickTock.setSchedulingBounds(bounds); objTrans2.addChild(tickTock); // Create a new Behavior object that will perform the desired // rotation on the specified transform object and add it into // the scene graph. Transform3D yAxis2 = new Transform3D(); Alpha rotationAlpha = new Alpha(-1, Alpha.INCREASING_ENABLE, 0, 0, 4000, 0, 0, 0, 0, 0); RotationInterpolator rotator = new RotationInterpolator(rotationAlpha, objTrans2, yAxis2, 0.0f, (float) Math.PI * 2.0f); rotator.setSchedulingBounds(bounds); objTrans2.addChild(rotator); // Now create the simple picking behavior PickHighlightBehavior pickBeh = new PickHighlightBehavior(c, objRoot, bounds); // Create a bunch of objects with a behavior and add them // into the scene graph. int row, col; Appearance[][] app = new Appearance[3][3]; for (row = 0; row < 3; row++) for (col = 0; col < 3; col++) app[row][col] = createAppearance(row * 3 + col); for (int i = 0; i < 3; i++) { double ypos = (double) (i - 1) * 1.5; for (int j = 0; j < 3; j++) { double xpos = (double) (j - 1) * 1.5; objScale.addChild(createObject(app[i][j], 0.3, xpos, ypos)); } } // Have Java 3D perform optimizations on this scene graph. objRoot.compile(); return objRoot; }
From source file:GearTest.java
public BranchGroup createSceneGraph(int toothCount) { // Create the root of the branch graph BranchGroup objRoot = new BranchGroup(); // Create a Transformgroup to scale all objects so they // appear in the scene. TransformGroup objScale = new TransformGroup(); Transform3D t3d = new Transform3D(); t3d.setScale(0.4);/*from w ww .j ava 2s . c o m*/ objScale.setTransform(t3d); objRoot.addChild(objScale); // Create a bounds for the background and lights BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0); // Set up the background Color3f bgColor = new Color3f(0.05f, 0.05f, 0.2f); Background bgNode = new Background(bgColor); bgNode.setApplicationBounds(bounds); objScale.addChild(bgNode); // Set up the global lights Color3f light1Color = new Color3f(1.0f, 1.0f, 0.9f); Vector3f light1Direction = new Vector3f(4.0f, -7.0f, -12.0f); Color3f light2Color = new Color3f(0.3f, 0.3f, 0.4f); Vector3f light2Direction = new Vector3f(-6.0f, -2.0f, -1.0f); Color3f ambientColor = new Color3f(0.1f, 0.1f, 0.1f); AmbientLight ambientLightNode = new AmbientLight(ambientColor); ambientLightNode.setInfluencingBounds(bounds); objScale.addChild(ambientLightNode); DirectionalLight light1 = new DirectionalLight(light1Color, light1Direction); light1.setInfluencingBounds(bounds); objScale.addChild(light1); DirectionalLight light2 = new DirectionalLight(light2Color, light2Direction); light2.setInfluencingBounds(bounds); objScale.addChild(light2); // Create the transform group node and initialize it to the // identity. Enable the TRANSFORM_WRITE capability so that // our behavior code can modify it at runtime. Add it to the // root of the subgraph. TransformGroup objTrans = new TransformGroup(); objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); objScale.addChild(objTrans); // Create an Appearance. Appearance look = new Appearance(); Color3f objColor = new Color3f(0.5f, 0.5f, 0.6f); Color3f black = new Color3f(0.0f, 0.0f, 0.0f); Color3f white = new Color3f(1.0f, 1.0f, 1.0f); look.setMaterial(new Material(objColor, black, objColor, white, 100.0f)); // Create a gear, add it to the scene graph. // SpurGear gear = new SpurGear(toothCount, 1.0f, 0.2f, SpurGear gear = new SpurGearThinBody(toothCount, 1.0f, 0.2f, 0.05f, 0.05f, 0.3f, 0.28f, look); objTrans.addChild(gear); // Create a new Behavior object that will rotate the object and // add it into the scene graph. Transform3D yAxis = new Transform3D(); Alpha rotationAlpha = new Alpha(-1, Alpha.INCREASING_ENABLE, 0, 0, 8000, 0, 0, 0, 0, 0); RotationInterpolator rotator = new RotationInterpolator(rotationAlpha, objTrans, yAxis, 0.0f, (float) Math.PI * 2.0f); rotator.setSchedulingBounds(bounds); objTrans.addChild(rotator); // Have Java 3D perform optimizations on this scene graph. objRoot.compile(); return objRoot; }
From source file:ScenegraphTest.java
private TransformGroup addLimb(Group parentGroup, String szName, double radius, double length, double rotMin, double rotMax) { // create the rotator TransformGroup tgJoint = new TransformGroup(); tgJoint.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); tgJoint.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); // add a rotator if necessary if (rotMin != rotMax) { Transform3D xAxis = new Transform3D(); xAxis.rotX(Math.PI / 2.0); Alpha rotationAlpha = new Alpha(-1, Alpha.INCREASING_ENABLE, 0, 0, 4000, 0, 0, 0, 0, 0); RotationInterpolator rotator = new RotationInterpolator(rotationAlpha, tgJoint, xAxis, (float) rotMin, (float) rotMax); rotator.setSchedulingBounds(createApplicationBounds()); tgJoint.addChild(rotator);//from www.ja v a 2 s.c om } // create a cylinder using length and radius tgJoint.addChild(createLimb(radius, length)); // create the joint (the *next* TG should // be offset by the length of this limb) TransformGroup tgOffset = new TransformGroup(); Transform3D t3d = new Transform3D(); t3d.setTranslation(new Vector3d(0, length, 0)); tgOffset.setTransform(t3d); tgJoint.addChild(tgOffset); parentGroup.addChild(tgJoint); // return the offset TG, so any child TG's will be added // in the correct position. return tgOffset; }
From source file:BehaviorTest.java
protected BranchGroup createSceneBranchGroup() { BranchGroup objRoot = super.createSceneBranchGroup(); // create a TransformGroup to rotate the hand TransformGroup objTrans = new TransformGroup(); objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); // create a RotationInterpolator behavior to rotate the hand Transform3D yAxis = new Transform3D(); Alpha rotationAlpha = new Alpha(-1, Alpha.INCREASING_ENABLE, 0, 0, 4000, 0, 0, 0, 0, 0); m_RotationInterpolator = new RotationInterpolator(rotationAlpha, objTrans, yAxis, 0.0f, (float) Math.PI * 2.0f); m_RotationInterpolator.setSchedulingBounds(createApplicationBounds()); objTrans.addChild(m_RotationInterpolator); // create an Appearance and Material Appearance app = new Appearance(); TextureLoader tex = new TextureLoader("earth.jpg", this); app.setTexture(tex.getTexture());//w ww. j ava 2 s. c o m Sphere sphere = new Sphere(3, Primitive.GENERATE_NORMALS | Primitive.GENERATE_TEXTURE_COORDS, 32, app); // connect the scenegraph objTrans.addChild(sphere); objRoot.addChild(objTrans); m_FpsBehavior = new FpsBehavior(); m_FpsBehavior.setSchedulingBounds(getApplicationBounds()); objRoot.addChild(m_FpsBehavior); m_BoundsBehavior = new BoundsBehavior(sphere); m_BoundsBehavior.setSchedulingBounds(getApplicationBounds()); m_BoundsBehavior.addBehaviorToParentGroup(objTrans); m_StretchBehavior = new StretchBehavior((GeometryArray) sphere.getShape().getGeometry()); m_StretchBehavior.setSchedulingBounds(getApplicationBounds()); objRoot.addChild(m_StretchBehavior); m_StretchBehavior.setEnable(false); m_SizeBehavior = new ObjectSizeBehavior((GeometryArray) sphere.getShape().getGeometry()); m_SizeBehavior.setSchedulingBounds(getApplicationBounds()); objRoot.addChild(m_SizeBehavior); m_SizeBehavior.setEnable(false); m_ExplodeBehavior = new ExplodeBehavior(sphere.getShape(), 10000, 20, this); m_ExplodeBehavior.setSchedulingBounds(getApplicationBounds()); objRoot.addChild(m_ExplodeBehavior); return objRoot; }
From source file:PolygonOffset.java
public BranchGroup createSceneGraph() { // Create the root of the branch graph BranchGroup objRoot = new BranchGroup(); // Create the transform group node and initialize it to the // identity. Enable the TRANSFORM_WRITE capability so that // our behavior code can modify it at runtime. Add it to the // root of the subgraph. TransformGroup objTrans = new TransformGroup(); objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); objRoot.addChild(objTrans);/*from www .ja va 2 s . co m*/ // Create a Sphere. We will display this as both wireframe and // solid to make a hidden line display // wireframe Appearance wireApp = new Appearance(); ColoringAttributes wireCa = new ColoringAttributes(); wireCa.setColor(black); wireApp.setColoringAttributes(wireCa); wirePa = new PolygonAttributes(PolygonAttributes.POLYGON_LINE, PolygonAttributes.CULL_BACK, 0.0f); wireApp.setPolygonAttributes(wirePa); Sphere outWireSphere = new Sphere(sphereRadius, 0, 15, wireApp); objTrans.addChild(outWireSphere); // solid ColoringAttributes outCa = new ColoringAttributes(red, ColoringAttributes.SHADE_FLAT); Appearance outSolid = new Appearance(); outSolid.setColoringAttributes(outCa); solidPa = new PolygonAttributes(PolygonAttributes.POLYGON_FILL, PolygonAttributes.CULL_BACK, 0.0f); solidPa.setPolygonOffsetFactor(dynamicOffset); solidPa.setPolygonOffset(staticOffset); solidPa.setCapability(PolygonAttributes.ALLOW_OFFSET_WRITE); outSolid.setPolygonAttributes(solidPa); Sphere outSolidSphere = new Sphere(sphereRadius, 0, 15, outSolid); objTrans.addChild(outSolidSphere); innerTG = new TransformGroup(); innerTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); scale = new Transform3D(); updateInnerScale(); objTrans.addChild(innerTG); // Create a smaller sphere to go inside. This sphere has a different // tesselation and color Sphere inWireSphere = new Sphere(sphereRadius, 0, 10, wireApp); innerTG.addChild(inWireSphere); // inside solid ColoringAttributes inCa = new ColoringAttributes(blue, ColoringAttributes.SHADE_FLAT); Appearance inSolid = new Appearance(); inSolid.setColoringAttributes(inCa); inSolid.setPolygonAttributes(solidPa); Sphere inSolidSphere = new Sphere(sphereRadius, 0, 10, inSolid); innerTG.addChild(inSolidSphere); // Create a new Behavior object that will perform the desired // operation on the specified transform object and add it into // the scene graph. AxisAngle4f axisAngle = new AxisAngle4f(0.0f, 0.0f, 1.0f, -(float) Math.PI / 2.0f); Transform3D yAxis = new Transform3D(); Alpha rotationAlpha = new Alpha(-1, Alpha.INCREASING_ENABLE, 0, 0, 80000, 0, 0, 0, 0, 0); RotationInterpolator rotator = new RotationInterpolator(rotationAlpha, objTrans, yAxis, 0.0f, (float) Math.PI * 2.0f); BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0); rotator.setSchedulingBounds(bounds); objTrans.addChild(rotator); // set up a white background Background bgWhite = new Background(new Color3f(1.0f, 1.0f, 1.0f)); bgWhite.setApplicationBounds(bounds); objTrans.addChild(bgWhite); // Have Java 3D perform optimizations on this scene graph. objRoot.compile(); return objRoot; }