Revision: 6547
          http://playerstage.svn.sourceforge.net/playerstage/?rev=6547&view=rev
Author:   alexcb
Date:     2008-06-12 09:55:06 -0700 (Thu, 12 Jun 2008)

Log Message:
-----------
setup perspective camera to work with follow selected robot

Modified Paths:
--------------
    code/stage/trunk/libstage/canvas.cc

Modified: code/stage/trunk/libstage/canvas.cc
===================================================================
--- code/stage/trunk/libstage/canvas.cc 2008-06-12 16:16:17 UTC (rev 6546)
+++ code/stage/trunk/libstage/canvas.cc 2008-06-12 16:55:06 UTC (rev 6547)
@@ -581,8 +581,18 @@
                glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
        }            
 
-       //Follow the selected robot
-       if( (showflags & STG_SHOW_FOLLOW)  && last_selection ) {
+       
+       if( use_perspective_camera == true ) {
+               if( (showflags & STG_SHOW_FOLLOW)  && last_selection ) {
+                       //Follow the selected robot
+                       stg_pose_t gpose = last_selection->GetGlobalPose();
+                       perspective_camera.setPose( gpose.x, gpose.y, 0.1 );
+                       perspective_camera.setYaw( rtod( gpose.a ) - 90.0 );
+                       
+               }
+               perspective_camera.Draw();
+       } else if( (showflags & STG_SHOW_FOLLOW)  && last_selection ) {
+               //Follow the selected robot
                stg_pose_t gpose = last_selection->GetGlobalPose();
                camera.setPose( gpose.x, gpose.y );
                
@@ -591,10 +601,6 @@
                camera.Draw();
        }
        
-       if( use_perspective_camera == true ) {
-               perspective_camera.Draw();
-       }
-       
        renderFrame();
 }
 


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

Reply via email to