This assignment makes use of the files contained in this zip file. This assignment is due Friday, December 15.
This assignment uses model transformations, a hierarchical scene, and the Triangle primitive.
In the zip file there is a folder called demo
. In that folder there is a file called run_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.
Notice that the three letters in the demo program are not all modeled in the same way. One uses line segments, one uses "faces" and the third uses solid triangles. In your version of the program, you should replace the model that is made of LineSegment
primitives with a model made up of Triangle
primitives. In the zip file there are model files P.java
, N.java
, and W.java
that use LineSegment
primitives, model files P_F.java
, N_F.java
, and W_F.java
that use Face
primitives, and one model file, P_T.java
, that uses Triangle
primitives. Use P_T.java
as a guide to convert N.java
into N_T.java
.
In the zip file there is a program called InteractiveLetterTester.java
that you can use to examine and manipulate all the models. Use this program to test your model that uses the Triangle
primitive. One thing that makes this model a bit tricky is that you need to get all of the triangles oriented in the same direction (use CCW, counter-clock-wise). If a triangle ends up with the opposite orientation, then it disappears when it should be visible, and is visible when it should be hidden.
You should also use InteractiveLetterTester.java
as your starting point for this assignment. Make a copy of InteractiveLetterTester.java
and rename the copy PNWBuilder.java
, then add the 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_R15.java
(from renderer_18.zip) for hints of how to do this.
Turn in a zip file called CS455Hw4Surname.zip
(where Surname
is your last name) containing your versions of N_T.java
and PNWBuilder.java
.
This assignment is due Friday, December 15.