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_CSetOfLines_H
00030 #define opengl_CSetOfLines_H
00031
00032 #include <mrpt/opengl/CRenderizable.h>
00033
00034 namespace mrpt
00035 {
00036 namespace opengl
00037 {
00038 class MRPTDLLIMPEXP CSetOfLines;
00039
00040
00041 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE( CSetOfLines, CRenderizable )
00042
00043
00046 class MRPTDLLIMPEXP CSetOfLines : public CRenderizable
00047 {
00048 DEFINE_SERIALIZABLE( CSetOfLines )
00049 protected:
00050 vector_float m_x0,m_y0,m_z0;
00051 vector_float m_x1,m_y1,m_z1;
00052 float m_lineWidth;
00053
00054 public:
00055 void clear();
00057 void setLineWidth(float w) { m_lineWidth=w; }
00058 float getLineWidth() const { return m_lineWidth; }
00059
00060 void appendLine(
00061 const float &x0,const float &y0, const float &z0,
00062 const float &x1,const float &y1, const float &z1 );
00063
00064 void resize(const size_t &nLines);
00065
00066 void reserve(size_t r);
00067
00068 template<class T,class U>
00069 inline void appendLine(T p0,U p1) {
00070 appendLine(p0.x,p0.y,p0.z,p1.x,p1.y,p1.z);
00071 }
00072
00073 inline size_t getLineCount() const {
00074 return m_x0.size();
00075 }
00076
00077 void setLineByIndex(
00078 const size_t &index,
00079 const float &x0,const float &y0, const float &z0,
00080 const float &x1,const float &y1, const float &z1 );
00081
00083 static CSetOfLinesPtr Create()
00084 {
00085 return CSetOfLinesPtr( new CSetOfLines() );
00086 }
00087
00090 void render() const;
00091
00092 private:
00095 CSetOfLines( ) :
00096 m_x0(),m_y0(),m_z0(),
00097 m_x1(),m_y1(),m_z1(),
00098 m_lineWidth(1.0f)
00099 {
00100 }
00102 virtual ~CSetOfLines() { }
00103 };
00104
00105 }
00106
00107 }
00108
00109
00110 #endif