Mercurial > pidgin.yaz
comparison pidgin/plugins/crazychat/cc_output.c @ 31534:a8cc50c2279f
Remove trailing whitespace
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Tue, 04 Jan 2011 06:55:30 +0000 |
parents | 5fe8042783c1 |
children |
comparison
equal
deleted
inserted
replaced
31533:44f53d3fc54f | 31534:a8cc50c2279f |
---|---|
58 mouth_open = (float)(count%10)/10; | 58 mouth_open = (float)(count%10)/10; |
59 dir = CONST; | 59 dir = CONST; |
60 curr_mode = NORMAL; | 60 curr_mode = NORMAL; |
61 return; | 61 return; |
62 */ | 62 */ |
63 | 63 |
64 //find z plane from percentage of face | 64 //find z plane from percentage of face |
65 if(instance->features->head_size==0){ | 65 if(instance->features->head_size==0){ |
66 z = 5; | 66 z = 5; |
67 } | 67 } |
68 | 68 |
69 temp = (GLfloat)instance->features->head_size/40.0; | 69 temp = (GLfloat)instance->features->head_size/40.0; |
70 //printf("head size %d\n", instance->features->head_size); | 70 //printf("head size %d\n", instance->features->head_size); |
71 | 71 |
72 minZ = ROOT_3; | 72 minZ = ROOT_3; |
73 z = ROOT_3*(PERSONS_HEAD/temp); | 73 z = ROOT_3*(PERSONS_HEAD/temp); |
74 if(z < minZ) | 74 if(z < minZ) |
75 z = minZ; | 75 z = minZ; |
76 | 76 |
77 //these calculations are based on a 90 degree viewing angle | 77 //these calculations are based on a 90 degree viewing angle |
78 rangeX = z*(TAN_30)*2; | 78 rangeX = z*(TAN_30)*2; |
79 rangeY = window_aspect*rangeX; | 79 rangeY = window_aspect*rangeX; |
80 temp = (GLfloat)instance->features->x; | 80 temp = (GLfloat)instance->features->x; |
81 if(temp>50) { //then its on the left | 81 if(temp>50) { //then its on the left |
85 else { | 85 else { |
86 temp = (50.0-temp)/50.0; | 86 temp = (50.0-temp)/50.0; |
87 x = 0 + temp*rangeX/1.0; | 87 x = 0 + temp*rangeX/1.0; |
88 } | 88 } |
89 | 89 |
90 temp = (GLfloat)instance->features->y; | 90 temp = (GLfloat)instance->features->y; |
91 | 91 |
92 if(temp>50){ | 92 if(temp>50){ |
93 temp = (temp-50.0)/50.0; | 93 temp = (temp-50.0)/50.0; |
94 y = 0 - temp*rangeY/1.0; | 94 y = 0 - temp*rangeY/1.0; |
95 } | 95 } |
111 dir = CONST; | 111 dir = CONST; |
112 instance->past_y=y; | 112 instance->past_y=y; |
113 | 113 |
114 mouth_open = (float)instance->features->mouth_open/105; | 114 mouth_open = (float)instance->features->mouth_open/105; |
115 count++; | 115 count++; |
116 //mouth_open = (count%10)/(10); | 116 //mouth_open = (count%10)/(10); |
117 | 117 |
118 if(instance->features->left_eye_open==0){ | 118 if(instance->features->left_eye_open==0){ |
119 left_open = FALSE; | 119 left_open = FALSE; |
120 } | 120 } |
121 else{ | 121 else{ |
122 left_open = TRUE; | 122 left_open = TRUE; |
123 } | 123 } |
124 | 124 |
125 if(instance->features->right_eye_open==0) | 125 if(instance->features->right_eye_open==0) |
126 right_open = FALSE; | 126 right_open = FALSE; |
127 else | 127 else |
128 right_open = TRUE; | 128 right_open = TRUE; |
139 curr_mode=instance->features->mode; | 139 curr_mode=instance->features->mode; |
140 if(instance->features->kind==0) | 140 if(instance->features->kind==0) |
141 which_face=DOG; | 141 which_face=DOG; |
142 else | 142 else |
143 which_face=SHARK; | 143 which_face=SHARK; |
144 | 144 |
145 } | 145 } |
146 | 146 |
147 | 147 |
148 | 148 |
149 gboolean configure(GtkWidget *widget, | 149 gboolean configure(GtkWidget *widget, |
150 GdkEventConfigure *event, void *data) | 150 GdkEventConfigure *event, void *data) |
151 { | 151 { |
152 GdkGLContext *glcontext = gtk_widget_get_gl_context(widget); | 152 GdkGLContext *glcontext = gtk_widget_get_gl_context(widget); |
153 GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable(widget); | 153 GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable(widget); |
154 | 154 |
155 GLfloat w = widget->allocation.width; | 155 GLfloat w = widget->allocation.width; |
156 GLfloat h = widget->allocation.height; | 156 GLfloat h = widget->allocation.height; |
157 GLfloat aspect; | 157 GLfloat aspect; |
158 | 158 |
159 Debug("configuring\n"); | 159 Debug("configuring\n"); |
172 window_aspect = w / h; | 172 window_aspect = w / h; |
173 } else { | 173 } else { |
174 window_aspect = h / w; | 174 window_aspect = h / w; |
175 } | 175 } |
176 | 176 |
177 //glOrtho(-10, 10, -10,10, 0.0001, 1000); | 177 //glOrtho(-10, 10, -10,10, 0.0001, 1000); |
178 gluPerspective(90.0, window_aspect, 0.0001, 1000.0); | 178 gluPerspective(90.0, window_aspect, 0.0001, 1000.0); |
179 | 179 |
180 glMatrixMode(GL_MODELVIEW); | 180 glMatrixMode(GL_MODELVIEW); |
181 glLoadIdentity(); | 181 glLoadIdentity(); |
182 | 182 |
192 struct output_instance *instance = (struct output_instance*)data; | 192 struct output_instance *instance = (struct output_instance*)data; |
193 if(!data) { | 193 if(!data) { |
194 fprintf(stderr,"null\n"); | 194 fprintf(stderr,"null\n"); |
195 } | 195 } |
196 assert(instance); | 196 assert(instance); |
197 Interpolate(instance); | 197 Interpolate(instance); |
198 | 198 |
199 GdkGLContext *glcontext = gtk_widget_get_gl_context (widget); | 199 GdkGLContext *glcontext = gtk_widget_get_gl_context (widget); |
200 GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable (widget); | 200 GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable (widget); |
201 | 201 |
202 //return TRUE; | 202 //return TRUE; |
210 | 210 |
211 | 211 |
212 glClearColor(1.0, 1.0, 1.0, 0.0); | 212 glClearColor(1.0, 1.0, 1.0, 0.0); |
213 //glDisable(GL_CULL_FACE); | 213 //glDisable(GL_CULL_FACE); |
214 | 214 |
215 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); | 215 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
216 glColor3f(1.0, 1.0, 1.0); | 216 glColor3f(1.0, 1.0, 1.0); |
217 glMatrixMode(GL_MODELVIEW); | 217 glMatrixMode(GL_MODELVIEW); |
218 glLoadIdentity(); | 218 glLoadIdentity(); |
219 | 219 |
220 glTranslatef(x, y, -z); | 220 glTranslatef(x, y, -z); |
221 if(instance->my_output==LOCAL){ | 221 if(instance->my_output==LOCAL){ |
222 if(which_face==DOG){ | 222 if(which_face==DOG){ |
223 change_materials(local_dog_face, curr_materials, DOG_SHARK_CHANGE); | 223 change_materials(local_dog_face, curr_materials, DOG_SHARK_CHANGE); |
224 draw_face(local_dog_face, zrot, yrot, left_open, right_open, mouth_open, dir, curr_mode); | 224 draw_face(local_dog_face, zrot, yrot, left_open, right_open, mouth_open, dir, curr_mode); |
225 } | 225 } |
226 else { | 226 else { |
227 change_materials(local_shark_face, curr_materials, DOG_SHARK_CHANGE); | 227 change_materials(local_shark_face, curr_materials, DOG_SHARK_CHANGE); |
228 draw_face(local_shark_face, zrot, yrot, left_open, right_open, mouth_open, dir, curr_mode); | 228 draw_face(local_shark_face, zrot, yrot, left_open, right_open, mouth_open, dir, curr_mode); |
229 } | 229 } |
230 } | 230 } |
231 else{ | 231 else{ |
232 if(which_face==DOG){ | 232 if(which_face==DOG){ |
233 change_materials(remote_dog_face, curr_materials, DOG_SHARK_CHANGE); | 233 change_materials(remote_dog_face, curr_materials, DOG_SHARK_CHANGE); |
234 draw_face(remote_dog_face, zrot, yrot, left_open, right_open, mouth_open, dir, curr_mode); | 234 draw_face(remote_dog_face, zrot, yrot, left_open, right_open, mouth_open, dir, curr_mode); |
243 else | 243 else |
244 glFlush (); | 244 glFlush (); |
245 return TRUE; | 245 return TRUE; |
246 } | 246 } |
247 | 247 |
248 void init (GtkWidget *widget, void *data) | 248 void init (GtkWidget *widget, void *data) |
249 { | 249 { |
250 setupDrawlists(REMOTE); | 250 setupDrawlists(REMOTE); |
251 setupLighting(widget); | 251 setupLighting(widget); |
252 } | 252 } |
253 | 253 |
280 glEnable(GL_LIGHT0); | 280 glEnable(GL_LIGHT0); |
281 //glEnable(GL_COLOR_MATERIAL); | 281 //glEnable(GL_COLOR_MATERIAL); |
282 //glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE); | 282 //glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE); |
283 glMaterialfv(GL_FRONT, GL_DIFFUSE, diffuse); | 283 glMaterialfv(GL_FRONT, GL_DIFFUSE, diffuse); |
284 glMateriali(GL_FRONT, GL_SHININESS, 128); | 284 glMateriali(GL_FRONT, GL_SHININESS, 128); |
285 | 285 |
286 //glEnable(GL_CULL_FACE); | 286 //glEnable(GL_CULL_FACE); |
287 | 287 |
288 glClear(GL_COLOR_BUFFER_BIT); | 288 glClear(GL_COLOR_BUFFER_BIT); |
289 glMatrixMode(GL_PROJECTION); | 289 glMatrixMode(GL_PROJECTION); |
290 glLoadIdentity(); | 290 glLoadIdentity(); |
291 //glOrtho(-2, 2, -2, 2, 0.0001, 1000); | 291 //glOrtho(-2, 2, -2, 2, 0.0001, 1000); |
292 | 292 |
293 if (w > h) { | 293 if (w > h) { |
294 window_aspect = w / h; | 294 window_aspect = w / h; |
295 } else { | 295 } else { |
296 window_aspect = h / w; | 296 window_aspect = h / w; |
297 } | 297 } |