00001 /********************************************************************** 00002 Sphere - Class for drawing spheres in OpenGL 00003 00004 Copyright (C) 2007-2009 Jean Brefort <jean.brefort@normalesup.org> 00005 Copyright (C) 2006,2007 Benoit Jacob <jacob@math.jussieu.fr> 00006 00007 This file is part of the Avogadro molecular editor project. 00008 For more information, see <http://avogadro.sourceforge.net/> 00009 00010 Avogadro is free software; you can redistribute it and/or modify 00011 it under the terms of the GNU General Public License as published by 00012 the Free Software Foundation; either version 2 of the License, or 00013 (at your option) any later version. 00014 00015 Avogadro is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 GNU General Public License for more details. 00019 00020 You should have received a copy of the GNU General Public License 00021 along with this program; if not, write to the Free Software 00022 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00023 02110-1301, USA. 00024 **********************************************************************/ 00025 00026 #ifndef GCU_SPHERE_H 00027 #define GCU_SPHERE_H 00028 00030 namespace gcu { 00031 00043 class Vector; 00044 class SpherePrivate; 00045 00046 class Sphere 00047 { 00048 private: 00049 SpherePrivate * const d; 00050 00051 protected: 00052 00057 inline unsigned short indexOfVertex (int strip, int column, int row); 00058 00063 void computeVertex (int strip, int column, int row); 00064 00065 void freeBuffers (); 00066 void initialize (); 00067 00068 public: 00069 Sphere (int detail = 0); 00070 ~Sphere (); 00071 00076 void setup (int detail); 00077 00080 void draw (Vector const ¢er, double radius) const; 00081 }; 00082 00083 } 00084 00085 #endif // GCU_SPHERE_H