Revision: 7067
http://playerstage.svn.sourceforge.net/playerstage/?rev=7067&view=rev
Author: alexcb
Date: 2008-10-06 20:33:32 +0000 (Mon, 06 Oct 2008)
Log Message:
-----------
fixed stall image to draw on top of all (really tall) robots
Modified Paths:
--------------
code/stage/trunk/libstage/model.cc
code/stage/trunk/libstage/stage.hh
Modified: code/stage/trunk/libstage/model.cc
===================================================================
--- code/stage/trunk/libstage/model.cc 2008-10-06 01:32:59 UTC (rev 7066)
+++ code/stage/trunk/libstage/model.cc 2008-10-06 20:33:32 UTC (rev 7067)
@@ -1094,6 +1094,21 @@
}
}
+stg_meters_t StgModel::ModelHeight()
+{
+ stg_meters_t m_child = 0; //max size of any child
+ for( GList* it=this->children; it; it=it->next )
+ {
+ StgModel* child = (StgModel*)it->data;
+ stg_meters_t tmp_h = child->ModelHeight();
+ if( tmp_h > m_child )
+ m_child = tmp_h;
+ }
+
+ //height of model + max( child height )
+ return geom.size.z + m_child;
+}
+
void StgModel::DrawImage( uint32_t texture_id, Stg::StgCamera* cam, float
alpha )
{
float yaw, pitch;
@@ -1107,7 +1122,8 @@
glColor4f( 1.0, 1.0, 1.0, alpha );
glPushMatrix();
- glTranslatef( 0.0, 0.0, 0.75 );
+ //position image above the robot
+ glTranslatef( 0.0, 0.0, ModelHeight() + 0.3 );
// rotate to face screen
glRotatef( robotAngle - yaw, 0,0,1 );
Modified: code/stage/trunk/libstage/stage.hh
===================================================================
--- code/stage/trunk/libstage/stage.hh 2008-10-06 01:32:59 UTC (rev 7066)
+++ code/stage/trunk/libstage/stage.hh 2008-10-06 20:33:32 UTC (rev 7067)
@@ -1310,6 +1310,8 @@
///Draw the image stored in texture_id above the model
void DrawImage( uint32_t texture_id, Stg::StgCamera* cam, float alpha );
+ ///Returns the max height of the model
+ stg_meters_t ModelHeight();
// static wrapper for DrawBlocks()
static void DrawBlocks( gpointer dummykey,
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit