Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 652 lines (477 sloc) 14.696 kb
e65967f powerpacks now set charging flag correctly
rtv authored
1 #include "stage.hh"
2 #include "worldfile.hh"
3 #include "canvas.hh"
4 #include "texture_manager.hh"
5 using namespace Stg;
6
7 // speech bubble colors
4ccc5cd replaced stg_color_t with Color class and added static named construc…
rtv authored
8 static const Color BUBBLE_FILL( 1.0, 0.8, 0.8 );// light blue/grey
9 static const Color BUBBLE_BORDER( 0,0,0 ); // black
10 static const Color BUBBLE_TEXT( 0,0,0 ); // black
e65967f powerpacks now set charging flag correctly
rtv authored
11
12 void Model::DrawSelected()
13 {
14 glPushMatrix();
15
16 glTranslatef( pose.x, pose.y, pose.z+0.01 ); // tiny Z offset raises rect above grid
17
649ba76 O(n log n) fiducial finder
Richard Vaughan authored
18 Pose gp = GetGlobalPose();
e65967f powerpacks now set charging flag correctly
rtv authored
19
20 char buf[64];
21 snprintf( buf, 63, "%s [%.2f %.2f %.2f %.2f]",
5b0ed11 @rtv extended Model::Model to take a name parameter and simplified name ge…
authored
22 Token(), gp.x, gp.y, gp.z, rtod(gp.a) );
e65967f powerpacks now set charging flag correctly
rtv authored
23
24 PushColor( 0,0,0,1 ); // text color black
25 Gl::draw_string( 0.5,0.5,0.5, buf );
26
27 glRotatef( rtod(pose.a), 0,0,1 );
28
29 Gl::pose_shift( geom.pose );
30
31 double dx = geom.size.x / 2.0 * 1.6;
32 double dy = geom.size.y / 2.0 * 1.6;
33
34 PopColor();
35
36 PushColor( 0,1,0,0.4 ); // highlight color blue
37 glRectf( -dx, -dy, dx, dy );
38 PopColor();
39
40 PushColor( 0,1,0,0.8 ); // highlight color blue
41 glLineWidth( 1 );
42 glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
43 glRectf( -dx, -dy, dx, dy );
44 glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
45 PopColor();
46
649ba76 O(n log n) fiducial finder
Richard Vaughan authored
47
48 // testing
49
50 // highlight all fiducial robots within a certain range
51
52 // Gl::pose_inverse_shift( gp );
53
54 // double rng = 10.0;
55
56 // Model left( gp.x - rng, gp.y, world );
57 // Model right( gp.x + rng, gp.y, world );
58 // Model down( gp.x, gp.y - rng, world );
59 // Model up( gp.x, gp.y + rng, world );
60
61 // std::set<Model*>::iterator xmin = world->models_with_fiducials_byx.lower_bound( &left );
62 // std::set<Model*>::iterator xmax = world->models_with_fiducials_byx.upper_bound( &right );
63
64 // std::set<Model*>::iterator ymin = world->models_with_fiducials_byy.lower_bound( &down );
65 // std::set<Model*>::iterator ymax = world->models_with_fiducials_byy.upper_bound( &up );
66
67
68 // PushColor( Color(1,0,0,0.5) );
69
70
71 // std::vector<Model*> candidates;
72 // std::set<Model*> horiz, vert;
73
74 // while( xmin != xmax )
75 // {
76 // //candidates.insert( *xmin );
77 // horiz.insert( *xmin);
78
79 // Pose op = (*xmin)->GetGlobalPose();
80 // glRectf( op.x - 5, op.y - 5, op.x + 5, op.y + 5 );
81
82 // xmin++;
83 // }
84
85 // PopColor();
86
87 // PushColor( Color(0,0,1,0.5) );
88
89 // while( ymin != ymax )
90 // {
91 // vert.insert( *ymin );
92
93 // // candidates.insert( *ymin );
94
95 // Pose op = (*ymin)->GetGlobalPose();
96 // glRectf( op.x - 5, op.y - 5, op.x + 5, op.y + 5 );
97 // ymin++;
98 // }
99
100 // PopColor();
101
102 // PushColor( Color(0,1,0,0.5) );
103
104 // std::set_intersection( horiz.begin(), horiz.end(),
105 // vert.begin(), vert.end(),
106 // std::inserter( candidates, candidates.end() ) );
107
108 // //printf( "cand sz %lu\n", candidates.size() );
109
110 // glTranslatef( 0,0,1.0 );
111
112 // FOR_EACH( it, candidates )
113 // {
114 // Pose op = (*it)->GetGlobalPose();
115 // glRectf( op.x - 5, op.y - 5, op.x + 5, op.y + 5 );
116 // }
117
118 // PopColor();
119
120
e65967f powerpacks now set charging flag correctly
rtv authored
121 glPopMatrix();
649ba76 O(n log n) fiducial finder
Richard Vaughan authored
122
e65967f powerpacks now set charging flag correctly
rtv authored
123 }
124
125
126 void Model::DrawTrailFootprint()
127 {
996c281 replaced some c-strings with std::strings
rtv authored
128 double darkness = 0;
129 double fade = 0.5 / (double)(trail_length+1);
910541e removed glib2 dependency (after many years of good service. Thanks GL…
rtv authored
130
996c281 replaced some c-strings with std::strings
rtv authored
131 PushColor( 0,0,0,1 ); // dummy pushL just saving the color
910541e removed glib2 dependency (after many years of good service. Thanks GL…
rtv authored
132
3ea9a04 moved trail recording to worldgui from world, and made recording trai…
rtv authored
133 // this loop could be faster, but optimzing vis is not a priority
134 for( unsigned int i=0; i<trail_length; i++ )
135 {
136 // find correct offset inside ring buffer
137 TrailItem& checkpoint =
138 trail[ (i + trail_index) % trail_length ];
139
140 // ignore invalid items
141 if( checkpoint.time == 0 )
142 continue;
143
144 glPushMatrix();
145 Pose pz = checkpoint.pose;
146
147 Gl::pose_shift( pz );
148 Gl::pose_shift( geom.pose );
149
150 darkness += fade;
151 Color c = checkpoint.color;
152 c.a = darkness;
153 glColor4f( c.r, c.g, c.b, c.a );
154
155 blockgroup.DrawFootPrint( geom );
156
157 glPopMatrix();
e65967f powerpacks now set charging flag correctly
rtv authored
158 }
910541e removed glib2 dependency (after many years of good service. Thanks GL…
rtv authored
159
996c281 replaced some c-strings with std::strings
rtv authored
160 PopColor();
e65967f powerpacks now set charging flag correctly
rtv authored
161 }
162
163 void Model::DrawTrailBlocks()
164 {
165 double timescale = 0.0000001;
166
996c281 replaced some c-strings with std::strings
rtv authored
167 FOR_EACH( it, trail )
168 {
169 TrailItem& checkpoint = *it;
910541e removed glib2 dependency (after many years of good service. Thanks GL…
rtv authored
170
996c281 replaced some c-strings with std::strings
rtv authored
171 glPushMatrix();
172 Pose pz = checkpoint.pose;
173 pz.z = (world->sim_time - checkpoint.time) * timescale;
910541e removed glib2 dependency (after many years of good service. Thanks GL…
rtv authored
174
996c281 replaced some c-strings with std::strings
rtv authored
175 Gl::pose_shift( pz );
176 Gl::pose_shift( geom.pose );
910541e removed glib2 dependency (after many years of good service. Thanks GL…
rtv authored
177
996c281 replaced some c-strings with std::strings
rtv authored
178 DrawBlocks();
910541e removed glib2 dependency (after many years of good service. Thanks GL…
rtv authored
179
996c281 replaced some c-strings with std::strings
rtv authored
180 glPopMatrix();
e65967f powerpacks now set charging flag correctly
rtv authored
181 }
182 }
183
184 void Model::DrawTrailArrows()
185 {
186 double dx = 0.2;
187 double dy = 0.07;
910541e removed glib2 dependency (after many years of good service. Thanks GL…
rtv authored
188 double timescale = 1e-7;
189
190 PushColor( 0,0,0,1 ); // dummy push
e65967f powerpacks now set charging flag correctly
rtv authored
191
910541e removed glib2 dependency (after many years of good service. Thanks GL…
rtv authored
192 FOR_EACH( it, trail )
193 {
194 TrailItem& checkpoint = *it;
195
196 glPushMatrix();
197 Pose pz = checkpoint.pose;
198 // set the height proportional to age
199 pz.z = (world->sim_time - checkpoint.time) * timescale;
200
201 Gl::pose_shift( pz );
202 Gl::pose_shift( geom.pose );
203
204 Color& c = checkpoint.color;
205 glColor4f( c.r, c.g, c.b, c.a );
206
207 glBegin( GL_TRIANGLES );
208 glVertex3f( 0, -dy, 0);
209 glVertex3f( dx, 0, 0 );
210 glVertex3f( 0, +dy, 0 );
211 glEnd();
212
213 glPopMatrix();
214 }
215
216 PopColor();
e65967f powerpacks now set charging flag correctly
rtv authored
217 }
218
219 void Model::DrawOriginTree()
220 {
221 DrawPose( GetGlobalPose() );
5dee8f1 more STL-ization. may reduce performance slightly in worlds with few …
rtv authored
222
223 FOR_EACH( it, children )
224 (*it)->DrawOriginTree();
e65967f powerpacks now set charging flag correctly
rtv authored
225 }
226
227
228 void Model::DrawBlocksTree( )
229 {
230 PushLocalCoords();
5dee8f1 more STL-ization. may reduce performance slightly in worlds with few …
rtv authored
231
232 FOR_EACH( it, children )
233 (*it)->DrawBlocksTree();
234
e65967f powerpacks now set charging flag correctly
rtv authored
235 DrawBlocks();
236 PopCoords();
237 }
238
239 void Model::DrawPose( Pose pose )
240 {
241 PushColor( 0,0,0,1 );
242 glPointSize( 4 );
243
244 glBegin( GL_POINTS );
245 glVertex3f( pose.x, pose.y, pose.z );
246 glEnd();
247
248 PopColor();
249 }
250
251 void Model::DrawBlocks( )
252 {
253 blockgroup.CallDisplayList( this );
254 }
255
256 void Model::DrawBoundingBoxTree()
257 {
258 PushLocalCoords();
5dee8f1 more STL-ization. may reduce performance slightly in worlds with few …
rtv authored
259
260 FOR_EACH( it, children )
261 (*it)->DrawBoundingBoxTree();
262
e65967f powerpacks now set charging flag correctly
rtv authored
263 DrawBoundingBox();
264 PopCoords();
265 }
266
267 void Model::DrawBoundingBox()
268 {
269 Gl::pose_shift( geom.pose );
270
271 PushColor( color );
272
273 glBegin( GL_QUAD_STRIP );
274
275 glVertex3f( -geom.size.x/2.0, -geom.size.y/2.0, geom.size.z );
276 glVertex3f( -geom.size.x/2.0, -geom.size.y/2.0, 0 );
277
278 glVertex3f( +geom.size.x/2.0, -geom.size.y/2.0, geom.size.z );
279 glVertex3f( +geom.size.x/2.0, -geom.size.y/2.0, 0 );
280
281 glVertex3f( +geom.size.x/2.0, +geom.size.y/2.0, geom.size.z );
282 glVertex3f( +geom.size.x/2.0, +geom.size.y/2.0, 0 );
283
284 glVertex3f( +geom.size.x/2.0, +geom.size.y/2.0, geom.size.z );
285 glVertex3f( +geom.size.x/2.0, +geom.size.y/2.0, 0 );
286
287 glVertex3f( -geom.size.x/2.0, +geom.size.y/2.0, geom.size.z );
288 glVertex3f( -geom.size.x/2.0, +geom.size.y/2.0, 0 );
289
290 glVertex3f( -geom.size.x/2.0, -geom.size.y/2.0, geom.size.z );
291 glVertex3f( -geom.size.x/2.0, -geom.size.y/2.0, 0 );
292
293 glEnd();
294
295 glBegin( GL_LINES );
296 glVertex2f( -0.02, 0 );
297 glVertex2f( +0.02, 0 );
298
299 glVertex2f( 0, -0.02 );
300 glVertex2f( 0, +0.02 );
301 glEnd();
302
303 PopColor();
304 }
305
306 // move into this model's local coordinate frame
307 void Model::PushLocalCoords()
308 {
309 glPushMatrix();
310
08e31b0 added option to prevent stacking of models, based on patch #2919630 f…
rtv authored
311 if( parent && parent->stack_children )
e65967f powerpacks now set charging flag correctly
rtv authored
312 glTranslatef( 0,0, parent->geom.size.z );
313
314 Gl::pose_shift( pose );
315 }
316
317 void Model::PopCoords()
318 {
319 glPopMatrix();
320 }
321
a9b91ec more STLing
rtv authored
322 void Model::AddVisualizer( Visualizer* cv, bool on_by_default )
e65967f powerpacks now set charging flag correctly
rtv authored
323 {
a9b91ec more STLing
rtv authored
324 if( !cv )
64382ca cleaned up cmdline args
rtv authored
325 return;
326
327 // If there's no GUI, ignore this request
328 if( ! world_gui )
329 return;
5e9262a reworked CustomVisualizer => Visualizer - tweaked API. See ModelLaser…
rtv authored
330
64249e4 more STLing and type safety to hopefully reduce bugs
rtv authored
331 //save visual instance
a9b91ec more STLing
rtv authored
332 cv_list.push_back( cv );
64249e4 more STLing and type safety to hopefully reduce bugs
rtv authored
333
334 //register option for all instances which share the same name
335 Canvas* canvas = world_gui->GetCanvas();
336 std::map< std::string, Option* >::iterator i = canvas->_custom_options.find( cv->GetMenuName() );
337 if( i == canvas->_custom_options.end() ) {
338 Option* op = new Option( cv->GetMenuName(),
339 cv->GetWorldfileName(),
340 "",
341 on_by_default,
342 world_gui );
343 canvas->_custom_options[ cv->GetMenuName() ] = op;
344 RegisterOption( op );
345 }
e65967f powerpacks now set charging flag correctly
rtv authored
346 }
347
a9b91ec more STLing
rtv authored
348 void Model::RemoveVisualizer( Visualizer* cv )
e65967f powerpacks now set charging flag correctly
rtv authored
349 {
a9b91ec more STLing
rtv authored
350 if( cv )
64249e4 more STLing and type safety to hopefully reduce bugs
rtv authored
351 EraseAll( cv, cv_list );
1ce2551 cleaning up
rtv authored
352
353 //TODO unregister option - tricky because there might still be instances attached to different models which have the same name
e65967f powerpacks now set charging flag correctly
rtv authored
354 }
355
356
357 void Model::DrawStatusTree( Camera* cam )
358 {
359 PushLocalCoords();
360 DrawStatus( cam );
5dee8f1 more STL-ization. may reduce performance slightly in worlds with few …
rtv authored
361 FOR_EACH( it, children )
362 (*it)->DrawStatusTree( cam );
e65967f powerpacks now set charging flag correctly
rtv authored
363 PopCoords();
364 }
365
366 void Model::DrawStatus( Camera* cam )
367 {
996c281 replaced some c-strings with std::strings
rtv authored
368 if( power_pack || !say_string.empty() )
e65967f powerpacks now set charging flag correctly
rtv authored
369 {
370 float yaw, pitch;
371 pitch = - cam->pitch();
372 yaw = - cam->yaw();
373
1ce2551 cleaning up
rtv authored
374 Pose gpz = GetGlobalPose();
375
e65967f powerpacks now set charging flag correctly
rtv authored
376 float robotAngle = -rtod(gpz.a);
377 glPushMatrix();
1ce2551 cleaning up
rtv authored
378
e65967f powerpacks now set charging flag correctly
rtv authored
379 // move above the robot
380 glTranslatef( 0, 0, 0.5 );
1ce2551 cleaning up
rtv authored
381
e65967f powerpacks now set charging flag correctly
rtv authored
382 // rotate to face screen
383 glRotatef( robotAngle - yaw, 0,0,1 );
384 glRotatef( -pitch, 1,0,0 );
1ce2551 cleaning up
rtv authored
385
5402eed bugfix, fasr2
rtv authored
386 // if( power_pack )
387 //power_pack->Visualize( cam );
1ce2551 cleaning up
rtv authored
388
996c281 replaced some c-strings with std::strings
rtv authored
389 if( !say_string.empty() )
390 {
391 glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
392
393 //get raster positition, add gl_width, then project back to world coords
394 glRasterPos3f( 0, 0, 0 );
395 GLfloat pos[ 4 ];
396 glGetFloatv(GL_CURRENT_RASTER_POSITION, pos);
397
398 GLboolean valid;
399 glGetBooleanv( GL_CURRENT_RASTER_POSITION_VALID, &valid );
1ce2551 cleaning up
rtv authored
400
996c281 replaced some c-strings with std::strings
rtv authored
401 if( valid )
402 {
403 //fl_font( FL_HELVETICA, 12 );
404 float w = gl_width( this->say_string.c_str() ); // scaled text width
405 float h = gl_height(); // scaled text height
406
407 GLdouble wx, wy, wz;
408 GLint viewport[4];
409 glGetIntegerv(GL_VIEWPORT, viewport);
410
411 GLdouble modelview[16];
412 glGetDoublev(GL_MODELVIEW_MATRIX, modelview);
413
414 GLdouble projection[16];
415 glGetDoublev(GL_PROJECTION_MATRIX, projection);
1ce2551 cleaning up
rtv authored
416
996c281 replaced some c-strings with std::strings
rtv authored
417 //get width and height in world coords
418 gluUnProject( pos[0] + w, pos[1], pos[2], modelview, projection, viewport, &wx, &wy, &wz );
419 w = wx;
420 gluUnProject( pos[0], pos[1] + h, pos[2], modelview, projection, viewport, &wx, &wy, &wz );
421 h = wy;
1ce2551 cleaning up
rtv authored
422
996c281 replaced some c-strings with std::strings
rtv authored
423 // calculate speech bubble margin
424 const float m = h/10;
1ce2551 cleaning up
rtv authored
425
996c281 replaced some c-strings with std::strings
rtv authored
426 // draw inside of bubble
427 PushColor( BUBBLE_FILL );
428 glPushAttrib( GL_POLYGON_BIT | GL_LINE_BIT );
429 glPolygonMode( GL_FRONT, GL_FILL );
430 glEnable( GL_POLYGON_OFFSET_FILL );
431 glPolygonOffset( 1.0, 1.0 );
432 Gl::draw_octagon( w, h, m );
433 glDisable( GL_POLYGON_OFFSET_FILL );
434 PopColor();
1ce2551 cleaning up
rtv authored
435
996c281 replaced some c-strings with std::strings
rtv authored
436 // draw outline of bubble
437 PushColor( BUBBLE_BORDER );
438 glLineWidth( 1 );
439 glEnable( GL_LINE_SMOOTH );
440 glPolygonMode( GL_FRONT, GL_LINE );
441 Gl::draw_octagon( w, h, m );
442 glPopAttrib();
443 PopColor();
1ce2551 cleaning up
rtv authored
444
996c281 replaced some c-strings with std::strings
rtv authored
445 PushColor( BUBBLE_TEXT );
446 // draw text inside the bubble
447 Gl::draw_string( m, 2.5*m, 0, this->say_string.c_str() );
448 PopColor();
449 }
450 }
1ce2551 cleaning up
rtv authored
451 glPopMatrix();
452 }
e65967f powerpacks now set charging flag correctly
rtv authored
453
454 if( stall )
455 {
456 DrawImage( TextureManager::getInstance()._stall_texture_id, cam, 0.85 );
457 }
c69a1c9 more efficient real-time tracking
rtv authored
458
1ce2551 cleaning up
rtv authored
459 // extern GLuint glowTex;
996c281 replaced some c-strings with std::strings
rtv authored
460 // extern GLuint checkTex;
c69a1c9 more efficient real-time tracking
rtv authored
461
996c281 replaced some c-strings with std::strings
rtv authored
462 // if( parent == NULL )
463 // {
464 // glBlendFunc(GL_SRC_COLOR, GL_ONE );
465 // DrawImage( glowTex, cam, 1.0 );
466 // glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
467 // }
e65967f powerpacks now set charging flag correctly
rtv authored
468 }
469
c69a1c9 more efficient real-time tracking
rtv authored
470 void Model::DrawImage( uint32_t texture_id, Camera* cam, float alpha,
471 double width, double height )
e65967f powerpacks now set charging flag correctly
rtv authored
472 {
3ce2d0e applied patch from Jeff Donner, fixing some signed/unsigned comparisons
rtv authored
473 (void)alpha; // avoid warning about unused var
474
e65967f powerpacks now set charging flag correctly
rtv authored
475 float yaw, pitch;
476 pitch = - cam->pitch();
477 yaw = - cam->yaw();
c69a1c9 more efficient real-time tracking
rtv authored
478
479 float robotAngle = -rtod( GetGlobalPose().a);
e65967f powerpacks now set charging flag correctly
rtv authored
480
8b06ea1 fixed broken badges
rtv authored
481 glPolygonMode( GL_FRONT, GL_FILL );
482
e65967f powerpacks now set charging flag correctly
rtv authored
483 glEnable(GL_TEXTURE_2D);
484 glBindTexture( GL_TEXTURE_2D, texture_id );
485
c69a1c9 more efficient real-time tracking
rtv authored
486 glColor4f( 1.0, 1.0, 1.0, 1.0 );
e65967f powerpacks now set charging flag correctly
rtv authored
487 glPushMatrix();
488
489 //position image above the robot
c69a1c9 more efficient real-time tracking
rtv authored
490 // TODO
e65967f powerpacks now set charging flag correctly
rtv authored
491 glTranslatef( 0.0, 0.0, ModelHeight() + 0.3 );
492
493 // rotate to face screen
494 glRotatef( robotAngle - yaw, 0,0,1 );
495 glRotatef( -pitch - 90, 1,0,0 );
496
497 //draw a square, with the textured image
498 glBegin(GL_QUADS);
499 glTexCoord2f(0.0f, 0.0f); glVertex3f(-0.25f, 0, -0.25f );
500 glTexCoord2f(width, 0.0f); glVertex3f( 0.25f, 0, -0.25f );
501 glTexCoord2f(width, height); glVertex3f( 0.25f, 0, 0.25f );
502 glTexCoord2f(0.0f, height); glVertex3f(-0.25f, 0, 0.25f );
503 glEnd();
504
505 glBindTexture( GL_TEXTURE_2D, 0 );
506 glDisable(GL_TEXTURE_2D);
c69a1c9 more efficient real-time tracking
rtv authored
507
996c281 replaced some c-strings with std::strings
rtv authored
508 // glPolygonMode( GL_FRONT, GL_LINE );
509 // glColor3f( 0,0,1 );
510 // glBegin(GL_QUADS);
511 // glVertex3f(-0.25f, 0, -0.25f );
512 // glVertex3f( 0.25f, 0, -0.25f );
513 // glVertex3f( 0.25f, 0, 0.25f );
514 // glVertex3f(-0.25f, 0, 0.25f );
515 // glEnd();
c69a1c9 more efficient real-time tracking
rtv authored
516
517 glPopMatrix();
e65967f powerpacks now set charging flag correctly
rtv authored
518 }
519
520
521 void Model::DrawFlagList( void )
522 {
2c36066 fixed color bug in flags, and more STLing
rtv authored
523 if( flag_list.size() < 1 )
e65967f powerpacks now set charging flag correctly
rtv authored
524 return;
525
526 PushLocalCoords();
527
528 glPolygonMode( GL_FRONT, GL_FILL );
529
530 GLUquadric* quadric = gluNewQuadric();
531 glTranslatef(0,0,1); // jump up
532 Pose gpose = GetGlobalPose();
533 glRotatef( 180 + rtod(-gpose.a),0,0,1 );
534
2c36066 fixed color bug in flags, and more STLing
rtv authored
535 for( std::list<Flag*>::reverse_iterator it( flag_list.rbegin());
536 it != flag_list.rend();
537 it++ )
538 {
539 Flag* flag = *it;
e65967f powerpacks now set charging flag correctly
rtv authored
540
56f0f6d small optimization in Block::RemoveFromCellArray
Richard Vaughan authored
541 double sz = flag->GetSize();
2c36066 fixed color bug in flags, and more STLing
rtv authored
542
56f0f6d small optimization in Block::RemoveFromCellArray
Richard Vaughan authored
543 glTranslatef( 0, 0, sz/2.0 );
544 flag->Draw( quadric );
545 glTranslatef( 0, 0, sz/2.0 );
e65967f powerpacks now set charging flag correctly
rtv authored
546 }
547
548
549 gluDeleteQuadric( quadric );
550
551 PopCoords();
552 }
553
554
910541e removed glib2 dependency (after many years of good service. Thanks GL…
rtv authored
555 // void Model::DrawBlinkenlights()
556 // {
557 // PushLocalCoords();
e65967f powerpacks now set charging flag correctly
rtv authored
558
910541e removed glib2 dependency (after many years of good service. Thanks GL…
rtv authored
559 // GLUquadric* quadric = gluNewQuadric();
560 // //glTranslatef(0,0,1); // jump up
561 // //Pose gpose = GetGlobalPose();
562 // //glRotatef( 180 + rtod(-gpose.a),0,0,1 );
e65967f powerpacks now set charging flag correctly
rtv authored
563
910541e removed glib2 dependency (after many years of good service. Thanks GL…
rtv authored
564 // for( unsigned int i=0; i<blinkenlights->len; i++ )
565 // {
e45b70c combined laser and ranger functionality into ranger - still buggy
Richard Vaughan authored
566 // blinkenlight_t* b =
567 // (blinkenlight_t*)g_ptr_array_index( blinkenlights, i );
910541e removed glib2 dependency (after many years of good service. Thanks GL…
rtv authored
568 // assert(b);
e65967f powerpacks now set charging flag correctly
rtv authored
569
910541e removed glib2 dependency (after many years of good service. Thanks GL…
rtv authored
570 // glTranslatef( b->pose.x, b->pose.y, b->pose.z );
e65967f powerpacks now set charging flag correctly
rtv authored
571
910541e removed glib2 dependency (after many years of good service. Thanks GL…
rtv authored
572 // PushColor( b->color );
e65967f powerpacks now set charging flag correctly
rtv authored
573
910541e removed glib2 dependency (after many years of good service. Thanks GL…
rtv authored
574 // if( b->enabled )
575 // gluQuadricDrawStyle( quadric, GLU_FILL );
576 // else
577 // gluQuadricDrawStyle( quadric, GLU_LINE );
2c36066 fixed color bug in flags, and more STLing
rtv authored
578
910541e removed glib2 dependency (after many years of good service. Thanks GL…
rtv authored
579 // gluSphere( quadric, b->size/2.0, 8,8 );
e65967f powerpacks now set charging flag correctly
rtv authored
580
910541e removed glib2 dependency (after many years of good service. Thanks GL…
rtv authored
581 // PopColor();
582 // }
e65967f powerpacks now set charging flag correctly
rtv authored
583
910541e removed glib2 dependency (after many years of good service. Thanks GL…
rtv authored
584 // gluDeleteQuadric( quadric );
e65967f powerpacks now set charging flag correctly
rtv authored
585
910541e removed glib2 dependency (after many years of good service. Thanks GL…
rtv authored
586 // PopCoords();
587 // }
e65967f powerpacks now set charging flag correctly
rtv authored
588
589 void Model::DrawPicker( void )
590 {
591 //PRINT_DEBUG1( "Drawing %s", token );
592 PushLocalCoords();
593
594 // draw the boxes
595 blockgroup.DrawSolid( geom );
596
597 // recursively draw the tree below this model
5dee8f1 more STL-ization. may reduce performance slightly in worlds with few …
rtv authored
598 FOR_EACH( it, children )
599 (*it)->DrawPicker();
e65967f powerpacks now set charging flag correctly
rtv authored
600
601 PopCoords();
602 }
603
604 void Model::DataVisualize( Camera* cam )
605 {
3ce2d0e applied patch from Jeff Donner, fixing some signed/unsigned comparisons
rtv authored
606 (void)cam; // avoid warning about unused var
e65967f powerpacks now set charging flag correctly
rtv authored
607 }
608
609 void Model::DataVisualizeTree( Camera* cam )
610 {
611 PushLocalCoords();
612
712cd33 disabled visualization drawing for unsubscribed models
rtv authored
613 if( subs > 0 )
a9b91ec more STLing
rtv authored
614 {
712cd33 disabled visualization drawing for unsubscribed models
rtv authored
615 DataVisualize( cam ); // virtual function overridden by some model types
616
617 FOR_EACH( it, cv_list )
618 {
619 Visualizer* vis = *it;
620 if( world_gui->GetCanvas()->_custom_options[ vis->GetMenuName() ]->isEnabled() )
621 vis->Visualize( this, cam );
622 }
a9b91ec more STLing
rtv authored
623 }
712cd33 disabled visualization drawing for unsubscribed models
rtv authored
624
e65967f powerpacks now set charging flag correctly
rtv authored
625 // and draw the children
5dee8f1 more STL-ization. may reduce performance slightly in worlds with few …
rtv authored
626 FOR_EACH( it, children )
627 (*it)->DataVisualizeTree( cam );
e65967f powerpacks now set charging flag correctly
rtv authored
628
629 PopCoords();
630 }
631
632 void Model::DrawGrid( void )
633 {
634 if ( gui.grid )
635 {
636 PushLocalCoords();
637
e45b70c combined laser and ranger functionality into ranger - still buggy
Richard Vaughan authored
638 bounds3d_t vol;
e65967f powerpacks now set charging flag correctly
rtv authored
639 vol.x.min = -geom.size.x/2.0;
640 vol.x.max = geom.size.x/2.0;
641 vol.y.min = -geom.size.y/2.0;
642 vol.y.max = geom.size.y/2.0;
643 vol.z.min = 0;
644 vol.z.max = geom.size.z;
645
646 PushColor( 0,0,1,0.4 );
647 Gl::draw_grid(vol);
648 PopColor();
649 PopCoords();
650 }
651 }
Something went wrong with that request. Please try again.