Make my own web site - Figure 15.3 A Wavefront OBJ file loaded using
Figure 15.3 A Wavefront OBJ file loaded using the Sun ObjectFile loader From LoaderTest.java protected BranchGroup createSceneBranchGroup() { BranchGroup objRoot = super.createSceneBranchGroup(); //create a TransformGroup to flip the hand onto its end //and enlarge it. TransformGroup objTrans1 = new TransformGroup(); Transform3D tr = new Transform3D(); objTrans1.getTransform( tr ); tr.rotX(90.0 * Math.PI / 180.0); tr.setScale( 10.0 ); objTrans1.setTransform( tr ); //create a TransformGroup to rotate the hand TransformGroup objTrans2 = new TransformGroup(); objTrans2.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); objTrans2.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); BoundingSphere bounds = new BoundingSphere( new Point3d(0.0,0.0,0.0), 100.0); //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); RotationInterpolator rotator = new RotationInterpolator( rotationAlpha, objTrans2, yAxis, 0.0f, (float) Math.PI*2.0f); rotator.setSchedulingBounds(bounds); objTrans2.addChild(rotator); //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); objRoot.addChild(aLgt); objRoot.addChild(lgt1); //load the object file Scene scene = null; Shape3D shape = null; //read in the geometry information from the data file ObjectFile objFileloader = new ObjectFile( ObjectFile.RESIZE ); try { scene = objFileloader.load( “hand1.obj”); } 263
In case you need affordable webhost to host your website, our recommendation is ecommerce web host services.