Revision: 6757
http://playerstage.svn.sourceforge.net/playerstage/?rev=6757&view=rev
Author: alexcb
Date: 2008-07-04 10:07:49 -0700 (Fri, 04 Jul 2008)
Log Message:
-----------
camera model drawing
Modified Paths:
--------------
code/stage/trunk/libstage/model_camera.cc
Modified: code/stage/trunk/libstage/model_camera.cc
===================================================================
--- code/stage/trunk/libstage/model_camera.cc 2008-07-04 02:44:27 UTC (rev
6756)
+++ code/stage/trunk/libstage/model_camera.cc 2008-07-04 17:07:49 UTC (rev
6757)
@@ -19,6 +19,9 @@
Option StgModelCamera::showCameraData( "Show Camera Data", "show_camera", "",
true );
+static const stg_size_t DEFAULT_SIZE = {0.15, 0.15, 0.2 };
+static const char DEFAULT_GEOM_COLOR[] = "blue";
+
/**
@ingroup model
@defgroup model_camera Camera model
@@ -110,19 +113,18 @@
printf( "Unable to use Camera Model - it must be run with a GUI
world\n" );
assert( 0 );
}
-
_canvas = world_gui->GetCanvas();
- // Set up sensible defaults
_camera.setPitch( 90.0 );
- SetColor( stg_lookup_color( "green" ) );
-
stg_geom_t geom;
- memset( &geom, 0, sizeof(geom)); // no size
- //TODO can't draw this as it blocks the laser
+ memset( &geom, 0, sizeof(geom));
+ geom.size = DEFAULT_SIZE;
SetGeom( geom );
+ // set default color
+ SetColor( stg_lookup_color(DEFAULT_GEOM_COLOR));
+
registerOption( &showCameraData );
Startup();
@@ -198,8 +200,9 @@
glViewport( 0, 0, _width, _height );
_camera.update();
_camera.SetProjection();
+ float height = GetGlobalPose().z;
//TODO reposition the camera so it isn't inside the model ( or don't
draw the parent when calling renderframe )
- _camera.setPose( parent->GetGlobalPose().x, parent->GetGlobalPose().y,
CAMERA_HEIGHT ); //TODO use something smarter than a #define - make it
configurable
+ _camera.setPose( parent->GetGlobalPose().x, parent->GetGlobalPose().y,
height ); //TODO use something smarter than a #define - make it configurable
_camera.setYaw( rtod( parent->GetGlobalPose().a ) - 90.0 - _yaw_offset
); //-90.0 points the camera infront of the robot instead of pointing right
_camera.setPitch( 90.0 - _pitch_offset );
_camera.Draw();
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