Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members

glsphere.h

00001 /***************************************************************************
00002                           glsphere.h  -  description
00003                              -------------------
00004     begin                : Thu Aug 14 2003
00005     copyright            : (C) 2003 by Jacques Gasselin de Richebourg
00006     email                : jacquesgasselin@hotmail.com
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU Lesser General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  *   This library is distributed in the hope that it will be useful,       *
00017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00019  *   Lesser General Public License for more details.                       *
00020  *                                                                         *
00021  *   You should have received a copy of the GNU Lesser General Public      *
00022  *   License along with this library; if not, write to the Free Software   *
00023  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA *
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

Generated on Wed Feb 4 23:11:33 2004 by doxygen 1.3.3