| |
1 #include "righteye10.h" |
| |
2 |
| |
3 typedef struct _point{ |
| |
4 GLshort x; |
| |
5 GLshort y; |
| |
6 } Point; |
| |
7 |
| |
8 typedef struct Packet{ |
| |
9 Point mouthLeft; |
| |
10 Point mouthRight; |
| |
11 Point mouthTop; |
| |
12 Point mouthBottom; |
| |
13 Point eyeLeft; |
| |
14 Point eyeRight; |
| |
15 } Packet; |
| |
16 |
| |
17 #define NUM_EYE_FRAMES 10 |
| |
18 |
| |
19 GLint rightEyes[NUM_EYE_FRAMES]; |
| |
20 |
| |
21 void CalculateMouthPoints(GLshort[][][] ctrlpoints, struct Packet* p) |
| |
22 { |
| |
23 GLshort points[4][3]; |
| |
24 points[0][0]=p->mouthLeft.x; |
| |
25 points[0][1]=p->mouthLeft.y; |
| |
26 points[0][2]=front; |
| |
27 |
| |
28 points[1][0]=p->mouthBottom.x; |
| |
29 points[1][1]=p->mouthTop.y; |
| |
30 points[1][2]=front; |
| |
31 |
| |
32 points[2][0]=p->mouthRight.x; |
| |
33 points[2][1]=p->mouthRight.y; |
| |
34 points[2][2]=front; |
| |
35 |
| |
36 points[3][0]=p->mouthTop.x; |
| |
37 points[3][1]=p->mouthTop.y; |
| |
38 points[3][2]=front; |
| |
39 |
| |
40 ctrlpoints[0][0][0]=points[0][0]; |
| |
41 ctrlpoints[0][0][1]=points[0][1]; |
| |
42 ctrlpoints[0][0][2]=points[0][2]; |
| |
43 |
| |
44 ctrlpoints[0][1][0]=points[1][0]; |
| |
45 ctrlpoints[0][1][1]=points[1][1]; |
| |
46 ctrlpoints[0][1][2]=points[1][2]; |
| |
47 |
| |
48 ctrlpoints[0][2][0]=points[2][0]; |
| |
49 ctrlpoints[0][2][1]=points[2][1]; |
| |
50 ctrlpoints[0][2][2]=points[2][2]; |
| |
51 |
| |
52 ctrlpoints[1][0][0]=points[0][0]; |
| |
53 ctrlpoints[1][0][1]=points[0][1]; |
| |
54 ctrlpoints[1][0][2]=points[0][2]; |
| |
55 |
| |
56 ctrlpoints[1][1][0]=0; |
| |
57 ctrlpoints[1][1][1]=0; |
| |
58 ctrlpoints[1][1][2]=back; |
| |
59 |
| |
60 ctrlpoints[1][2][0]=points[2][0]; |
| |
61 ctrlpoints[1][2][1]=points[2][1]; |
| |
62 ctrlpoints[1][2][2]=points[2][2]; |
| |
63 |
| |
64 ctrlpoints[2][0][0]=points[0][0]; |
| |
65 ctrlpoints[2][0][1]=points[0][1]; |
| |
66 ctrlpoints[2][0][2]=points[0][2]; |
| |
67 |
| |
68 ctrlpoints[2][1][0]=points[3][0]; |
| |
69 ctrlpoints[2][1][1]=points[3][1]; |
| |
70 ctrlpoints[2][1][2]=points[3][2]; |
| |
71 |
| |
72 ctrlpoints[2][2][0]=points[2][0]; |
| |
73 ctrlpoints[2][2][1]=points[2][1]; |
| |
74 ctrlpoints[2][2][2]=points[2][2]; |
| |
75 } |
| |
76 |
| |
77 void drawMouth(struct Packet* p) |
| |
78 { |
| |
79 GLshort[4][3][3] ctrlpoints; |
| |
80 CalculateMouthPoints(ctrlpoints, p); |
| |
81 |
| |
82 glMap2f(GL_MAP2_VERTEX_3, 0, 10, 3, 3, 0.0, 10.0, 9, 3, &ctrlpoints[0][0][0]); |
| |
83 glEnable(GL_MAP2_VERTEX_3); |
| |
84 glMapGrid2f(10, 0, 10, 10, 0, 10); |
| |
85 glEnable(GL_AUTO_NORMAL); |
| |
86 glEvalMesh2(GL_FILL, 0, 10, 0, 10); |
| |
87 } |
| |
88 |
| |
89 void initEyes(){ |
| |
90 |
| |
91 |
| |
92 void drawEyes(struct Packet* p){ |
| |
93 GLshort eye[3][3][3]; |
| |
94 CalculateEyePoints(eye, p, LEFT); |
| |
95 glMap2f(GL_MAP2_VERTEX_3, 0, 10, 3, 3, 0.0, 10.0, 9, 3, &eyep[0][0][0]); |
| |
96 glMapGrid2f(10, 0, 10, 10, 0, 10); |
| |
97 glEvalMesh2(GL_FILL, 0, 10, 0, 10); |
| |
98 |
| |
99 CalculateEyePoints(eye, p, RIGHT); |
| |
100 glMap2f(GL_MAP2_VERTEX_3, 0, 10, 3, 3, 0.0, 10.0, 9, 3, &eyep[0][0][0]); |
| |
101 glMapGrid2f(10, 0, 10, 10, 0, 10); |
| |
102 glEvalMesh2(GL_FILL, 0, 10, 0, 10); |
| |
103 |
| |
104 } |
| |
105 |
| |
106 void drawHead(struct Packet* p){ |
| |
107 } |