This assignment makes use of the files contained in this zip file. This assignment is due Tuesday, September 25.
This assignment and your previous two assignments are about the data structures used at the two ends of the 3D graphics rendering pipeline; what goes into the beginning of the pipeline and what comes out of the end of the pipeline. Roughly, what goes into the pipeline is the Scene
data structure which describes the geometry of what the renderer should draw. What comes out of the pipeline is the FrameBuffer
data structure which holds the image of the scene drawn by the renderer. This assignment is about what goes into the rendering pipeline, the Scene
data structure.
For this assignment, you will define three Model
data structures that can be used to build scenes and then use your models to build a sequence of Scene
data structures that can be given to the renderer to form a movie.
As we have said in class, a Scene
is mainly a collection of models. A Model
is a collection of vertices in 3-dimensional space (which we call "camera space") and a collection line segments. Each Vertex
contains three doubles (for the x
, y
, and z
coordinates of a point). Each LineSegment
contains the (integer) index for two Vertex
objects from the Model
. The vertices and line segments combine to form "wireframe" shapes that we see as geometric objects in the scene.
In the zip file that are three java source files, P.java
, N.java
, and W.java
. Each of these files defines a sub-class of the Model
class (from the scene
package). You need to complete these files so that each one defines a model that represents the letter of the alphabet the file is named after. You need to determine how many Vertex
and LineSegment
objects each model needs and then write the code that instantiates those objects and puts them into the model.
If you want to see examples of Model
classes, look at the files in the models
package in renderer_1.zip. In particular, look at the files Cube.java
, ,
Tetrahedron.javaOctahedron.java
, and Circle.java
, because those are the simplest models.
Here are some suggestions about writing your Model
classes. Make each letter about one unit tall (in the y-direction), about one unit wide (in the x-direction), and about 1/4 of a unit deep (in the z-direction). First do the front face of the letter and make sure it looks right (see the next paragraph). Then pretty much copy-and-paste the front face to get the back face (you'll need to update the z-values). Then connect the two faces together.
In the zip file there is a program InteractiveLetterTester.java
. After you have defined a letter model, you can use this file to interactively test your model and see how it looks. Use the command file Build_&_run_client.cmd
to compile and run the test program (just drag-and-drop the .java
file onto the command file). You need this command file because you will be compiling and running the test program against the jar file renderer_5.jar
which contains the binary class files for the renderer. When you compile and run against a jar file, you need to set the classpath to include the jar file, and the command file does this for you (be sure to look inside the command file to see how it works).
After you have your letter models looking good, you should write a program OfflinePNW.java
that uses your letter models to create an animation. In the folder example_animations
are three examples of what kind of animation you can create. Your animation does not have to look like any of these three (and your letters do not have to look like my letters), but your animation shouldn't be trivial. In the zip file there is an example program OfflineModels.java
that creates an animation. You can compile and run this program (using Build_&_run_client.cmd
) to get an idea of how to write an offline animation client.
After you have your animation program working, convert the image frames that your program produces into a real "animation" file. To do this you need to download the following zip file and unzip it to your C:\
directory.
After you have ImageMagick on your computer, and after you run your program to produce all the animation frames, just double click on the command file ImageMagick.cmd
and it should (I hope) use your frames to create an animation file called animation.gif
. Double click on your animation file to see your movie. (You can also use the supplied program OfflineModels.java
and its output to test ImageMagick.)
Turn in a zip file called CS455Hw3Surname.zip
(where Surname
is your last name) containing your versions of P.java
, N.java
, W.java
and OfflinePNW.java
along with your animation file, animation.gif
.
This assignment is due Tuesday, September 25.