By: Gaurasundara Das Bernal
Class: CMPS-160, Spring 2001
Assignment: Project




Description: A 3D closed room, sparsly populated by additional 3D objects. Included are a chair, a sofa, and a lamp, which is the true source of the light in the world. The camera is rotatable along all three axis and can also "slide" forwards and backwards, always relative the the viewer.

Keys
	'a'     - Zoom forward
	'z'     - Zoom backward
	's'     - Rotate clockwise
	'x'     - Rotate counter-clockwise
	'up'    - Rotate view downward
	'down'  - Rotate view upward
	'left'  - Rotate view left
	'right' - Rotate view right


Technicalities: Things worked on for this project


Comments & Notes:
The focus of this project was threefold. I wanted to get lighting fully-functional -- something I had failed to do in my last project. I also wanted to get a camera that was competely "free" from the true axis in the world, and would always move relative to the viewer. Lastly, I wanted to understand the basics of applying 2D textures to the 3D models.

Lighting was the first thing I tackled. From my previous project, I had lighting slightly under controll, but didn't really understand what was happening. So, in order to debug my code, I had to back track and carefully inspect each and every step, sometimes hand-calculating vectors to see if my expectations matched what my program was doing. After finding some flaws in my code, and rewriting some problems, I was able to correctly calculate the normals for each polygon, sum up the polygon normals for each point, and then use these to correctly shade each polygon with glNormal3d().

Then came the more challenging part of this project, an independent camera. I first worked on zooming forwards and backwards, thinking that this would be the easiest of all independent movement. This basically just involves finding the difference between the camera position and the lookAt point. Then multiply it by a magic number that'll determine how "fast" we want to do the zooming.

Next was trying to figure out how to rotate left and rotate right, regardless of the orientation of the camera. This alone took aproximately a day's worth of trial and error, and finally I came up with the idea of creating a new "left" vector, of which I could use to do relative movement. I use a "left" vector, a "forward" vector, and an "up" vector, all of unit-size, all centered at the origin of the camera, as the vectors that assit me in rotating the camera.

When I want to rotate left, I take a fraction of my left vector, add it to my forward vector, and this produces a new vector, which is the equivelent of a "left tick" of my forward vector. I normalize this vector, and rename it my forward vector. I then take my up vector, cross it with my new forward vector, and produce my new left vector. Similar steps are used to do the up-down rotating and the clockwise-counter-clockwise rotations.

Texturing ideas, and code for loading .rgb files, were taken from Ben Gertzfield's source code. As of the writing of this, texturing is yet to work, though.

In order to diplay my world, I had to create a list of objects to be displayed, along with a configurable default settings file that could be associated with each object. This turned out to be a fairly simple, yet powerfull "setup" that allows the basic landscaping of any amount of standard objects.