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_CTexturedPlane_H
00029 #define opengl_CTexturedPlane_H
00030
00031 #include <mrpt/opengl/CRenderizable.h>
00032 #include <mrpt/utils/CMRPTImage.h>
00033
00034 namespace mrpt
00035 {
00036 namespace opengl
00037 {
00038 class MRPTDLLIMPEXP CTexturedPlane;
00039
00040
00041 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE( CTexturedPlane, CRenderizable )
00042
00043
00046 class MRPTDLLIMPEXP CTexturedPlane : public CRenderizable
00047 {
00048 DEFINE_SERIALIZABLE( CTexturedPlane )
00049 protected:
00050 unsigned int m_glTextureName;
00051 bool m_init;
00052 mrpt::utils::CMRPTImage m_textureImage;
00053 mrpt::utils::CMRPTImage m_textureImageAlpha;
00054 bool m_enableTransparency;
00055
00056 int r_width,r_height;
00057
00058 public:
00059 float m_tex_x_min,m_tex_x_max;
00060 float m_tex_y_min,m_tex_y_max;
00061
00062 float m_xMin, m_xMax;
00063 float m_yMin, m_yMax;
00064
00067 void assignImage(
00068 const mrpt::utils::CMRPTImage& img,
00069 const mrpt::utils::CMRPTImage& imgAlpha );
00070
00073 void assignImage(
00074 const mrpt::utils::CMRPTImage& img );
00075
00078 void assignImage_fast(
00079 mrpt::utils::CMRPTImage& img,
00080 mrpt::utils::CMRPTImage& imgAlpha );
00081
00084 void assignImage_fast(
00085 mrpt::utils::CMRPTImage& img );
00086
00089 void render();
00090
00094 void loadTextureInOpenGL();
00095
00096
00098 static CTexturedPlanePtr Create(
00099 float x_min = -1,
00100 float x_max = 1,
00101 float y_min = -1,
00102 float y_max = 1 )
00103 {
00104 return CTexturedPlanePtr( new CTexturedPlane(x_min, x_max, y_min, y_max) );
00105 }
00106
00107 private:
00110 CTexturedPlane(
00111 float x_min = -1,
00112 float x_max = 1,
00113 float y_min = -1,
00114 float y_max = 1
00115 );
00116
00118 virtual ~CTexturedPlane();
00119 };
00120
00121 }
00122
00123 }
00124
00125
00126 #endif