Revision: 6699
http://playerstage.svn.sourceforge.net/playerstage/?rev=6699&view=rev
Author: jeremy_asher
Date: 2008-06-26 16:03:15 -0700 (Thu, 26 Jun 2008)
Log Message:
-----------
Change to have camera model call DrawFloor and DrawBlocks directly
Modified Paths:
--------------
code/stage/trunk/libstage/canvas.cc
code/stage/trunk/libstage/model_camera.cc
code/stage/trunk/libstage/stage.hh
Modified: code/stage/trunk/libstage/canvas.cc
===================================================================
--- code/stage/trunk/libstage/canvas.cc 2008-06-26 22:42:56 UTC (rev 6698)
+++ code/stage/trunk/libstage/canvas.cc 2008-06-26 23:03:15 UTC (rev 6699)
@@ -467,19 +467,40 @@
glEnd();
}
-void StgCanvas::renderFrame( bool robot_camera )
-{
- //create a localy scopped showflags variable - WARNING: changing it
will NOT change the class instance's value
- uint32_t showflags = this->showflags;
- if( robot_camera == true )
- showflags = STG_SHOW_BLOCKS;
-
- if( ! (showflags & STG_SHOW_TRAILS) || robot_camera == true )
+void StgCanvas::DrawBlocks()
+{
+ for( GList* it=world->StgWorld::children; it; it=it->next )
+ {
+ StgModel* mod = ((StgModel*)it->data);
+
+ if( mod->displaylist == 0 )
+ mod->displaylist = glGenLists(1);
+
+ if( mod->rebuild_displaylist )
+ {
+ //printf( "Model %s is dirty\n", mod->Token() );
+ mod->BuildDisplayList( showflags ); // ready to be
rendered
+ }
+
+ // move into this model's local coordinate frame
+ glPushMatrix();
+ gl_pose_shift( &mod->pose );
+ gl_pose_shift( &mod->geom.pose );
+
+ // render the pre-recorded graphics for this model and
+ // its children
+ glCallList( mod->displaylist );
+
+ glPopMatrix();
+ }
+}
+
+void StgCanvas::renderFrame()
+{
+ if( ! (showflags & STG_SHOW_TRAILS) )
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
- if( robot_camera == true )
- DrawFloor();
- else if( showflags & STG_SHOW_GRID )
+ if( showflags & STG_SHOW_GRID )
DrawGlobalGrid();
@@ -541,30 +562,7 @@
if( showflags & STG_SHOW_BLOCKS )
{
- for( GList* it=world->StgWorld::children; it;
it=it->next )
- {
- StgModel* mod = ((StgModel*)it->data);
-
- if( mod->displaylist == 0 )
- mod->displaylist = glGenLists(1);
-
- if( mod->rebuild_displaylist )
- {
- //printf( "Model %s is dirty\n",
mod->Token() );
- mod->BuildDisplayList( showflags ); //
ready to be rendered
- }
-
- // move into this model's local coordinate frame
- glPushMatrix();
- gl_pose_shift( &mod->pose );
- gl_pose_shift( &mod->geom.pose );
-
- // render the pre-recorded graphics for this
model and
- // its children
- glCallList( mod->displaylist );
-
- glPopMatrix();
- }
+ DrawBlocks();
}
//mod->Draw( showflags ); // draw the stuff that changes every
update
Modified: code/stage/trunk/libstage/model_camera.cc
===================================================================
--- code/stage/trunk/libstage/model_camera.cc 2008-06-26 22:42:56 UTC (rev
6698)
+++ code/stage/trunk/libstage/model_camera.cc 2008-06-26 23:03:15 UTC (rev
6699)
@@ -140,7 +140,8 @@
_camera.setYaw( rtod( parent->GetGlobalPose().a ) - 90.0 - _yaw_offset
); //-90.0 points the camera infront of the robot instead of pointing right
_camera.Draw();
- _canvas->renderFrame( true );
+ _canvas->DrawFloor();
+ _canvas->DrawBlocks();
//read depth buffer
glReadPixels(0, 0, _width, _height,
Modified: code/stage/trunk/libstage/stage.hh
===================================================================
--- code/stage/trunk/libstage/stage.hh 2008-06-26 22:42:56 UTC (rev 6698)
+++ code/stage/trunk/libstage/stage.hh 2008-06-26 23:03:15 UTC (rev 6699)
@@ -1955,7 +1955,6 @@
void DrawRays();
void ClearRays();
void DrawGlobalGrid();
- void DrawFloor(); //simpler floor compared to grid
public:
@@ -1968,8 +1967,9 @@
void Screenshot();
void FixViewport(int W,int H);
- //robot_camera = true
- virtual void renderFrame( bool robot_camera = false );
+ void DrawFloor(); //simpler floor compared to grid
+ void DrawBlocks();
+ virtual void renderFrame();
virtual void draw();
virtual int handle( int event );
void resize(int X,int Y,int W,int H);
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