< Zurück | Inhalt | Weiter >

2.4 Putting it together—MyJava3D

The MyJava3D example defines the RenderingEngine interface. This interface defines a simple rendering contract between a client and a 3D renderer implementation. The RenderingEngine interface defines a simple renderer that can render 3D geometry described using a Java 3D GeometryArray. The GeometryArray contains the 3D points and normal vectors for the 3D model to be rendered.

In addition to adding GeometryArrays to the RenderingEngine (addGeometry method), the viewpoint of the viewer can be specified (setViewAngle), the direction of a single light can be specified (setLightAngle), the scaling factor to be applied to the model can be varied (setScale), and the size of the rendering screen defined (setScreenSize).

To render all the GeometryArrays added to the RenderingEngine using the current light, screen, scale, and view parameters, clients can call the render method, supplying a Graphics object to render into, along with an optional GeometryUpdater. The GeometryUpdater allows a client to modify the positions of points or rendering parameters prior to rendering.


From AwtRenderingEngine.java
From RotatingGeometryUpdater.java
From MyJava3D.java