Revision: 6703
          http://playerstage.svn.sourceforge.net/playerstage/?rev=6703&view=rev
Author:   alexcb
Date:     2008-06-27 11:43:35 -0700 (Fri, 27 Jun 2008)

Log Message:
-----------
fixed grid drawing issue when camera model active

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-27 17:18:57 UTC (rev 6702)
+++ code/stage/trunk/libstage/canvas.cc 2008-06-27 18:43:35 UTC (rev 6703)
@@ -406,7 +406,7 @@
 void StgCanvas::DrawGlobalGrid()
 {
 
-       
+       glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
        stg_bounds3d_t bounds = world->GetExtent();
 
    char str[16];       
@@ -490,16 +490,16 @@
                // 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( showflags & STG_SHOW_GRID )
                DrawGlobalGrid();
 
@@ -525,7 +525,7 @@
        
        for( GList* it=selected_models; it; it=it->next )
                ((StgModel*)it->data)->DrawSelected();
-
+       
        // draw the models
        if( showflags ) // if any bits are set there's something to draw
        {

Modified: code/stage/trunk/libstage/model_camera.cc
===================================================================
--- code/stage/trunk/libstage/model_camera.cc   2008-06-27 17:18:57 UTC (rev 
6702)
+++ code/stage/trunk/libstage/model_camera.cc   2008-06-27 18:43:35 UTC (rev 
6703)
@@ -9,6 +9,7 @@
 ///////////////////////////////////////////////////////////////////////////
 
 #define CAMERA_HEIGHT 0.5
+#define CAMERA_FAR_CLIP 8.0
 
 //#define DEBUG 1
 #include "stage_internal.hh"
@@ -90,6 +91,8 @@
        
        _camera.setFov( wf->ReadLength( wf_entity, "horizfov",  
_camera.horizFov() ), wf->ReadLength( wf_entity, "vertfov",  _camera.vertFov() 
) );
        _camera.setPitch( wf->ReadLength( wf_entity, "pitch", _camera.pitch() ) 
);
+       
+       _camera.setClip( wf->ReadLength( wf_entity, "nearclip",  
_camera.nearClip() ), wf->ReadLength( wf_entity, "farclip",  CAMERA_FAR_CLIP ) 
);
 
        _yaw_offset = wf->ReadLength( wf_entity, "yaw", _yaw_offset );
        _width = wf->ReadLength( wf_entity, "width", _width );
@@ -142,6 +145,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();
        
+       
+       glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
        _canvas->DrawFloor();
        _canvas->DrawBlocks();
        

Modified: code/stage/trunk/libstage/stage.hh
===================================================================
--- code/stage/trunk/libstage/stage.hh  2008-06-27 17:18:57 UTC (rev 6702)
+++ code/stage/trunk/libstage/stage.hh  2008-06-27 18:43:35 UTC (rev 6703)
@@ -1867,6 +1867,9 @@
                        return _z_near * _z_far / ( _z_far - z_buf_val * ( 
_z_far - _z_near ) );
                }
                inline void scroll( float dy ) { _z += dy; }
+               inline float nearClip( void ) const { return _z_near; }
+               inline float farClip( void ) const { return _z_far; }
+               inline void setClip( float near, float far ) { _z_far = far; 
_z_near = near; }
 };
 
 class StgOrthoCamera : public StgCamera


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
Playerstage-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to