![]() |
http://www.sim.no/ http://www.coin3d.org/ |
00001 #ifndef COIN_SOPRIMITIVEVERTEXCACHE_H 00002 #define COIN_SOPRIMITIVEVERTEXCACHE_H 00003 00004 /**************************************************************************\ 00005 * 00006 * This file is part of the Coin 3D visualization library. 00007 * Copyright (C) by Kongsberg Oil & Gas Technologies. 00008 * 00009 * This library is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU General Public License 00011 * ("GPL") version 2 as published by the Free Software Foundation. 00012 * See the file LICENSE.GPL at the root directory of this source 00013 * distribution for additional information about the GNU GPL. 00014 * 00015 * For using Coin with software that can not be combined with the GNU 00016 * GPL, and for taking advantage of the additional benefits of our 00017 * support services, please contact Kongsberg Oil & Gas Technologies 00018 * about acquiring a Coin Professional Edition License. 00019 * 00020 * See http://www.coin3d.org/ for more information. 00021 * 00022 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY. 00023 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org 00024 * 00025 \**************************************************************************/ 00026 00027 #include <Inventor/caches/SoCache.h> 00028 #include <Inventor/system/gl.h> 00029 #include <Inventor/SbVec3f.h> 00030 #include <Inventor/SbVec4f.h> 00031 #include <Inventor/SbVec2f.h> 00032 #include <Inventor/tools/SbPimplPtr.h> 00033 00034 class SoPrimitiveVertexCacheUtil; 00035 class SoPrimitiveVertexCacheP; 00036 class SoPrimitiveVertex; 00037 class SoPointDetail; 00038 class SoState; 00039 00040 class COIN_DLL_API SoPrimitiveVertexCache : public SoCache { 00041 typedef SoCache inherited; 00042 public: 00043 SoPrimitiveVertexCache(SoState * state); 00044 virtual ~SoPrimitiveVertexCache(); 00045 00046 enum Arrays { 00047 NORMAL = 0x01, 00048 TEXCOORD = 0x02, 00049 COLOR = 0x04, 00050 ALL = (NORMAL|TEXCOORD|COLOR) 00051 }; 00052 00053 void renderTriangles(SoState * state, const int arrays = ALL) const; 00054 void renderLines(SoState * state, const int arrays = ALL) const; 00055 void renderPoints(SoState * state, const int array = ALL) const; 00056 00057 void addTriangle(const SoPrimitiveVertex * v0, 00058 const SoPrimitiveVertex * v1, 00059 const SoPrimitiveVertex * v2, 00060 const int * pointdetailidx = NULL); 00061 void addLine(const SoPrimitiveVertex * v0, 00062 const SoPrimitiveVertex * v1); 00063 void addPoint(const SoPrimitiveVertex * v); 00064 00065 int getNumVertices(void) const; 00066 const SbVec3f * getVertexArray(void) const; 00067 const SbVec3f * getNormalArray(void) const; 00068 const SbVec4f * getTexCoordArray(void) const; 00069 const SbVec2f * getBumpCoordArray(void) const; 00070 const uint8_t * getColorArray(void) const; 00071 00072 int getNumTriangleIndices(void) const; 00073 const GLint * getTriangleIndices(void) const; 00074 int32_t getTriangleIndex(const int idx) const; 00075 00076 SbBool colorPerVertex(void) const; 00077 const SbVec4f * getMultiTextureCoordinateArray(const int unit) const; 00078 00079 int getNumLineIndices(void) const; 00080 const GLint * getLineIndices(void) const; 00081 00082 int getNumPointIndices(void) const; 00083 const GLint * getPointIndices(void) const; 00084 00085 void fit(void); 00086 void depthSortTriangles(SoState * state); 00087 00088 private: 00089 SbPimplPtr<SoPrimitiveVertexCacheP> pimpl; 00090 00091 SoPrimitiveVertexCache(const SoPrimitiveVertexCache & rhs); // N/A 00092 SoPrimitiveVertexCache & operator = (const SoPrimitiveVertexCache & rhs); // N/A 00093 00094 friend class SoPrimitiveVertexCacheUtil; 00095 }; 00096 00097 // temporary, internal class used to fix a bug without breaking the API/ABI. 00098 // the bug is fixed properly in Coin-4 00099 class SoPrimitiveVertexCacheUtil { 00100 public: 00101 static SbBool testValid(SoPrimitiveVertexCache * cache, SoState * state); 00102 static void close(SoPrimitiveVertexCache * cache, SoState * state); 00103 }; 00104 00105 #endif // COIN_SOPRIMITIVEVERTEXCACHE_H
Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.
Generated for Coin by Doxygen 1.5.6.