Go to the documentation of this file.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/CTexturedObject.h>
00032
00033 namespace mrpt
00034 {
00035 namespace opengl
00036 {
00037 class OPENGL_IMPEXP CTexturedPlane;
00038
00039
00040 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE( CTexturedPlane, CTexturedObject, OPENGL_IMPEXP )
00041
00042
00043
00044
00045 class OPENGL_IMPEXP CTexturedPlane : public CTexturedObject
00046 {
00047 DEFINE_SERIALIZABLE( CTexturedPlane )
00048 protected:
00049 mutable float m_tex_x_min,m_tex_x_max;
00050 mutable float m_tex_y_min,m_tex_y_max;
00051
00052 float m_xMin, m_xMax;
00053 float m_yMin, m_yMax;
00054
00055 mutable bool polygonUpToDate;
00056 mutable std::vector<mrpt::math::TPolygonWithPlane> tmpPoly;
00057 void updatePoly() const;
00058 void unloadTexture();
00059
00060 void render_texturedobj() const;
00061
00062 public:
00063
00064 void setTextureCornerCoords( float tex_x_min, float tex_x_max, float tex_y_min, float tex_y_max)
00065 {
00066 m_tex_x_min=tex_x_min;
00067 m_tex_x_max=tex_x_max;
00068 m_tex_y_min=tex_y_min;
00069 m_tex_y_max=tex_y_max;
00070 CRenderizableDisplayList::notifyChange();
00071 }
00072
00073
00074 void setPlaneCorners(float xMin, float xMax, float yMin, float yMax)
00075 {
00076 m_xMin = xMin; m_xMax = xMax;
00077 m_yMin = yMin; m_yMax = yMax;
00078 polygonUpToDate=false;
00079 CRenderizableDisplayList::notifyChange();
00080 }
00081
00082
00083 inline void getPlaneCorners(float &xMin, float &xMax, float &yMin, float &yMax) const
00084 {
00085 xMin = m_xMin; xMax = m_xMax;
00086 yMin = m_yMin; yMax = m_yMax;
00087 }
00088
00089
00090 static CTexturedPlanePtr Create(
00091 float x_min,
00092 float x_max,
00093 float y_min,
00094 float y_max)
00095 {
00096 return CTexturedPlanePtr( new CTexturedPlane(x_min, x_max, y_min, y_max) );
00097 }
00098
00099
00100
00101 virtual bool traceRay(const mrpt::poses::CPose3D &o,double &dist) const;
00102
00103 private:
00104
00105
00106 CTexturedPlane(
00107 float x_min = -1,
00108 float x_max = 1,
00109 float y_min = -1,
00110 float y_max = 1
00111 );
00112
00113
00114 virtual ~CTexturedPlane();
00115 };
00116
00117 }
00118
00119 }
00120
00121
00122 #endif