To become familiar with hierarchical coordinate systems.
Write a Java program using Magician OpenGL that reads in a file describing a graphical scene (see below for the format) and displays it.
Your program should open two windows: one described in the file, that contains the graphical scene, and another containing a vertical set of checkbox fields with the names of the nested coordinate systems. Clicking on the checkbox next to the name of a nested scene element should toggle that element on/off in both windows: if the entry is on (checked), it should be displayed in the 3D scene, and if it is off (not checked), it (and all the nested elements below it) should be hidden in the 3D scene.
You must also hand in two test files that you create yourself. Each should use a reasonable camera position so that all the scene is visible, and takes up a large part of the window:
Your program should consist of a set of java files which should be commented with your name (the name you are registered under!) and ID number. One of the java files should implement a class "A2" (so the TA can execute it using the command "java A2".) The files should be emailed as attachments to a single email message to cs4451@cc.gatech.edu.
The time the mail is received will be used to determine whether or not the program is late, so be sure to allow a couple of minutes for the mail system to transmit your file if you are working right up to the deadline.
IMPORTANT: If the TA has to edit your files you will lose points. Similarly, the TA should be able to execute the class "A2", so using any other class as your main class will result in lost points.
This program is due on or before Monday, September 25th. This means it must be received by 11:59pm EDT on Monday to not be considered late.
For your camera views in your input files, try not to use "straight-on" views, as a camera that is slightly to the side and slightly angled looks better (ie. if you are looking at (0,0,0), don't look from (0,0,100), but rather from something like (25,25,100)).
You program should probably create a set of objects for each "element" it reads from the file, and then assemble the needed ones together after the file is read. You should do the obvious error checking, and simply stop your program on a bad input file: if an undefined element is used, if not enough numbers are specified on a given line, etc.
Any reasonable data structure will do: the most important thing is that the data structure you create to use during rendering be easy (efficient) to traverse. So, do not store the elements in a dictionary (indexed by their text name), and then look each one up each time it is referred to. Rather, you should simply have arrays, lists, trees or graphs of objects that you follow. Your data structure does not need to be general or editable: it is fine (and probably easier) to end up with a set of objects or arrays that create the right scene, as long as the subhierarchies defined by the group elements can be toggled on and off.
You program should be able to use an element more than once: for the checkerboard, you should be able to define one red box for the red checker piece, and refer to it more than once. The transformations on the group elements above the element should position it in the correct place.
The format of the input file is as follows:
The possible elements are:
The possible transformations that can be specified on a group element are:
Here is an example file, that creates a cross with a red verticle axis and a blue horizonatal axis:
cube topbottom .8 .2 .2 cube leftright .2 .2 .8 group top translate 0 1 0 topbottom group bottom translate 0 -1 0 topbottom group left translate -1 0 0 leftright group right translate 1 0 0 leftright group grid scale 2 2 2 left right top bottom window fourcubes size 300 300 lookat 2 2 -10 0 0 0 perspective 30 1 20
This example creates a hierarchical set of coordinate systems as follows:
grid |______________ | \ \ \ | \ \ \ left right top bottom | | | | \ / \ / leftright topbottom
There are five coordinate systems (each represented by a group element). The four visible cubes are each 2 units wide (because the top coordinate system scales up by 2). The lower coordinate systems position the unit cubes in a pattern that is 3 units high and wide. The visible pattern is 6 units high and wide (and 2 deep).
Lighting must be handled before geometry. Think about why? (it has to do with the immediate execution of commands)
There are two extra credit options on this assignment. You may do one or both, and each is worth a possible one point.