elephant.cpp README PROJECT 1 - Articulated Elephant Author: Meghan Deutscher Student Number: 58969031 Class: CPSC 414 Due Date: Thursday October 2nd, 2003 Note: Code uses template p1.cpp given by CPSC 414 instructor Tamara Munzner. All code from p1.cpp in elephant.cpp is clearly marked as being taken from p1.cpp. elephant keyboard commands (not case sensitive): ------------------------------------------------ camera change commands s - view other side of elephant (right side wrt elephant) f - view front of elephant b - view back of elephant a - camera above elephant looking down on elephant's top u - camera under elephant looking up to elephant's bottom r - default view, left side wrt elephant elephant body part movement commands t - move tail up/down h - move neck+head up/down k - curl trunk / straighten trunk l - move back left leg up/down m - move front left leg up/down n - move front right leg up/down o - move back right leg up/down g - move neck+head left to right; use in smooth animation mode to make elephant nod its head spacebar - toggle animation between jump and smooth modes q - quit program Functionality Implemented ------------------------- All the required functionality stated in the Project 1 handout was successfully implemented. This includes: The elephant modelling - body, tail, neck, head, ears, 4 legs (upper, lower and foot), and the trunk The animation: - can rotate tail wrt body - can rotate head/neck wrt body - can raise each leg (independently) - can curl trunk under - each of the above animations are available in a jump mode (from rest position to other position) and smooth mode (a smooth transition from rest to the other position) ***EXTRA CREDIT???*** I also added some eyes to the elephant. This was not to hard so it would probably be worth about 1/2 a point. Another thing that I added on was the capability for the elephant to nod its head from left to right. This can be used in both modes, but in jump mode the elephant only moves its head to the left and then back to rest. In smooth animation mode, it nods its head continuously until the user presses 'g' again. I think that this would be worth an extra point. elephant functions (in order of appearance): -------------------------------------------- FUNCTION: void idle(void) USAGE: Runs in the background if anime_toggle=1. Checks all body part toggles to perform the proper smooth animations. Redisplays after each run. FUNCTION: void drawSphere() USAGE: Draws a solid sphere with a unit radius. FUNCTION: void drawCube() USAGE: Draws a solid cube with side lengths of 2. FUNCTION: void drawLeg(angle, x1, x2, y, z) INPUT: angle --> the global angle of rotation for leg x1 --> x translation wrt elephant body (front or back leg) x2 --> x translation for animation adjustment y --> y translation for animation adjustment z --> z translation wrt elephant body (left or right leg) USAGE: draws the upper and lower part of the elephant leg. Leg position and orientation are specified by the input variables. FUNCTION: void elephantDisplay() USAGE: Sets up the camera and draws elephant. FUNCTION: void elephantKeyboard(key, x, y) USAGE: Handles keyboard events. Keyboard commands are not case sensitive. FUNCTION: void main() USAGE: Initializes window, display function, keyboard function, idle function, sets up the viewport, enables depth testing and sets up shading.