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