00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef opengl_CRenderizable_H
00029 #define opengl_CRenderizable_H
00030
00031 #include <mrpt/utils/utils_defs.h>
00032 #include <mrpt/utils/CSerializable.h>
00033
00034 #include <mrpt/synch/CCriticalSection.h>
00035
00036 namespace mrpt
00037 {
00038 namespace poses { class CPose3D; }
00039 namespace utils { class CStringList; }
00040
00041 namespace opengl
00042 {
00043 class COpenGLViewport;
00044
00045
00046 DEFINE_SERIALIZABLE_PRE( CRenderizable )
00047
00048
00056 class MRPTDLLIMPEXP CRenderizable : public mrpt::utils::CSerializable
00057 {
00058 DEFINE_VIRTUAL_SERIALIZABLE( CRenderizable )
00059
00060 friend class mrpt::opengl::COpenGLViewport;
00061
00062 public:
00063 std::string m_name;
00064 double m_color_R,m_color_G,m_color_B,m_color_A;
00065 double m_x,m_y,m_z;
00066 double m_yaw,m_pitch,m_roll;
00067 bool m_show_name;
00068
00069 static void renderTextBitmap( const char *str, void *fontStyle );
00070
00073 CRenderizable() :
00074 m_name(),
00075 m_color_R(1),m_color_G(1),m_color_B(1),m_color_A(1),
00076 m_x(0),m_y(0),m_z(0),
00077 m_yaw(0),m_pitch(0),m_roll(0),
00078 m_show_name(false)
00079 {
00080 }
00081
00082 virtual ~CRenderizable() { }
00083
00085 CRenderizable * clone() const
00086 {
00087 return static_cast<CRenderizable*>( this->duplicate() );
00088 }
00089
00092 virtual void render() = 0;
00093
00095 void setPose( const mrpt::poses::CPose3D &o );
00096
00097 protected:
00099 static void checkOpenGLError();
00100
00101 void writeToStreamRender(utils::CStream &out) const;
00102 void readFromStreamRender(utils::CStream &in);
00103
00105 static unsigned int getNewTextureNumber();
00106 static void releaseTextureName(unsigned int i);
00107
00108 };
00109
00110
00111
00112 }
00113
00114 }
00115
00116
00117 #endif