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