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 public:
00061
00062 void setTextureCornerCoords( float tex_x_min, float tex_x_max, float tex_y_min, float tex_y_max)
00063 {
00064 m_tex_x_min=tex_x_min;
00065 m_tex_x_max=tex_x_max;
00066 m_tex_y_min=tex_y_min;
00067 m_tex_y_max=tex_y_max;
00068 }
00069
00070
00071 void setPlaneCorners(float xMin, float xMax, float yMin, float yMax)
00072 {
00073 m_xMin = xMin; m_xMax = xMax;
00074 m_yMin = yMin; m_yMax = yMax;
00075 polygonUpToDate=false;
00076 }
00077
00078
00079
00080 void render() const;
00081
00082
00083 static CTexturedPlanePtr Create(
00084 float x_min,
00085 float x_max,
00086 float y_min,
00087 float y_max)
00088 {
00089 return CTexturedPlanePtr( new CTexturedPlane(x_min, x_max, y_min, y_max) );
00090 }
00091
00092
00093
00094 virtual bool traceRay(const mrpt::poses::CPose3D &o,double &dist) const;
00095
00096 private:
00097
00098
00099 CTexturedPlane(
00100 float x_min = -1,
00101 float x_max = 1,
00102 float y_min = -1,
00103 float y_max = 1
00104 );
00105
00106
00107 virtual ~CTexturedPlane();
00108 };
00109
00110 }
00111
00112 }
00113
00114
00115 #endif