createEnvirons( switchNode ); //create a DistanceLOD that will (Windows 2003 server web)
Wednesday, September 26th, 2007createEnvirons( switchNode ); //create a DistanceLOD that will select the child of the Switch //node based on distance. Here we are selecting child 0 (high res)if //we are closer than 180 units to 0,0,0 and child 1 (low res) //otherwise. float[] distanceArray = {180}; DistanceLOD distanceLod = new DistanceLOD( distanceArray ); distanceLod.setSchedulingBounds( getApplicationBounds() ); distanceLod.addSwitch( switchNode ); g.addChild( distanceLod ); g.addChild( switchNode ); return hiResGroup; } //create a high resolution representation of the world: //a single texture mapped square and a larger (water colored) //square to act as a horizon. public Group createLand( Group g ) { Land land = new Land( this, g, ComplexObject.GEOMETRY | ComplexObject.TEXTURE ); Group hiResGroup = land.createObject( new Appearance(), new Vector3d(), new Vector3d( LAND_WIDTH,1,LAND_LENGTH ) , “boston.gif”, null, null ); Appearance app = new Appearance(); app.setColoringAttributes( new ColoringAttributes( WATER_COLOR_RED/255f, WATER_COLOR_GREEN/255f, WATER_COLOR_BLUE/255f, ColoringAttributes.FASTEST ) ); Land base = new Land( this, hiResGroup, ComplexObject.GEOMETRY ); base.createObject( app, new Vector3d(0,-5,0), new Vector3d( 2 * LAND_WIDTH,1,2 * LAND_LENGTH ), null, null, null ); return hiResGroup; } //create a low resolution version of the world and //applies the low resolution satellite image public Group createEnvirons( Group g ) { Land environs = new Land( this, g, ComplexObject.GEOMETRY | ComplexObject.TEXTURE ); return environs.createObject( new Appearance(), new Vector3d(), new Vector3d( 2 * LAND_WIDTH,1, 2 * LAND_LENGTH) , “environs.gif”, null, null ); } 11.10 Summary This chapter has introduced the Java 3D behavior model and described the most common built-in behaviors for UI interaction as well as the LODand Billboardbehaviors. The next chapter will introduce another important class of behaviors Interpolator used to vary objects within your scene as a function of time. 194
We highly recommend you visit web and email hosting services if you need stable and cheap web hosting platform for your web applications.