$25
CS 45500
This assignment makes use of the files contained in this zip file.
This assignment uses model transformations and a hierarchical scene.
In the zip file there is a folder called demo. In that folder there is a file called hw5_demo.cmd. If you double click on that file you can run a demo of the program you need to write. The program creates a hierarchical scene and lets the user manipulate the models in the scene. The scene has models of the letters P, N, and W grouped into a "PNW". The scene graph looks like this.
Scene
/ \
/ \
Camera List<Position>
|
|
Position
/ | \
/ | \
/ | \
Matrix null List<Position>
/ | \
/ | \
/ | \
/ | \
Position Position Position
/ | \ / | \ / | \
/ | \ / | \ / | \
Matrix P empty Matrix N empty Matrix W empty
Notice that there are four matrices in the scene graph, one for each of the three letter models and one matrix that manipulates the whole "PNW" group. The demo program uses the '/' key to cycle through the three letter models and the "PNW group so that the user can manipulate each letter individually or the whole "PNW" group. When a letter model (or the group) is chosen, the key commands should manipulate that chosen model (the model manipulation keys are the keys that translate the model, rotate the model, scale the model, and change the color of the model). Notice that when the "PNW" group is selected, its three sub-models move together and should remember their relative state within the group.
Use the program PNWBuilder.java from the zip file as your starting point. Start by adding code that creates the above scene graph. Then change the key handler code so that the model manipulation commands affect the chosen model. Your program will need a way to remember the position and orientation of each model. Look at the program InteractiveModels_R7.java (from renderer_8.zip) for hints of how to do this.