00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef LASERREADINGRENDERER_H_
00024 #define LASERREADINGRENDERER_H_
00025
00026 #include <gui/AbstractRenderer.h>
00027
00028 #include <geometry/point.h>
00029 #include <vector>
00030 #include <GL/gl.h>
00031 #include <GL/glu.h>
00032 #include <iostream>
00033
00034 class LaserReadingRenderer: public AbstractRenderer {
00035 public:
00036 LaserReadingRenderer(const std::vector<Point2D> *_points, const std::vector<double>& normals = std::vector<double>(0));
00037
00038 LaserReadingRenderer(const LaserReadingRenderer& _renderer);
00039
00040 LaserReadingRenderer& operator=(const LaserReadingRenderer& _renderer);
00041
00042 inline void setDepth(float depth)
00043 {m_depth = depth;m_listValid=false;}
00044
00045 virtual ~LaserReadingRenderer();
00046
00047 inline void setColor(float _red, float _green, float _blue, float _alpha = 1.0f)
00048 {m_color = Color(_red, _green, _blue, _alpha);m_listValid=false;}
00049 inline void setColor(const Color& _color)
00050 {m_color = _color;m_listValid=false;}
00051 inline void setSize(float _size)
00052 {m_pointSize = _size;m_listValid=false;}
00053 inline void setSubdivision(int _around, int _along)
00054 {m_subdivision[0] = _around, m_subdivision[1] = _along;m_listValid=false;}
00055
00056 inline void getColor(float& _red, float& _green, float& _blue, float& _alpha) const
00057 {_red = m_color.red(); _green = m_color.green(); _blue = m_color.blue(); _alpha = m_color.alpha(); }
00058 inline const Color& getColor() const
00059 {return m_color; }
00060 inline float getSize() const
00061 {return m_pointSize;}
00062 inline void getSubdivision(int& _around, int& _along) const
00063 {_around = m_subdivision[0]; _along = m_subdivision[1];}
00064
00065 void setLaserPoints(const std::vector<Point2D> *_points, const std::vector<double>& normals = std::vector<double>(0));
00066
00067 inline const std::vector<Point2D> * getLaserPoints() const
00068 {return m_laserPoints;}
00069
00070 inline const std::vector<double> & getLaserNormals() const
00071 {return m_laserNormals;}
00072
00073 inline const OrientedPoint2D* getLaserPose() const
00074 {return m_laserPose;}
00075
00076 inline void setLaserPose(const OrientedPoint2D* pose)
00077 {m_laserPose = pose;m_listValid=false;}
00078
00079 virtual void render();
00080
00081 protected:
00082 void makeList();
00083 GLuint m_list;
00084 bool m_listValid;
00085 const std::vector<Point2D> * m_laserPoints;
00086 std::vector<double> m_laserNormals;
00087 std::vector<GLUquadricObj*> m_GLUPoints;
00088 const OrientedPoint2D* m_laserPose;
00089 Color m_color;
00090 float m_pointSize;
00091 float m_depth;
00092 int m_subdivision[2];
00093 };
00094
00095 #endif