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
00084 static CTexturedPlanePtr Create(
00085 float x_min,
00086 float x_max,
00087 float y_min,
00088 float y_max)
00089 {
00090 return CTexturedPlanePtr( new CTexturedPlane(x_min, x_max, y_min, y_max) );
00091 }
00092
00093
00094
00095 virtual bool traceRay(const mrpt::poses::CPose3D &o,double &dist) const;
00096
00097 private:
00098
00099
00100 CTexturedPlane(
00101 float x_min = -1,
00102 float x_max = 1,
00103 float y_min = -1,
00104 float y_max = 1
00105 );
00106
00107
00108 virtual ~CTexturedPlane();
00109 };
00110
00111 }
00112
00113 }
00114
00115
00116 #endif