Project 2: Make a program that renders an articulated figure, like a hand, with lighting and simple animation, like opening & closing of the fingers. The figure can be rendered as a bunch of boxes. Use hierarchical transformations (such as glPushMatrix() & glPopMatrix()). The code should be structured in an object oriented fashion.
Project 2 is worth 10 points. The breakdown is as follows:
2: Draw something resembling a hand
2: Draw proper hand with hierarchical transforms that can open/close
2: Lighting working with correct triangle normals
2: Good object oriented style with classes for key components (Camera, Hand, Model…)
2: Generic Model class with triangle array (can be unindexed or single indexed)
Project 2 must have some object oriented structure and have classes for major components such as: Model, Camera and Light at least. If you choose to do a hand, you should have a Hand class and probably some type of Finger as well.
You don’t have to do it exactly like this, but I would suggest something like:
//// Model ////
class Model {
public:
void Draw();
void CreateBox(float xsize,float ysize,float zsize);
};
//// Camera ////
class Camera {
Vector3 Position;
Vector3 Target;
float FOV,Aspect,NearClip,FarClip;
public:
void DrawBegin(); // Clear screen, set perspective & camera position
void DrawEnd(); // Calls glSwapBuffers(), etc.
};
//// Light ////
class Light {
Vector3 Position;
Vector3 Color;
// possibly more stuff…
public:
void Draw(); // Declares light to GL
};
//// Finger ////
class Finger {
Vector3 Position; // relative to Hand
float FlexAngle;
float Length;
float Width;
Model Box; // can re-use the same model for all 3 joints if you want
public:
Finger(float length,float width,Vector3 &pos);
void Draw();
void SetFlexAngle(float f);
};
//// Hand ////
class Hand {
Model Palm;
Finger Digit[4];
// Thumb is optional…
// Might store additional transform info (position, rotation…)
public:
void Draw();
void SetFlexAngle(float f); // Sets all finger’s flex angles
};