Revision: 6466
http://playerstage.svn.sourceforge.net/playerstage/?rev=6466&view=rev
Author: jeremy_asher
Date: 2008-06-03 17:15:13 -0700 (Tue, 03 Jun 2008)
Log Message:
-----------
draw method signature changed to accomodate speech bubble changes
Modified Paths:
--------------
code/stage/trunk/libstage/canvas.cc
code/stage/trunk/libstage/model.cc
code/stage/trunk/libstage/model_blinkenlight.cc
code/stage/trunk/libstage/stage.hh
Modified: code/stage/trunk/libstage/canvas.cc
===================================================================
--- code/stage/trunk/libstage/canvas.cc 2008-06-04 00:13:25 UTC (rev 6465)
+++ code/stage/trunk/libstage/canvas.cc 2008-06-04 00:15:13 UTC (rev 6466)
@@ -523,7 +523,7 @@
//mod->Draw( showflags ); // draw the stuff that changes every update
// draw everything else
for( GList* it=world->children; it; it=it->next )
- ((StgModel*)it->data)->Draw( showflags );
+ ((StgModel*)it->data)->Draw( showflags, this );
}
if( world->GetRayList() )
Modified: code/stage/trunk/libstage/model.cc
===================================================================
--- code/stage/trunk/libstage/model.cc 2008-06-04 00:13:25 UTC (rev 6465)
+++ code/stage/trunk/libstage/model.cc 2008-06-04 00:15:13 UTC (rev 6466)
@@ -902,7 +902,7 @@
}
-void StgModel::Draw( uint32_t flags )
+void StgModel::Draw( uint32_t flags, StgCanvas* canvas )
{
//PRINT_DEBUG1( "Drawing %s", token );
@@ -914,29 +914,36 @@
if( this->say_string )
- {
- glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
+ {
+ glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
+
+ glPushMatrix();
+
+ glTranslatef( 0, 0, 0.5 );
+
+ glRotatef( -rtod(global_pose.a), 0,0,1 ); // out of the robot pose CS
+ glRotatef( -rtod(canvas->sphi), 0,0,1 ); // out of the world view CS
+ glRotatef( rtod(canvas->stheta)-90, 1,0,0 );
+ glRotatef( 90, 1,0,0 ); // out of the ground plane
+
+
+ const float margin = 0.1;
+ float w = gl_width( this->say_string ) / canvas->scale + 2*margin;
+ float h = gl_height() / canvas->scale + 2*margin;
+
+
+ PushColor( 0.8,0.8,1.0,1.0 ); // pale blue
+ glRectf( 0,0, w,h ); // draw bubble
+ PopColor();
+
+ glTranslatef( 0, 0, 0.1 ); // draw text forwards of bubble
+ PushColor( color );
+ gl_draw_string( margin, margin, 0.0, this->say_string );
+ PopColor();
+
+ glPopMatrix();
+ }
- glPushMatrix();
-
- PushColor( 0.8,0.8,1.0,1.0 ); // pale blue
-
-
- glRotatef( -rtod(global_pose.a), 0,0,1 ); // out of the robot pose CS
- // out of the world view CS
- glRotatef( 90, 1,0,0 ); // out of the ground plane
-
- glRectf( 0,0,1,1 );
- PopColor();
-
- PushColor( color );
- gl_speech_bubble( 0.3,0.3,0, this->say_string );
- PopColor();
-
- glPopMatrix();
- }
-
-
if( flags & STG_SHOW_DATA )
DataVisualize();
@@ -961,7 +968,7 @@
// recursively draw the tree below this model
for( GList* it=children; it; it=it->next )
- ((StgModel*)it->data)->Draw( flags );
+ ((StgModel*)it->data)->Draw( flags, canvas );
glPopMatrix(); // drop out of local coords
}
Modified: code/stage/trunk/libstage/model_blinkenlight.cc
===================================================================
--- code/stage/trunk/libstage/model_blinkenlight.cc 2008-06-04 00:13:25 UTC
(rev 6465)
+++ code/stage/trunk/libstage/model_blinkenlight.cc 2008-06-04 00:15:13 UTC
(rev 6466)
@@ -110,9 +110,9 @@
}
-void StgModelBlinkenlight::Draw( uint32_t flags )
+void StgModelBlinkenlight::Draw( uint32_t flags, StgCanvas* canvas )
{
- StgModel::Draw( flags );
+ StgModel::Draw( flags, canvas );
if( on )
{
Modified: code/stage/trunk/libstage/stage.hh
===================================================================
--- code/stage/trunk/libstage/stage.hh 2008-06-04 00:13:25 UTC (rev 6465)
+++ code/stage/trunk/libstage/stage.hh 2008-06-04 00:15:13 UTC (rev 6466)
@@ -1243,7 +1243,7 @@
virtual void Shutdown();
virtual void Update();
virtual void UpdatePose();
- virtual void Draw( uint32_t flags );
+ virtual void Draw( uint32_t flags, StgCanvas* canvas );
virtual void DrawBlocks();
@@ -1695,6 +1695,7 @@
class StgCanvas : public Fl_Gl_Window
{
friend class StgWorldGui; // allow access to private members
+ friend class StgModel;
private:
GlColorStack colorstack;
@@ -2219,7 +2220,7 @@
virtual void Load();
virtual void Update();
- virtual void Draw( uint32_t flags );
+ virtual void Draw( uint32_t flags, StgCanvas* canvas );
// static wrapper for the constructor - all models must implement
// this method and add an entry in typetable.cc
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit