00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://mrpt.sourceforge.net/ | 00005 | | 00006 | Copyright (C) 2005-2009 University of Malaga | 00007 | | 00008 | This software was written by the Machine Perception and Intelligent | 00009 | Robotics Lab, University of Malaga (Spain). | 00010 | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> | 00011 | | 00012 | This file is part of the MRPT project. | 00013 | | 00014 | MRPT is free software: you can redistribute it and/or modify | 00015 | it under the terms of the GNU General Public License as published by | 00016 | the Free Software Foundation, either version 3 of the License, or | 00017 | (at your option) any later version. | 00018 | | 00019 | MRPT is distributed in the hope that it will be useful, | 00020 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 00021 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 00022 | GNU General Public License for more details. | 00023 | | 00024 | You should have received a copy of the GNU General Public License | 00025 | along with MRPT. If not, see <http://www.gnu.org/licenses/>. | 00026 | | 00027 +---------------------------------------------------------------------------+ */ 00028 00029 #ifndef opengl_CCamera_H 00030 #define opengl_CCamera_H 00031 00032 #include <mrpt/opengl/CRenderizable.h> 00033 #include <mrpt/poses/CPoseOrPoint.h> 00034 00035 namespace mrpt 00036 { 00037 namespace opengl 00038 { 00039 class COpenGLViewport; 00040 class CCamera; 00041 00042 // This must be added to any CSerializable derived class: 00043 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE( CCamera, CRenderizable ) 00044 00045 /** A camera: if added to a scene, the viewpoint defined by this camera will be used instead of the camera parameters set in COpenGLViewport::m_camera. 00046 * A camera can be defined to provide a projective or orthogonal view of the world by setting the member CCamera::m_projectiveModel. 00047 * \sa opengl::COpenGLScene 00048 */ 00049 class MRPTDLLIMPEXP CCamera : public CRenderizable 00050 { 00051 friend class COpenGLViewport; 00052 00053 DEFINE_SERIALIZABLE( CCamera ) 00054 protected: 00055 00056 float m_pointingX,m_pointingY,m_pointingZ; 00057 float m_distanceZoom; 00058 float m_azimuthDeg,m_elevationDeg; 00059 00060 bool m_projectiveModel; //!< If set to true (default), camera model is projective, otherwise, it's orthogonal. 00061 float m_projectiveFOVdeg; //!< Field-of-View in degs, only when projectiveModel=true (default=30 deg). 00062 00063 public: 00064 void setPointingAt(float x,float y, float z) { m_pointingX=x; m_pointingY=y; m_pointingZ=z; } 00065 void setPointingAt(const mrpt::poses::CPoseOrPoint &p); 00066 00067 float getPointingAtX() const { return m_pointingX; } 00068 float getPointingAtY() const { return m_pointingY; } 00069 float getPointingAtZ() const { return m_pointingZ; } 00070 00071 void setZoomDistance(float z) { m_distanceZoom=z; } 00072 float getZoomDistance() const { return m_distanceZoom; } 00073 00074 float getAzimuthDegrees() const { return m_azimuthDeg; } 00075 float getElevationDegrees() const { return m_elevationDeg; } 00076 00077 void setAzimuthDegrees(float ang) { m_azimuthDeg=ang; } 00078 void setElevationDegrees(float ang) { m_elevationDeg=ang; } 00079 00080 void setProjectiveModel(bool v=true) { m_projectiveModel=v; } //!< Enable/Disable projective mode (vs. orthogonal) 00081 void setOrthogonal(bool v=true) { m_projectiveModel=!v; } //!< Enable/Disable orthogonal mode (vs. projective) 00082 00083 bool isProjective() const { return m_projectiveModel; } 00084 bool isOrthogonal() const { return !m_projectiveModel; } 00085 00086 void setProjectiveFOVdeg(float ang) { m_projectiveFOVdeg=ang; } //!< Field-of-View in degs, only when projectiveModel=true (default=30 deg). 00087 float getProjectiveFOVdeg() const { return m_projectiveFOVdeg; } //!< Field-of-View in degs, only when projectiveModel=true (default=30 deg). 00088 00089 00090 /** Render does nothing here. 00091 */ 00092 void render() const { } 00093 00094 private: 00095 /** Constructor 00096 */ 00097 CCamera(); 00098 00099 /** Private, virtual destructor: only can be deleted from smart pointers */ 00100 virtual ~CCamera() { } 00101 00102 }; 00103 00104 } // end namespace opengl 00105 00106 } // End of namespace 00107 00108 00109 #endif
Page generated by Doxygen 1.5.7.1 for MRPT 0.7.1 SVN: at Mon Aug 17 22:58:25 EDT 2009 |