Revision: 6692 http://playerstage.svn.sourceforge.net/playerstage/?rev=6692&view=rev Author: alexcb Date: 2008-06-26 12:46:27 -0700 (Thu, 26 Jun 2008)
Log Message: ----------- camera model documentation and cleanup Modified Paths: -------------- code/stage/trunk/libstage/model_camera.cc code/stage/trunk/libstage/stage.hh Modified: code/stage/trunk/libstage/model_camera.cc =================================================================== --- code/stage/trunk/libstage/model_camera.cc 2008-06-26 18:49:21 UTC (rev 6691) +++ code/stage/trunk/libstage/model_camera.cc 2008-06-26 19:46:27 UTC (rev 6692) @@ -97,19 +97,14 @@ void StgModelCamera::Update( void ) { - GetFrame( true ); + GetFrame(); StgModel::Update(); } -float* StgModelCamera::laser() -{ - return NULL; -} - -const char* StgModelCamera::GetFrame( bool depth_buffer ) +bool StgModelCamera::GetFrame( void ) { if( _width == 0 || _height == 0 ) - return NULL; + return false; if( _frame_data == NULL ) { if( _frame_data != NULL ) { @@ -166,7 +161,7 @@ _canvas->invalidate(); - return NULL; //_frame_data; + return true; } //TODO create lines outlineing camera frustrum, then iterate over each depth measurement and create a square @@ -175,8 +170,6 @@ if( _frame_data == NULL ) return; - //PrintData(); - float w_fov = _camera.horizFov(); float h_fov = _camera.vertFov(); Modified: code/stage/trunk/libstage/stage.hh =================================================================== --- code/stage/trunk/libstage/stage.hh 2008-06-26 18:49:21 UTC (rev 6691) +++ code/stage/trunk/libstage/stage.hh 2008-06-26 19:46:27 UTC (rev 6692) @@ -2476,8 +2476,7 @@ // CAMERA MODEL ---------------------------------------------------- typedef struct { - // GL_C4UB_V3F - GLubyte r, g, b, a; + // GL_V3F GLfloat x, y, z; } ColoredVertex; @@ -2501,10 +2500,11 @@ GLubyte* _camera_colors; StgPerspectiveCamera _camera; - int _yaw_offset; + int _yaw_offset; //position camera is mounted at + + ///Take a screenshot from the camera's perspective. return: true for sucess, and data is available via FrameDepth() / FrameColor() + bool GetFrame(); - void PrintData( void ) const; - public: StgModelCamera( StgWorld* world, StgModel* parent ); @@ -2512,17 +2512,30 @@ ~StgModelCamera(); virtual void Load(); + + ///Capture a new frame ( calls GetFrame ) virtual void Update(); + + ///Draw Camera Model - TODO virtual void Draw( uint32_t flags, StgCanvas* canvas ); + + ///Draw camera visualization virtual void DataVisualize(); + ///width of captured image inline int getWidth( void ) const { return _width; } - ///Take a screenshot from the camera's perspective - const char* GetFrame( bool depth_buffer ); + ///height of captured image + inline int getHeight( void ) const { return _height; } - ///Imiate laser scan - float* laser(); + ///get reference to camera used + inline const StgPerspectiveCamera& getCamera( void ) const { return _camera; } + + ///get a reference to camera depth buffer + inline const GLfloat* FrameDepth() const { return _frame_data; } + + ///get a reference to camera color image. 3 bytes (RGB) per pixel + inline const GLubyte* FrameColor() const { return _frame_color_data; } }; // POSITION MODEL -------------------------------------------------------- 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