Revision: 6486
http://playerstage.svn.sourceforge.net/playerstage/?rev=6486&view=rev
Author: jeremy_asher
Date: 2008-06-06 15:57:04 -0700 (Fri, 06 Jun 2008)
Log Message:
-----------
Improved speech bubbles
Modified Paths:
--------------
code/stage/trunk/CMakeLists.txt
code/stage/trunk/libstage/gl.cc
code/stage/trunk/libstage/main.cc
code/stage/trunk/libstage/model.cc
code/stage/trunk/libstage/stage.hh
Modified: code/stage/trunk/CMakeLists.txt
===================================================================
--- code/stage/trunk/CMakeLists.txt 2008-06-06 21:09:56 UTC (rev 6485)
+++ code/stage/trunk/CMakeLists.txt 2008-06-06 22:57:04 UTC (rev 6486)
@@ -52,10 +52,10 @@
ADD_SUBDIRECTORY(libstage)
ADD_SUBDIRECTORY(examples)
-IF( PLAYER_FOUND )
-MESSAGE( "Found Player in ${PLAYER_INCLUDE_DIRS}")
-ADD_SUBDIRECTORY(libstageplugin)
-ENDIF( PLAYER_FOUND )
+#IF( PLAYER_FOUND )
+#MESSAGE( "Found Player in ${PLAYER_INCLUDE_DIRS}")
+#ADD_SUBDIRECTORY(libstageplugin)
+#ENDIF( PLAYER_FOUND )
INSTALL(FILES rgb.txt stagelogo.png
DESTINATION share/stage
Modified: code/stage/trunk/libstage/gl.cc
===================================================================
--- code/stage/trunk/libstage/gl.cc 2008-06-06 21:09:56 UTC (rev 6485)
+++ code/stage/trunk/libstage/gl.cc 2008-06-06 22:57:04 UTC (rev 6486)
@@ -5,7 +5,7 @@
void Stg::gl_coord_shift( double x, double y, double z, double a )
{
glTranslatef( x,y,z );
- glRotatef( rtod(a), 0,0,1 );
+ glRotatef( rtod(a), 0,0,1 );
}
// transform the current coordinate frame by the given pose
@@ -28,7 +28,23 @@
gl_draw_string( x, y, z, str );
}
+// draw an octagon with center rectangle dimensions w/h
+// and outside margin m
+void Stg::gl_draw_octagon( float w, float h, float m )
+{
+ glBegin(GL_POLYGON);
+ glVertex2f( m+w, 0 );
+ glVertex2f( w+2*m, m );
+ glVertex2f( w+2*m, h+m );
+ glVertex2f( m+w, h+2*m );
+ glVertex2f( m, h+2*m );
+ glVertex2f( 0, h+m );
+ glVertex2f( 0, m );
+ glVertex2f( m, 0 );
+ glEnd();
+}
+
void Stg::gl_draw_grid( stg_bounds3d_t vol )
{
glBegin(GL_LINES);
Modified: code/stage/trunk/libstage/main.cc
===================================================================
--- code/stage/trunk/libstage/main.cc 2008-06-06 21:09:56 UTC (rev 6485)
+++ code/stage/trunk/libstage/main.cc 2008-06-06 22:57:04 UTC (rev 6486)
@@ -17,7 +17,7 @@
int main( int argc, char* argv[] )
{
- printf( "%s %s ", PROJECT, VERSION );
+ //printf( "%s %s ", PROJECT, VERSION );
int ch=0, optindex=0;
bool usegui = true;
Modified: code/stage/trunk/libstage/model.cc
===================================================================
--- code/stage/trunk/libstage/model.cc 2008-06-06 21:09:56 UTC (rev 6485)
+++ code/stage/trunk/libstage/model.cc 2008-06-06 22:57:04 UTC (rev 6486)
@@ -131,6 +131,12 @@
const bool STG_DEFAULT_MOD_OUTLINE = true;
const bool STG_DEFAULT_MOD_RANGERRETURN = true;
+
+// speech bubble colors
+const stg_color_t STG_BUBBLE_FILL = 0xFFC8C8FF; // light blue/grey
+const stg_color_t STG_BUBBLE_BORDER = 0xFF000000; // black
+const stg_color_t STG_BUBBLE_TEXT = 0xFF000000; // black
+
// constructor
StgModel::StgModel( StgWorld* world,
StgModel* parent,
@@ -946,49 +952,64 @@
gl_pose_shift( &this->geom.pose );
+
+
+ if( flags & STG_SHOW_DATA )
+ DataVisualize();
+
+ if( gui_grid && (flags & STG_SHOW_GRID) )
+ DrawGrid();
+
+ if( flag_list )
+ DrawFlagList();
+
+ if( blinkenlights )
+ DrawBlinkenlights();
+
+ // draw speech bubble
if( this->say_string )
{
- glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
-
glPushMatrix();
+ // move above the robot
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
+ // rotate to face screen
+ glRotatef( -rtod(global_pose.a + canvas->sphi), 0,0,1 );
+ glRotatef( rtod(canvas->stheta), 1,0,0 );
+ const float m = 4 / canvas->scale; // margin
+ float w = gl_width( this->say_string ) / canvas->scale; // scaled text
width
+ float h = gl_height() / canvas->scale; // scaled text height
- const float margin = 0.1;
- float w = gl_width( this->say_string ) / canvas->scale + 2*margin;
- float h = gl_height() / canvas->scale + 2*margin;
+ // draw inside of bubble
+ PushColor( STG_BUBBLE_FILL );
+ glPushAttrib( GL_POLYGON_BIT | GL_LINE_BIT );
+ glPolygonMode( GL_FRONT, GL_FILL );
+ glEnable( GL_POLYGON_OFFSET_FILL );
+ glPolygonOffset( 1.0, 1.0 );
+ gl_draw_octagon( w, h, m );
+ glDisable( GL_POLYGON_OFFSET_FILL );
+ PopColor();
+ // draw outline of bubble
+ PushColor( STG_BUBBLE_BORDER );
+ glLineWidth( 1 );
+ glEnable( GL_LINE_SMOOTH );
+ glPolygonMode( GL_FRONT, GL_LINE );
+ gl_draw_octagon( w, h, m );
+ glPopAttrib();
+ PopColor();
- PushColor( 0,1,0,0.5 ); // transparent green
- glRectf( 0,0, w,h ); // draw bubble
- PopColor();
-
+ // draw text
+ PushColor( STG_BUBBLE_TEXT );
glTranslatef( 0, 0, 0.1 ); // draw text forwards of bubble
- PushColor( color );
- gl_draw_string( margin, margin, 0.0, this->say_string );
+ gl_draw_string( m, m, 0.0, this->say_string );
PopColor();
-
+
glPopMatrix();
}
-
- if( flags & STG_SHOW_DATA )
- DataVisualize();
-
- if( gui_grid && (flags & STG_SHOW_GRID) )
- DrawGrid();
-
- if( flag_list )
- DrawFlagList();
-
- if( blinkenlights )
- DrawBlinkenlights();
-
+
if( stall )
{
DrawImage( TextureManager::getInstance()._stall_texture_id,
canvas, 0.85 );
Modified: code/stage/trunk/libstage/stage.hh
===================================================================
--- code/stage/trunk/libstage/stage.hh 2008-06-06 21:09:56 UTC (rev 6485)
+++ code/stage/trunk/libstage/stage.hh 2008-06-06 22:57:04 UTC (rev 6486)
@@ -553,8 +553,8 @@
/** Render a string at [x,y,z] in the current color */
void gl_draw_string( float x, float y, float z, const char *string);
void gl_speech_bubble( float x, float y, float z, const char* str );
+ void gl_draw_octagon( float w, float h, float m );
-
void stg_block_list_scale( GList* blocks,
stg_size_t* size );
void stg_block_list_destroy( GList* list );
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