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
00029 #ifndef opengl_CPointCloudColoured_H
00030 #define opengl_CPointCloudColoured_H
00031
00032 #include <mrpt/opengl/CRenderizable.h>
00033 #include <mrpt/utils/CMRPTImage.h>
00034 #include <mrpt/utils/stl_extensions.h>
00035
00036 namespace mrpt
00037 {
00038 namespace slam { class CPointsMap; }
00039
00040 namespace opengl
00041 {
00042 class MRPTDLLIMPEXP CPointCloudColoured;
00043
00044
00045 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE( CPointCloudColoured, CRenderizable )
00046
00047
00048
00051 class MRPTDLLIMPEXP CPointCloudColoured : public CRenderizable
00052 {
00053 DEFINE_SERIALIZABLE( CPointCloudColoured )
00054
00055 public:
00056 struct TPointColour
00057 {
00058 TPointColour( float _x=0,float _y=0,float _z=0,float _R=0,float _G=0,float _B=0 ) :
00059 x(_x),y(_y),z(_z),R(_R),G(_G),B(_B)
00060 { }
00061 float x,y,z,R,G,B;
00062 };
00063
00064 private:
00065 typedef mrpt::utils::vector_serializable<TPointColour> TListPointColour;
00066
00067 TListPointColour m_points;
00068 float m_pointSize;
00069
00072 CPointCloudColoured( ) :
00073 m_points(),
00074 m_pointSize(1)
00075 {
00076 }
00078 virtual ~CPointCloudColoured() { }
00079
00080 public:
00081 typedef TListPointColour::iterator iterator;
00082 typedef TListPointColour::const_iterator const_iterator;
00083
00084 iterator begin() { return m_points.begin(); }
00085 const_iterator begin() const { return m_points.begin(); }
00086 iterator end() { return m_points.end(); }
00087 const_iterator end() const { return m_points.end(); }
00088
00089 void push_back(double x,double y,double z, double R, double G, double B)
00090 {
00091 m_points.push_back(TPointColour(float(x),float(y),float(z),float(R),float(G),float(B)));
00092 }
00093
00094 void push_back(float x,float y,float z, float R, float G, float B)
00095 {
00096 m_points.push_back(TPointColour(x,y,z,R,G,B));
00097 }
00098
00099 void reserve(size_t N) { m_points.reserve(N); }
00100 void resize(size_t N) { m_points.resize(N); }
00101
00103 TPointColour &operator [](size_t i) { return m_points[i]; }
00104
00105 size_t size() const { return m_points.size(); }
00106 void clear() { m_points.clear(); }
00107
00108 void setPointSize(float pointSize) { m_pointSize = pointSize; }
00109 float getPointSize() const { return m_pointSize; }
00110
00111
00113 static CPointCloudColouredPtr Create()
00114 {
00115 return CPointCloudColouredPtr( new CPointCloudColoured() );
00116 }
00117
00120 void loadFromPointsMap( const mrpt::slam::CPointsMap *map);
00121
00124 void render() const;
00125
00126 };
00127
00128 MRPTDLLIMPEXP mrpt::utils::CStream& operator>>(mrpt::utils::CStream& in, CPointCloudColoured::TPointColour &o);
00129 MRPTDLLIMPEXP mrpt::utils::CStream& operator<<(mrpt::utils::CStream& out, const CPointCloudColoured::TPointColour &o);
00130
00131 }
00132
00133 }
00134
00135
00136 #endif