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
00029 #ifndef opengl_CPointCloudColoured_H
00030 #define opengl_CPointCloudColoured_H
00031
00032 #include <mrpt/opengl/CRenderizable.h>
00033 #include <mrpt/utils/CImage.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
00049
00050
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 std::vector<TPointColour> TListPointColour;
00066
00067 TListPointColour m_points;
00068 float m_pointSize;
00069
00070
00071
00072 CPointCloudColoured( ) :
00073 m_points(),
00074 m_pointSize(1)
00075 {
00076 }
00077
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
00102
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
00112
00113
00114 void loadFromPointsMap( const mrpt::slam::CPointsMap *map);
00115
00116
00117
00118 void render() const;
00119
00120 };
00121
00122 MRPTDLLIMPEXP mrpt::utils::CStream& operator>>(mrpt::utils::CStream& in, CPointCloudColoured::TPointColour &o);
00123 MRPTDLLIMPEXP mrpt::utils::CStream& operator<<(mrpt::utils::CStream& out, const CPointCloudColoured::TPointColour &o);
00124
00125 }
00126
00127 namespace utils
00128 {
00129 using namespace mrpt::opengl;
00130
00131
00132 MRPT_DECLARE_TTYPENAME(CPointCloudColoured::TPointColour)
00133 }
00134
00135 }
00136
00137
00138 #endif