21 snprintf( buf, 63,
"%s [%.2f %.2f %.2f %.2f]",
37 glRectf( -dx, -dy, dx, dy );
42 glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
43 glRectf( -dx, -dy, dx, dy );
44 glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
141 if( checkpoint.
time == 0 )
153 glColor4f( c.
r, c.
g, c.
b, c.
a );
165 double timescale = 0.0000001;
188 double timescale = 1e-7;
205 glColor4f( c.
r, c.
g, c.
b, c.
a );
207 glBegin( GL_TRIANGLES );
208 glVertex3f( 0, -dy, 0);
209 glVertex3f( dx, 0, 0 );
210 glVertex3f( 0, +dy, 0 );
224 (*it)->DrawOriginTree();
233 (*it)->DrawBlocksTree();
244 glBegin( GL_POINTS );
245 glVertex3f( pose.
x, pose.
y, pose.
z );
261 (*it)->DrawBoundingBoxTree();
273 glBegin( GL_QUAD_STRIP );
296 glVertex2f( -0.02, 0 );
297 glVertex2f( +0.02, 0 );
299 glVertex2f( 0, -0.02 );
300 glVertex2f( 0, +0.02 );
362 (*it)->DrawStatusTree( cam );
370 float pitch = - cam->
pitch();
371 float yaw = - cam->
yaw();
375 float robotAngle = -
rtod(gpz.
a);
379 glTranslatef( 0, 0, 0.5 );
382 glRotatef( robotAngle - yaw, 0,0,1 );
383 glRotatef( -pitch, 1,0,0 );
390 glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
393 glRasterPos3f( 0, 0, 0 );
395 glGetFloatv(GL_CURRENT_RASTER_POSITION, pos);
398 glGetBooleanv( GL_CURRENT_RASTER_POSITION_VALID, &valid );
403 float w = gl_width( this->
say_string.c_str() );
404 float h = gl_height();
408 glGetIntegerv(GL_VIEWPORT, viewport);
410 GLdouble modelview[16];
411 glGetDoublev(GL_MODELVIEW_MATRIX, modelview);
413 GLdouble projection[16];
414 glGetDoublev(GL_PROJECTION_MATRIX, projection);
417 gluUnProject( pos[0] + w, pos[1], pos[2], modelview, projection, viewport, &wx, &wy, &wz );
419 gluUnProject( pos[0], pos[1] + h, pos[2], modelview, projection, viewport, &wx, &wy, &wz );
423 const float m = h/10;
427 glPushAttrib( GL_POLYGON_BIT | GL_LINE_BIT );
428 glPolygonMode( GL_FRONT, GL_FILL );
429 glEnable( GL_POLYGON_OFFSET_FILL );
430 glPolygonOffset( 1.0, 1.0 );
432 glDisable( GL_POLYGON_OFFSET_FILL );
438 glEnable( GL_LINE_SMOOTH );
439 glPolygonMode( GL_FRONT, GL_LINE );
470 double width,
double height )
475 pitch = - cam->
pitch();
480 glPolygonMode( GL_FRONT, GL_FILL );
482 glEnable(GL_TEXTURE_2D);
483 glBindTexture( GL_TEXTURE_2D, texture_id );
485 glColor4f( 1.0, 1.0, 1.0, 1.0 );
493 glRotatef( robotAngle - yaw, 0,0,1 );
494 glRotatef( -pitch - 90, 1,0,0 );
498 glTexCoord2f(0.0f, 0.0f); glVertex3f(-0.25f, 0, -0.25f );
499 glTexCoord2f(width, 0.0f); glVertex3f( 0.25f, 0, -0.25f );
500 glTexCoord2f(width, height); glVertex3f( 0.25f, 0, 0.25f );
501 glTexCoord2f(0.0f, height); glVertex3f(-0.25f, 0, 0.25f );
504 glBindTexture( GL_TEXTURE_2D, 0 );
505 glDisable(GL_TEXTURE_2D);
530 for( std::list<Flag*>::reverse_iterator it(
flag_list.rbegin());
534 double sz = (*it)->GetSize();
537 (*it)->GetColor().GLSet();
539 glVertex3f( gp.
x+d, gp.
y+0, gp.
z+0 +z);
540 glVertex3f( gp.
x+0, gp.
y+d, gp.
z+0 +z);
541 glVertex3f( gp.
x+0, gp.
y+0, gp.
z+d +z);
543 glVertex3f( gp.
x+d, gp.
y+0, gp.
z+0 +z);
544 glVertex3f( gp.
x+0, gp.
y+d, gp.
z+0 +z);
545 glVertex3f( gp.
x+0, gp.
y+0, gp.
z-d +z);
548 glVertex3f( gp.
x-d, gp.
y+0, gp.
z+0 +z);
549 glVertex3f( gp.
x+0, gp.
y-d, gp.
z+0 +z);
550 glVertex3f( gp.
x+0, gp.
y+0, gp.
z+d +z);
552 glVertex3f( gp.
x-d, gp.
y+0, gp.
z+0 +z);
553 glVertex3f( gp.
x+0, gp.
y+d, gp.
z+0 +z);
554 glVertex3f( gp.
x+0, gp.
y+0, gp.
z-d +z);
556 glVertex3f( gp.
x+d, gp.
y+0, gp.
z+0 +z);
557 glVertex3f( gp.
x+0, gp.
y-d, gp.
z+0 +z);
558 glVertex3f( gp.
x+0, gp.
y+0, gp.
z-d +z);
650 (*it)->DataVisualizeTree( cam );
virtual void PushColor(Color col)
int subs
the number of subscriptions to this model
Canvas * GetCanvas(void) const
const std::string & GetWorldfileName()
Bounds y
volume extent along y axis, initially zero
virtual void DrawBlocks()
std::list< Visualizer * > cv_list
const std::string & GetMenuName()
bool stack_children
whether child models should be stacked on top of this model or not
double max
largest value in range, initially zero
The Stage library uses its own namespace.
static const Color BUBBLE_TEXT(0, 0, 0)
void CallDisplayList(Model *mod)
virtual void DrawPicker()
void DrawStatusTree(Camera *cam)
virtual void DrawSelected(void)
void DrawImage(uint32_t texture_id, Camera *cam, float alpha, double width=1.0, double height=1.0)
static TextureManager & getInstance(void)
void EraseAll(T thing, C &cont)
double min
smallest value in range, initially zero
std::vector< TrailItem > trail
void DataVisualizeTree(Camera *cam)
virtual void Visualize(Model *mod, Camera *cam)=0
void DrawFootPrint(const Geom &geom)
meters_t z
location in 3 axes
void DrawBoundingBoxTree()
std::map< std::string, Option * > _custom_options
void RemoveVisualizer(Visualizer *custom_visual)
void RegisterOption(Option *opt)
static unsigned int trail_length
usec_t sim_time
the current sim time in this world in microseconds
void DrawTrailFootprint()
Pose GetGlobalPose() const
void draw_grid(bounds3d_t vol)
void pose_shift(const Pose &pose)
void AddVisualizer(Visualizer *custom_visual, bool on_by_default)
void draw_string(float x, float y, float z, const char *string)
bool stall
Set to true iff the model collided with something else.
Bounds x
volume extent along x axis, intially zero
std::vector< Model * > children
class Stg::Model::Visibility vis
Bounds z
volume extent along z axis, initially zero
virtual void DataVisualize(Camera *cam)
std::string say_string
if non-empty, this string is displayed in the GUI
std::list< Flag * > flag_list
void DrawSolid(const Geom &geom)
void draw_octagon(float w, float h, float m)
class Stg::Model::GuiState gui
radians_t a
rotation about the z axis.
static const Color BUBBLE_FILL(1.0, 0.8, 0.8)
virtual void DrawStatus(Camera *cam)
static const Color BUBBLE_BORDER(0, 0, 0)
const char * Token() const
meters_t ModelHeight() const