Open Inventor Reference
|
00001 /* 00002 * 00003 * Copyright (C) 2011 MeVis Medical Solutions AG All Rights Reserved. 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Lesser General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2.1 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * Further, this software is distributed without any warranty that it is 00016 * free of the rightful claim of any third person regarding infringement 00017 * or the like. Any license provided herein, whether implied or 00018 * otherwise, applies only to this software file. Patent licenses, if 00019 * any, provided herein do not apply to combinations of this program with 00020 * other software, or any other product whatsoever. 00021 * 00022 * You should have received a copy of the GNU Lesser General Public 00023 * License along with this library; if not, write to the Free Software 00024 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00025 * 00026 * Contact information: MeVis, Center for Medical Diagnostic Systems and 00027 * Visualization GmbH, Universitätsallee 29, D-28359 Bremen, GERMANY, or: 00028 * 00029 * http://www.mevis.de 00030 * 00031 */ 00032 00033 /* 00034 Author: Florian Link 00035 Date: 09-2011 00036 */ 00037 00038 #ifndef _SO_VERTEX_ARRAY_INDEXER_ 00039 #define _SO_VERTEX_ARRAY_INDEXER_ 00040 00041 #include <Inventor/SbBasic.h> 00042 #include <Inventor/system/SbOpenGL.h> 00043 #include <Inventor/misc/SoVBO.h> 00044 00045 class SoState; 00046 class SoGLDisplayList; 00047 00056 class INVENTOR_API SoVertexArrayIndexer 00057 { 00058 public: 00060 SoVertexArrayIndexer(GLenum type); 00061 ~SoVertexArrayIndexer(); 00062 00064 void setType(GLenum type) { _type = type; } 00065 00067 GLenum getType() const { return _type; } 00068 00070 void clear(); 00071 00073 void freeGL(SoState* state = NULL); 00074 00076 void render(SoState* state, bool useVbo); 00077 00079 uint32_t getDataId() const { return _nodeId; } 00080 00082 void setInventorTriangles(int numTriangles, const int32_t* inventorIndices, uint32_t nodeId); 00083 00085 void setInventorQuads(int numQuads, const int32_t* inventorIndices, uint32_t nodeId); 00086 00088 void setInventorLines(int numLines, const int32_t* inventorIndices, uint32_t nodeId); 00089 00092 void setIndices(int numIndices, const int32_t* indices, uint32_t nodeId ); 00093 00094 private: 00095 GLenum _type; 00096 00097 uint32_t _nodeId; 00098 00099 bool _ownsIndices; 00100 int _numIndices; 00101 GLuint* _indices; 00102 00103 SoVBO* _indexVbo; 00104 }; 00105 00106 #endif