|
Week 17
Terrain
With inspiration from my Advanced Game Prototyping class, I implemented Terrain support with Displacement map. Terrain can easily be imported into Raina3D using a greyscale targa as the displacement map and a textured targa as the diffuse map. Terrains can be positioned just like any other object and be scaled based on minimum and maximum values.
Mel Script: Export Skeleton
Implemented a mel script (ExportSkeleton) to export skeletal joints from Maya into a xml-format. The script traverses from the selected joint (root) through its children to generate the xml code that stores the joint's name and position. Future versions will store transformation information.
New Joint Model
The Joint object has been cleaned to remove redundant positions being stored. The original model stored the start and end position of the end, which makes no sense in joints with no parents. The new model holds position only. During the Post Load and Draw functions, the joint checks if the joint has a parent. If it does, then generate and render a bone that connects the two joints.
Improved Skeleton Rendering
The previous version of the skeleton was rendering by using lines. To provide for a more appropriate skeleton model, I implemented wire spheres for the joints and calculated-vector lines for the bones. This allows joints with no parents to only render a joint. Bones are drawn using plane equation. The normal is the normalized distance between the start and end positions. Using cross products creates the two vectors needed to find the four points of the top of the joint.
MDI Window
MDI Window object was created to provide an interface for building applications that hold scene viewers. This cleans up the primary window code by inheriting it from the MDI Window object. Skeleton Animator uses the MDI Window to allow the tool to support multiple views.
Raina Tracer GUI Improvements
Several improvements have been made to the original Ray tracer GUI. Implemented the MDI Window concept to support docking of the Outliner and Edit Widgets, as well as two new components: Render Viewer and Source Code Viewer. The Render Viewer allows the user to view their render after the scene has been rendered. The Source Code Viewer is a text viewer that displays the contents of the scene xml file. In the future, the source code viewer will be directly connected to the scene for immediate changes.
New Raytracer Model
The original design model, where the Scene contained the tracer, camera, view, objects, and lights, seemed to give the Scene object more functionality than required. I re-implemented a new design model, which allows the renderer to have the Tracer, Camera, View, and Scene. This makes the Scene into a data structure for the objects and lights, rather than the primary controller of the tracer. I still need to clean out some of the logic out of the tracer and into the renderer. The original purpose of encapsulating everything into scene was to hide the functionality, but rather turned the scene into a confusing object to manipulate. The new model is cleaner and simpler to understand.
Design Pattern: Singleton
After hearing about the design pattern, I finally decided to implement singletons in both Raina3D and Raina Tracer. This improved the code in two primary ways: (1)Removed the requirement of passing several references among components and (2)Ensures only one instance of the component is created. Since Raina Tracer is in its beginning stages, the implementation of singletons was fairly eas. As for Raina3D, I'll need to replace several of the gui components and applications to singletons in the near future.
|