Coin Logo http://www.sim.no/
http://www.coin3d.org/

SoPrimitiveVertexCache.h
1#ifndef COIN_SOPRIMITIVEVERTEXCACHE_H
2#define COIN_SOPRIMITIVEVERTEXCACHE_H
3
4/**************************************************************************\
5 *
6 * This file is part of the Coin 3D visualization library.
7 * Copyright (C) by Kongsberg Oil & Gas Technologies.
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * ("GPL") version 2 as published by the Free Software Foundation.
12 * See the file LICENSE.GPL at the root directory of this source
13 * distribution for additional information about the GNU GPL.
14 *
15 * For using Coin with software that can not be combined with the GNU
16 * GPL, and for taking advantage of the additional benefits of our
17 * support services, please contact Kongsberg Oil & Gas Technologies
18 * about acquiring a Coin Professional Edition License.
19 *
20 * See http://www.coin3d.org/ for more information.
21 *
22 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
23 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24 *
25\**************************************************************************/
26
27#include <Inventor/caches/SoCache.h>
28#include <Inventor/system/gl.h>
29#include <Inventor/SbVec3f.h>
30#include <Inventor/SbVec4f.h>
31#include <Inventor/SbVec2f.h>
32#include <Inventor/tools/SbPimplPtr.h>
33
34class SoPrimitiveVertexCacheUtil;
35class SoPrimitiveVertexCacheP;
37class SoPointDetail;
38class SoState;
39
40class COIN_DLL_API SoPrimitiveVertexCache : public SoCache {
41 typedef SoCache inherited;
42public:
45
46 enum Arrays {
47 NORMAL = 0x01,
48 TEXCOORD = 0x02,
49 COLOR = 0x04,
50 ALL = (NORMAL|TEXCOORD|COLOR)
51 };
52
53 void renderTriangles(SoState * state, const int arrays = ALL) const;
54 void renderLines(SoState * state, const int arrays = ALL) const;
55 void renderPoints(SoState * state, const int array = ALL) const;
56
57 void addTriangle(const SoPrimitiveVertex * v0,
58 const SoPrimitiveVertex * v1,
59 const SoPrimitiveVertex * v2,
60 const int * pointdetailidx = NULL);
61 void addLine(const SoPrimitiveVertex * v0,
62 const SoPrimitiveVertex * v1);
63 void addPoint(const SoPrimitiveVertex * v);
64
65 int getNumVertices(void) const;
66 const SbVec3f * getVertexArray(void) const;
67 const SbVec3f * getNormalArray(void) const;
68 const SbVec4f * getTexCoordArray(void) const;
69 const SbVec2f * getBumpCoordArray(void) const;
70 const uint8_t * getColorArray(void) const;
71
72 int getNumTriangleIndices(void) const;
73 const GLint * getTriangleIndices(void) const;
74 int32_t getTriangleIndex(const int idx) const;
75
76 SbBool colorPerVertex(void) const;
77 const SbVec4f * getMultiTextureCoordinateArray(const int unit) const;
78
79 int getNumLineIndices(void) const;
80 const GLint * getLineIndices(void) const;
81
82 int getNumPointIndices(void) const;
83 const GLint * getPointIndices(void) const;
84
85 void fit(void);
86 void depthSortTriangles(SoState * state);
87
88private:
89 SbPimplPtr<SoPrimitiveVertexCacheP> pimpl;
90
92 SoPrimitiveVertexCache & operator = (const SoPrimitiveVertexCache & rhs); // N/A
93
94 friend class SoPrimitiveVertexCacheUtil;
95};
96
97// temporary, internal class used to fix a bug without breaking the API/ABI.
98// the bug is fixed properly in Coin-4
99class SoPrimitiveVertexCacheUtil {
100public:
101 static SbBool testValid(SoPrimitiveVertexCache * cache, SoState * state);
102 static void close(SoPrimitiveVertexCache * cache, SoState * state);
103};
104
105#endif // COIN_SOPRIMITIVEVERTEXCACHE_H
The SbVec2f class is a 2 dimensional vector with floating point coordinates.
Definition SbVec2f.h:39
The SbVec3f class is a 3 dimensional vector with floating point coordinates.
Definition SbVec3f.h:40
The SbVec4f class is a 4 dimensional vector with floating point coordinates.
Definition SbVec4f.h:40
The SoCache class is the superclass for all internal cache classes.
Definition SoCache.h:34
The SoPointDetail class is for storing detailed information for a single 3D point.
Definition SoPointDetail.h:29
Definition SoPrimitiveVertexCache.h:40
The SoPrimitiveVertex class represents a single vertex of a generated primitive.
Definition SoPrimitiveVertex.h:34
The SoState class manages the Coin scenegraph traversal state data.
Definition SoState.h:35

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.

Generated on Wed Jul 17 2024 for Coin by Doxygen 1.12.0.