Revision: 6814
http://playerstage.svn.sourceforge.net/playerstage/?rev=6814&view=rev
Author: alexcb
Date: 2008-07-08 10:25:59 -0700 (Tue, 08 Jul 2008)
Log Message:
-----------
cleaned up camera class so pitch/yaw is the same sign for both types of camera
Modified Paths:
--------------
code/stage/trunk/libstage/camera.cc
code/stage/trunk/libstage/canvas.cc
code/stage/trunk/libstage/model.cc
code/stage/trunk/libstage/stage.hh
Modified: code/stage/trunk/libstage/camera.cc
===================================================================
--- code/stage/trunk/libstage/camera.cc 2008-07-08 16:44:11 UTC (rev 6813)
+++ code/stage/trunk/libstage/camera.cc 2008-07-08 17:25:59 UTC (rev 6814)
@@ -114,8 +114,8 @@
glMatrixMode (GL_MODELVIEW);
glLoadIdentity ();
- glRotatef( _pitch, 1.0, 0.0, 0.0 );
- glRotatef( _yaw, 0.0, 0.0, 1.0 );
+ glRotatef( - _pitch, 1.0, 0.0, 0.0 );
+ glRotatef( - _yaw, 0.0, 0.0, 1.0 );
glTranslatef( - _x, - _y, 0.0 );
//zooming needs to happen in the Projection code (don't use glScale for
zoom)
Modified: code/stage/trunk/libstage/canvas.cc
===================================================================
--- code/stage/trunk/libstage/canvas.cc 2008-07-08 16:44:11 UTC (rev 6813)
+++ code/stage/trunk/libstage/canvas.cc 2008-07-08 17:25:59 UTC (rev 6814)
@@ -268,8 +268,8 @@
perspective_camera.addPitch( -dy );
}
else {
- camera.setPitch( 0.5 *
static_cast<double>( dy ) );
- camera.setYaw( 0.5 *
static_cast<double>( dx ) );
+ camera.setPitch( - 0.5 *
static_cast<double>( dy ) );
+ camera.setYaw( - 0.5 *
static_cast<double>( dx ) );
}
invalidate();
redraw();
@@ -563,9 +563,9 @@
void StgCanvas::renderFrame()
{
//before drawing, order all models based on distance from camera
- float x = camera.x();
- float y = camera.y();
- float sphi = dtor( camera.yaw() );
+ float x = current_camera->x();
+ float y = current_camera->y();
+ float sphi = -dtor( current_camera->yaw() );
//estimate point of camera location - hard to do with orthogonal mode
x += -sin( sphi ) * 100;
Modified: code/stage/trunk/libstage/model.cc
===================================================================
--- code/stage/trunk/libstage/model.cc 2008-07-08 16:44:11 UTC (rev 6813)
+++ code/stage/trunk/libstage/model.cc 2008-07-08 17:25:59 UTC (rev 6814)
@@ -944,14 +944,9 @@
if( say_string )
{
float yaw, pitch;
- pitch = canvas->current_camera->pitch();
- yaw = canvas->current_camera->yaw();
+ pitch = - canvas->current_camera->pitch();
+ yaw = - canvas->current_camera->yaw();
- if( canvas->perspectiveCam == true ) {
- pitch = -pitch;
- yaw = -yaw;
- }
-
float robotAngle = -rtod(pose.a);
glPushMatrix();
@@ -1015,15 +1010,14 @@
void StgModel::DrawImage( uint32_t texture_id, Stg::StgCanvas* canvas, float
alpha )
{
- float stheta = -dtor( canvas->current_camera->pitch() );
- float sphi = dtor( canvas->current_camera->yaw() );
+ float stheta = dtor( canvas->current_camera->pitch() );
+ float sphi = - dtor( canvas->current_camera->yaw() );
if( canvas->perspectiveCam == true ) {
sphi = atan2(
( pose.x -
canvas->current_camera->x() )
,
( pose.y -
canvas->current_camera->y() )
);
- stheta = -stheta;
}
glEnable(GL_TEXTURE_2D);
Modified: code/stage/trunk/libstage/stage.hh
===================================================================
--- code/stage/trunk/libstage/stage.hh 2008-07-08 16:44:11 UTC (rev 6813)
+++ code/stage/trunk/libstage/stage.hh 2008-07-08 17:25:59 UTC (rev 6814)
@@ -1874,9 +1874,9 @@
inline void setYaw( float yaw ) { _yaw += yaw; }
inline void setPitch( float pitch ) {
_pitch += pitch;
- if( _pitch < -90 )
- _pitch = -90;
- else if( _pitch > 0 )
+ if( _pitch > 90 )
+ _pitch = 90;
+ else if( _pitch < 0 )
_pitch = 0;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit