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 #ifndef opengl_CSphere_H
00029 #define opengl_CSphere_H
00030
00031 #include <mrpt/opengl/CRenderizableDisplayList.h>
00032
00033 namespace mrpt
00034 {
00035 namespace opengl
00036 {
00037 class OPENGL_IMPEXP CSphere;
00038
00039
00040 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE( CSphere, CRenderizableDisplayList, OPENGL_IMPEXP )
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053 class OPENGL_IMPEXP CSphere : public CRenderizableDisplayList
00054 {
00055 DEFINE_SERIALIZABLE( CSphere )
00056
00057 protected:
00058 float m_radius;
00059 int m_nDivsLongitude,m_nDivsLatitude;
00060 bool m_keepRadiusIndependentEyeDistance;
00061
00062 public:
00063 void setRadius(float r) { m_radius=r; CRenderizableDisplayList::notifyChange(); }
00064 float getRadius() const {return m_radius; }
00065
00066 void setNumberDivsLongitude(int N) { m_nDivsLongitude=N; CRenderizableDisplayList::notifyChange(); }
00067 void setNumberDivsLatitude(int N) { m_nDivsLatitude=N; CRenderizableDisplayList::notifyChange();}
00068 void enableRadiusIndependentOfEyeDistance(bool v=true) { m_keepRadiusIndependentEyeDistance=v; CRenderizableDisplayList::notifyChange(); }
00069
00070
00071 virtual bool should_skip_display_list_cache() const { return m_keepRadiusIndependentEyeDistance; }
00072
00073
00074 static CSpherePtr Create(
00075 float radius,
00076 int nDivsLongitude = 20,
00077 int nDivsLatitude = 20 )
00078 {
00079 return CSpherePtr( new CSphere(radius,nDivsLongitude,nDivsLatitude) );
00080 }
00081
00082
00083 void render_dl() const;
00084
00085
00086
00087 virtual bool traceRay(const mrpt::poses::CPose3D &o,double &dist) const;
00088
00089 private:
00090
00091
00092 CSphere(
00093 float radius = 1.0f,
00094 int nDivsLongitude = 20,
00095 int nDivsLatitude = 20
00096 ) :
00097 m_radius(radius),
00098 m_nDivsLongitude(nDivsLongitude),
00099 m_nDivsLatitude(nDivsLatitude),
00100 m_keepRadiusIndependentEyeDistance(false)
00101 {
00102 }
00103
00104
00105 virtual ~CSphere() { }
00106 };
00107
00108 }
00109
00110 }
00111
00112 #endif