annotate plugins/crazychat/draw.c @ 13329:1d569233f257

[gaim-migrate @ 15699] fix a stupid bug (SF 1432924) committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sun, 26 Feb 2006 19:35:31 +0000
parents ed017b9c532d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11218
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
1 #include "righteye10.h"
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
2
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
3 typedef struct _point{
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
4 GLshort x;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
5 GLshort y;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
6 } Point;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
7
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
8 typedef struct Packet{
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
9 Point mouthLeft;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
10 Point mouthRight;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
11 Point mouthTop;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
12 Point mouthBottom;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
13 Point eyeLeft;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
14 Point eyeRight;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
15 } Packet;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
16
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
17 #define NUM_EYE_FRAMES 10
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
18
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
19 GLint rightEyes[NUM_EYE_FRAMES];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
20
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
21 void CalculateMouthPoints(GLshort[][][] ctrlpoints, struct Packet* p)
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
22 {
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
23 GLshort points[4][3];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
24 points[0][0]=p->mouthLeft.x;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
25 points[0][1]=p->mouthLeft.y;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
26 points[0][2]=front;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
27
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
28 points[1][0]=p->mouthBottom.x;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
29 points[1][1]=p->mouthTop.y;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
30 points[1][2]=front;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
31
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
32 points[2][0]=p->mouthRight.x;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
33 points[2][1]=p->mouthRight.y;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
34 points[2][2]=front;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
35
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
36 points[3][0]=p->mouthTop.x;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
37 points[3][1]=p->mouthTop.y;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
38 points[3][2]=front;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
39
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
40 ctrlpoints[0][0][0]=points[0][0];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
41 ctrlpoints[0][0][1]=points[0][1];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
42 ctrlpoints[0][0][2]=points[0][2];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
43
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
44 ctrlpoints[0][1][0]=points[1][0];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
45 ctrlpoints[0][1][1]=points[1][1];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
46 ctrlpoints[0][1][2]=points[1][2];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
47
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
48 ctrlpoints[0][2][0]=points[2][0];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
49 ctrlpoints[0][2][1]=points[2][1];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
50 ctrlpoints[0][2][2]=points[2][2];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
51
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
52 ctrlpoints[1][0][0]=points[0][0];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
53 ctrlpoints[1][0][1]=points[0][1];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
54 ctrlpoints[1][0][2]=points[0][2];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
55
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
56 ctrlpoints[1][1][0]=0;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
57 ctrlpoints[1][1][1]=0;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
58 ctrlpoints[1][1][2]=back;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
59
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
60 ctrlpoints[1][2][0]=points[2][0];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
61 ctrlpoints[1][2][1]=points[2][1];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
62 ctrlpoints[1][2][2]=points[2][2];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
63
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
64 ctrlpoints[2][0][0]=points[0][0];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
65 ctrlpoints[2][0][1]=points[0][1];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
66 ctrlpoints[2][0][2]=points[0][2];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
67
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
68 ctrlpoints[2][1][0]=points[3][0];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
69 ctrlpoints[2][1][1]=points[3][1];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
70 ctrlpoints[2][1][2]=points[3][2];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
71
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
72 ctrlpoints[2][2][0]=points[2][0];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
73 ctrlpoints[2][2][1]=points[2][1];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
74 ctrlpoints[2][2][2]=points[2][2];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
75 }
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
76
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
77 void drawMouth(struct Packet* p)
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
78 {
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
79 GLshort[4][3][3] ctrlpoints;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
80 CalculateMouthPoints(ctrlpoints, p);
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
81
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
82 glMap2f(GL_MAP2_VERTEX_3, 0, 10, 3, 3, 0.0, 10.0, 9, 3, &ctrlpoints[0][0][0]);
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
83 glEnable(GL_MAP2_VERTEX_3);
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
84 glMapGrid2f(10, 0, 10, 10, 0, 10);
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
85 glEnable(GL_AUTO_NORMAL);
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
86 glEvalMesh2(GL_FILL, 0, 10, 0, 10);
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
87 }
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
88
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
89 void initEyes(){
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
90
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
91
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
92 void drawEyes(struct Packet* p){
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
93 GLshort eye[3][3][3];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
94 CalculateEyePoints(eye, p, LEFT);
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
95 glMap2f(GL_MAP2_VERTEX_3, 0, 10, 3, 3, 0.0, 10.0, 9, 3, &eyep[0][0][0]);
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
96 glMapGrid2f(10, 0, 10, 10, 0, 10);
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
97 glEvalMesh2(GL_FILL, 0, 10, 0, 10);
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
98
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
99 CalculateEyePoints(eye, p, RIGHT);
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
100 glMap2f(GL_MAP2_VERTEX_3, 0, 10, 3, 3, 0.0, 10.0, 9, 3, &eyep[0][0][0]);
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
101 glMapGrid2f(10, 0, 10, 10, 0, 10);
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
102 glEvalMesh2(GL_FILL, 0, 10, 0, 10);
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
103
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
104 }
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
105
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
106 void drawHead(struct Packet* p){
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
107 }