#ifndef PROPOGANDA_H #include #include #include #include #include"coldet.h" #include //info: http://freespace.virgin.net/hugo.elias/graphics/ //add double buffered animation const int MAX_NUM_FRAMES=100; const int PHONG_ID; //fix this struct vertex_type { float x,y,z; double u,v,lu,lv; int bone_ID; }; struct bone_type { float[MAX_NUM_FRAMES] xtrans, ytrans, ztrans, xrot, yrot, zrot; }; typedef double[3] vector3; typedef class model_type { public: void animate_model(int start_frame, int end_frame); //This displays //a sequence of frames void draw_model(int frame); //This displays a single frame of //the model animation void load_model(cstr filename); //This loads the model from a file CollisionModel3d collision_model; //This is the coldet collision model private: *vertex_type[] vertex_list; //pointer to the vertex array *bonetype[]bone_list; //pointer to bone array int numvertices; }; //this is the fast phong shading calculation. It determines the uv coordinates of //the light texture. //void calc_fastphonguv(vertex_type &vertex1, vertex_type vertex2, vertex_type vertex3, light_type light); { vector2 V, H, L; L[0]=x.vertex1-x.light1;//calculates the vector from the light source to the vertex L[1]=y.vertex1-y.light; L[2]=z.vertex1-z.light; V[0] = x.vertex1-x.vertex2;//calculate the vector from vertex2 to vertex1 V[1] = y.vertex1-y.vertex2; V[2] = z.vertex1-z.vertex2; H[0] = x.vertex1-x.vertex3;//calculate the vector from vertex3 to vertex1 H[1] = y.vertex1-y.vertex3; H[2] = z.vertex1-z.vertex3; u.vertex1 = ( get_dot_product3(V , L )) * 128 + 127; v.vertex1 = ( get_dot_product3(H , L )) * 128 + 127; } double get_dot_product3(vector3 a , vector3 b ) { return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]; } void draw_model(int frame) { glbegin(GL_TRIANGLES) for(int drawverts=0;drawverts-->
Make your own free website on Tripod.com