### CS475 Assignment: SmallE, Part 2

#### Pararth Shah 09005009

#### Compile and Execute:

$ make

$ ./simple

#### Implementation Details

- Modelled a Room with Table and Chair
- Room modelled using six quads
- Hierarchical modelling for table and chair (top, legs, back etc.)

- Textured SmallE, Room and furniture
- Textured floor, ceiling, walls, table and chair
- Textured SmallE's torso, wheels, arms and eyes

- Two directional lights
- Cameras
- Added options for changing camera position
- One camera follows smalle, done by updating the lookat vector in display() based on smalle's current position
- Two cameras centered on the table and chair respectively
- One camera from smalle's point of view. Camera placed at smalle's nose, looking in forward direction. Instead of calling gluLookat, implemented the transformations done by gluLookat internally to get camera co-ordinates: inverting the modelview matrix at the point of drawing the nose. Since modelview matrix is composed of only rotation and translation matrices, faster to do inversion by calculating reverse ordered product of inverses of each matrix, rather than explicitly calculating inverse of modelview matrix.

I.e. using (A1*A2*A3.....*An)^-1 == ((An^-1)*......(A3^-1)*(A2^-1)*(A1^-1))

#### Keyboard Mapping

(use capitals (shift+key) to rotate in opposite direction)

- z: rotate smalle about z axis
- x: rotate smalle about x axis
- c: rotate smalle about y axis
- q,w,e: lower neck x,y,z rotations
- a,s,d: upper neck x,y,z rotations
- t,y: rotate right arm
- u,i: rotate left arm
- f,g,h: rotate right wrist
- j,k,l: rotate left wrist
- v,b: rotate upper fingers of right wrist
- n,m: rotate upper fingers of left wrist
- o: rotate right wheel
- p: rotate left wheel
- 5,6,7: rotate head about x,y,z axis (use shift+number for opposite direction)
- UP_ARROW_KEY: translate smalle forward
- DOWN_ARROW_KEY: translate smalle backward
- LEFT_ARROW_KEY: rotate smalle left about vertical axis
- RIGHT_ARROW_KEY: rotate smalle right about vertical axis
- r: reset all degrees of freedom to default orientation

Additions: Change Camera!

- 1: Follow SmallE
- 2: Centered on Table
- 3: Centered on Chair
- 4: SmallE's View of the World

#### Screenshots