//proj2_support.h [v1.1] //Written by: Yogi Girdhar (girdhy@cs.rpi.edu) //9-29-2002 //Updated shoulder depth value, 10-7-2002 #include #include #include using namespace std; #define TORSO_WIDTH 3.0 #define TORSO_HEIGHT 3.0 #define TORSO_DEPTH 0.5 #define UPPER_ARM_WIDTH 0.6 #define UPPER_ARM_HEIGHT 1.5 #define UPPER_ARM_DEPTH 0.5 #define LOWER_ARM_WIDTH 0.5 #define LOWER_ARM_HEIGHT 1.5 #define LOWER_ARM_DEPTH 0.4 #define HEAD_WIDTH 1.2 #define HEAD_HEIGHT 1.2 #define HEAD_DEPTH 0.5 #define NECK_WIDTH 0.5 #define NECK_HEIGHT 0.5 #define NECK_DEPTH 0.5 #define SHOULDER_WIDTH 0.5 #define SHOULDER_DEPTH 0.55 // updated Shoulder Depth value (Oct 7) #define SHOULDER_HEIGHT 0.5 #define HIP_WIDTH 3.0 #define HIP_DEPTH 0.5 #define HIP_HEIGHT 1.0 #define UPPER_LEG_WIDTH 1.0 #define UPPER_LEG_HEIGHT 2.5 #define UPPER_LEG_DEPTH 0.5 #define LOWER_LEG_WIDTH 0.8 #define LOWER_LEG_HEIGHT 2.0 #define LOWER_LEG_DEPTH 0.4 /* This class can be used to load a animation file and then iterate through all the keyframes. You are not really required to use this. So if you want to use your own code then that is fine. */ class animation_handler { vector data; public: typedef vector::iterator iterator; animation_handler(char *filename) { ifstream inf(filename); if(!inf) { cerr<<"Error loading file: "<>a>>b>>c>>d>>e>>f>>g>>h>>i>>j>>k>>l>>m; float *angles; while(inf) { angles=new float[13]; angles[0]=a; angles[1]=b; angles[2]=c; angles[3]=d; angles[4]=e; angles[5]=f; angles[6]=g; angles[7]=h; angles[8]=i; angles[9]=j; angles[10]=k; angles[11]=l; angles[12]=m; data.push_back(angles); //cerr<>a>>b>>c>>d>>e>>f>>g>>h>>i>>j>>k>>l>>m; } } iterator begin() { return data.begin(); } iterator end() { return data.end(); } }; /* //here is a way you can use the above class //------------------------------------------- //this part initializes the animation_handler object animation_handler *ah; ah=new animation_handler(filename); animation_handler::iterator frame_iter; frame_iter = ah->begin(); //------------------------------------------- //this part gives you the next keyframe angles if(frame_iter == ah->end()) frame_iter=ah->begin(); float *angles; angles = *frame_iter; angle_head = angles[0]; angle_neck = angles[1]; angle_torso =angles[2]; angle_left_shoulder = angles[3]; angle_left_upper_arm = angles[4]; angle_left_lower_arm = angles[5]; angle_right_shoulder = angles[6]; angle_right_upper_arm = angles[7]; angle_right_lower_arm = angles[8]; angle_left_upper_leg = angles[9]; angle_left_lower_leg = angles[10]; angle_right_upper_leg = angles[11]; angle_right_lower_leg = angles[12]; frame_iter++; //goto the next keyframe */