Key Classes and Rendering Modes
The key M3G classes involved with 3D object creation and rendering include:
- Object geometry classes, such as VertexArray, which store the vertexes that form a 3D object's surfaces. A Mesh class contains a VertexBuffer that stores several VertexArrays used to describe complex surfaces. M3G 1.0 and 1.1 construct all surfaces with triangle strips.
- Rendering attributes classes, which specify an object's visual characteristics. Appearance serves as a container for these other attribute classes. An instance of Appearance can share its visual information and attributes among multiple instances of a 3D object, thus conserving memory.
- Scene-graph classes gather 3D objects into logical groups that represent 3D models (such as a robot) or assemble a complete 3D scene, say, a robot in a bar. The special classes Light and Camera determine how the scene is lit or its point of view (POV).
- Rendering control classes execute the rendering operation. Graphics3D contains rendering methods that draw either entire scene graphs (or world) or just meshes (objects).
- Loader reads and verifies the contents of M3G files. It parses the file's contents into instances of M3G objects. The loader can read complete 3D scenes and animation data as well as objects.
Here, I concentrate on the object geometry and rendering attributes classes because they handle the model's construction and appearance. Figure 1 illustrates how these two groups of classes display a 3D model. The Camera and Light scene-graph classes figure in all rendering operations.