/// This file is part of the X3DToolKit library /// Copyright (C) 2002-2004 Yannick Le Goc (legoc@imag.fr) /// http://artis.imag.fr/Members/Yannick.Legoc/X3D/ /// This library is free software; you can redistribute it and/or /// modify it under the terms of the GNU Lesser General Public /// License as published by the Free Software Foundation; either /// version 2.1 of the License, or (at your option) any later version. /// This library is distributed in the hope that it will be useful, /// but WITHOUT ANY WARRANTY; without even the implied warranty of /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU /// Lesser General Public License for more details. /// You should have received a copy of the GNU Lesser General Public /// License along with this library; if not, write to the Free Software /// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #ifndef X3DTK_GL_CONEARRAY_H #define X3DTK_GL_CONEARRAY_H #include "GL_SceneGraphTypes.h" #include #include namespace X3DTK { namespace GL { /*! \brief Class declared in providing a singleton manager * of the vertex arrays necessary to draw a triangulated cone. * * This class is used by Cone to avoid memory duplication and provides the arrays required by the OpenGL command * drawElements(). * * \ingroup GLSceneGraph */ class ConeDrawArray { public: /// Gets the ConeDrawArray of section section. static ConeDrawArray *getInstanceOfSection(unsigned int section); /// Removes the ConeDrawArray of section section. void removeInstance(); /// Gets the number of vertices of the side of the cone. unsigned int getConeSideSize() const; /// Gets the number of vertices of the side of the cone. unsigned int getConeBottomSize() const; /// Gets the address of the first element of the vertex array of the side. const void *getConeSideVertexArrayAddress() const; /// Gets the address of the first element of the vertex array of the bottom. const void *getConeBottomVertexArrayAddress() const; /// Gets the address of the first index of the side. const unsigned int *getConeSideIndexArrayAddress() const; /// Gets the address of the first index of the bottom. const unsigned int *getConeBottomIndexArrayAddress() const; private: unsigned int _section; /// Constructs the arrays for a cone of section vertices for the section. ConeDrawArray(unsigned int section); typedef struct { unsigned int count; ConeDrawArray *ref; } data; typedef std::list > refList; static refList _refList; std::vector _coneSideVertexArray; std::vector _coneBottomVertexArray; std::vector _coneSideIndexArray; std::vector _coneBottomIndexArray; }; } } #endif