Java Reference
In-Depth Information
Figure 17. Second code segment for Myearth_applet.java
37.
public BranchGroup createSceneGraph() {
38.
BranchGroup contentRoot = new BranchGroup();
39.
TransformGroup objSpin = new TransformGroup();
40.
objSpin.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
41.
contentRoot.addChild(objSpin);
42.
Alpha rotationAlpha = new Alpha(-1, 16000);
43.
RotationInterpolator rotator = new RotationInterpolator(rotationAlpha, objSpin);
44.
BoundingSphere bounds = new BoundingSphere();
45.
rotator.setSchedulingBounds(bounds);
46.
objSpin.addChild(rotator);
47.
Appearance appear = createAppearance(); // create earth object
48.
objSpin.addChild(new Sphere(0.5f, Primitive.GENERATE_TEXTURE_COORDS, appear));
49.
contentRoot.compile();
50.
return contentRoot; }
51.
52. public static void main(String[] args) { new MainFrame(new Myearth_applet(), 1024, 600); }
53. }
summary
The use of texturing is relatively straightforward and effective for adding color and realistic
details to the surface of a visual object. Texture objects are referenced by appearance ob-
jects, and have a variety of parameters that can be adapted to suit different needs through
the Texture and TextureAttributes classes. The mapping of a texture image to a surface can
be performed manually by using setTextureCoordinate to set texture coordinates. It can
also be automatically carried out through the TexCoordGeneration class. The application
of multiple textures to a surface can give a very realistic visual effect on the visual objects
created in the virtual universe.
references
Bouvier, D. J. (2006). Getting started with the Java 3D API, Sun Microsystems. Retrieved
from http://java.sun.com/products/java-media/3D/collateral/j3d_tutorial_ch7.pdf
Engel, K., Hastreiter, P., Tomandl, B., Eberhardt, K., & Ertl, T. (2000). Combining local and
remote visualization techniques for interactive volume rendering in medical applications.
Proceedings IEEE Conference on Visualization (pp. 449-452).
Search WWH ::




Custom Search