< Zurück | Inhalt | Weiter >

10.2 Light node

java.lang.Object

|

+−−javax.media.j3d.SceneGraphObject

|

+−−javax.media.j3d.Node

|

+−−javax.media.j3d.Leaf

|

+−−javax.media.j3d.Light


Light is an abstract base class for the four types of Light Leaf Node available in Java 3D:

AmbientLight, DirectionalLight, PointLight, and SpotLight.


This section is illustrated using the LightTest.java example program. LightTest is one of the longer examples in the book. It allows the four types of light to be positioned within the scene, and for the light properties to be modified at runtime. You can thus view the results interactively. The program will certainly not win any awards for UI design, but all the parameters for all the Java 3D Light classes can be modified at runtime. In addition, geometry is also created to represent the lights themselves: a Cone, whose base is set to the color of the light, denotes the SpotLight, while a large Cone through the center of the scene denotes the direction and color of the DirectionalLight. A small Sphere is created for the PointLight.


The LightTest example, shown in figure 10.1, creates the four lights and a simple 3D scene consisting of several Spheres with a checkered floor composed from a QuadArray.


 

10.2.1 Light properties
Color
Influencing bounds
Scope
State