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 #ifndef GLSPHERE_H
00028 #define GLSPHERE_H
00029
00030 #include "glscene.h"
00031 #include "glgeometricobject.h"
00032 #include "glsurface.h"
00033 #include "smltgl.h"
00034
00035
00039 namespace GLScene
00040 {
00041
00042 class GLSphere : public GLGeometricObject, public GLSurfaceGenerator
00043 {
00044
00045 GLfloat radius;
00046 static std::map<unsigned, SurfacePtr > sharedSurface;
00047
00048 public:
00049 GLSphere(GLfloat rad = 1);
00050 ~GLSphere();
00051
00052 SML_TAG(sphere);
00053
00054 inline GLfloat getRadius() { return radius; }
00055 inline void setRadius(GLfloat r) { radius = std::abs(r); }
00058 void getVertecies(const GLfloat u, const GLuint nOfV, GLfloat* const verts3) const;
00060 void getNormals(const GLfloat u, const GLuint nOfN, GLfloat* const normals3) const;
00061
00063 virtual GLVector getVectorToFurthestPoint(const GLVector& fromPoint);
00064 virtual GLVector getVectorToNearestPoint(const GLVector& fromPoint);
00065
00066 virtual bool intersection( GLGeometricObject* obj ) { return obj->intersection((GLSphere*)this); };
00067 virtual bool intersection( GLSphere* sp );
00068 virtual bool inclusion( GLGeometricObject* obj ) { return obj->inclusion((GLSphere*)this);};
00069 virtual bool inclusion( GLSphere* sp );
00070
00071 virtual void render( void );
00072 virtual void renderForSelection(GLuint& previousName);
00073
00074 GLFieldBase* radiusField;
00075 };
00076 };
00077
00078 #endif