robot.c + file.c + glut = robot By: Andrew Wiles SSN: 215-15-5027 Computer Graphics This readme contains both instructions on how to use the program as well as the report on this project. Use of this program is very straightforward. As it executes, it reads the robot descriptor file specified on the command line, or, if no arguments are passed on the command line, the file 'robot.disc'. This file describes how the robot is to be constructed. As it is executing, some messages will appear on the console - these are primarily debugging messages, but I choose to leave them in because they can help you troubleshoot the descriptor file. Then, a window appears with the rendered robot as specified in the descriptor file. Manipulating the object is fairly straightforward. Clicking on a part of the robot allows you to rotate that part around its hinge point. The main body will rotate around world (0.0 0.0 0.0). Dragging with the left button allows rotation on the x and y axes simultaneously, and the middle button allows rotation on the y and z axes simultaneously. The right button allows simultaneous translation on the x axis and scaling of the entire figure. Clicking around will give the feel for the interface. The only keys that are currently active are 't' and 'T'. 't' causes the model to return to its base position - useful if it was been translated or scaled off of the screen. 'T' does the same as 't', but also removes all rotations on the object, returning the object to the way it was just as the program executed. At present, the rendering engine is very basic. It only allows creation of single boxes at the moment, only allows you to specify a single color and does not use light sources. However, design, of both the file format and the internal structures would allow for addition of lighting, textures, specular patterns and complex polygons - but this was outside of the scope of this assignment. The file format is almost a very low-level language. It is case sensitive. It begins with the main statement - specifying the body. Then a 'start' will begin designing the object. 'color' specifies the color, 'box' specifies the dimensions of the box. 'hotspot' where on the object, local to the center of the present object, the object will attach to its parent. 'attachment' specifies a new object, plus the coordinates local to the present object (not the object we are creating) where the new object will attach to the present object. The attachment and hotspot coordinates will be the same thing, but provide a method of connecting pieces of the robot. There are no restricions on limb rotations, but limbs cannot seperate from their attached position. Internally, the file is parsed into a 'robot' structure. This structure maintains the heiarchy presented in the file. So, the body becomes the base robot object. The base then contains pointers to data for the arms and legs - and the upper leg contains a ling to the lower and so on. There are no limits on how many attachments there can be - although there are only 14 the provided file, there could be many more. This method of storage allows easy use of internal gl functions to perfrom and propogate translations. Also, the rendering function is very short, because this structure allows for a recursive program design. The method I ended up using (after many other failed attempts), was to render the objects as named objects and using gl's internal selection functions. This was the easiest and most reliable method of determining which object the mouse was on. Otherwise, the rendering is done using scaled glutCubes in a depth-culled area. No specular effects are applied, and the objects only contain a color.