fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / NodeCores / Drawables / Geometry / Util / OSGGeoFunctions.h
blobf56dc78fea6db121b1672aa08fac1be11e71ac6e
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2002 by the OpenSG Forum *
6 * *
7 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
8 * *
9 \*---------------------------------------------------------------------------*/
10 /*---------------------------------------------------------------------------*\
11 * License *
12 * *
13 * This library is free software; you can redistribute it and/or modify it *
14 * under the terms of the GNU Library General Public License as published *
15 * by the Free Software Foundation, version 2. *
16 * *
17 * This library is distributed in the hope that it will be useful, but *
18 * WITHOUT ANY WARRANTY; without even the implied warranty of *
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
20 * Library General Public License for more details. *
21 * *
22 * You should have received a copy of the GNU Library General Public *
23 * License along with this library; if not, write to the Free Software *
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
25 * *
26 \*---------------------------------------------------------------------------*/
27 /*---------------------------------------------------------------------------*\
28 * Changes *
29 * *
30 * *
31 * *
32 * *
33 * *
34 * *
35 \*---------------------------------------------------------------------------*/
37 #ifndef _OSGGEOFUNCTIONS_H_
38 #define _OSGGEOFUNCTIONS_H_
40 #ifdef __sgi
41 #pragma once
42 #endif
44 #include "OSGDrawableDef.h"
45 #include "OSGBaseTypes.h"
46 #include "OSGGeometry.h"
48 OSG_BEGIN_NAMESPACE
50 /*---------------------------------------------------------------------*/
51 /*! \name Calc properties functions */
52 /*! \{ */
54 OSG_DRAWABLE_DLLMAPPING
55 void calcVertexNormals (Geometry *geo );
57 OSG_DRAWABLE_DLLMAPPING
58 void calcVertexNormals (Geometry *geo,
59 Real32 creaseAngle);
60 OSG_DRAWABLE_DLLMAPPING
61 void calcFaceNormals (Geometry *geo );
63 OSG_DRAWABLE_DLLMAPPING
64 void calcVertexTangentsProp (Geometry *geo,
65 UInt32 srcTexProp,
66 UInt32 srcNormalProp,
67 UInt32 dstPropTan,
68 UInt32 dstPropBin);
70 OSG_DRAWABLE_DLLMAPPING
71 void calcVertexTangents (Geometry *geo,
72 UInt32 srcTexIndex,
73 UInt32 dstPropTan,
74 UInt32 dstPropBin);
76 OSG_DRAWABLE_DLLMAPPING
77 void calcVertexTexCoordsProp2D(Geometry *geo,
78 UInt32 propIndex =
79 Geometry::TexCoordsIndex);
81 OSG_DRAWABLE_DLLMAPPING
82 void calcVertexTexCoords (Geometry *geo,
83 UInt32 texIndex = 0);
85 /*! \} */
86 /*---------------------------------------------------------------------*/
87 /*! \name Conversion functions */
88 /*! \{ */
90 OSG_DRAWABLE_DLLMAPPING
91 Int32 setIndexFromVRMLData ( Geometry *geo,
92 std::vector<Int32> &coordIndex,
93 std::vector<Int32> &normalIndex,
94 std::vector<Int32> &colorIndex,
95 std::vector<Int32> &texCoordIndex,
96 bool convex = true,
97 bool ccw = true,
98 bool normalPerVertex = true,
99 bool colorPerVertex = true,
100 bool createNormal = true,
101 bool faceSet = true);
103 OSG_DRAWABLE_DLLMAPPING
104 Int32 setIndexFromIndexedX3DData ( Geometry *geo,
105 std::vector<Int32> &coordIndex,
106 std::vector<Int32> &normalIndex,
107 std::vector<Int32> &colorIndex,
108 std::vector<Int32> &texCoordIndex,
109 Int32 primitiveType =
110 GL_POLYGON,
111 bool convex = true,
112 bool ccw = true,
113 bool normalPerVertex = true,
114 bool colorPerVertex = true,
115 bool createNormal = true);
117 /*! \} */
118 /*---------------------------------------------------------------------*/
119 /*! \name Optimization functions */
120 /*! \{ */
122 OSG_DRAWABLE_DLLMAPPING
123 Int32 createOptimizedPrimitives(Geometry *geo,
124 UInt32 iteration = 1,
125 bool createStrips = true,
126 bool createFans = true,
127 UInt32 minFanEdgeCount = 8,
128 bool colorCode = false,
129 bool stitchStrips = false);
131 OSG_DRAWABLE_DLLMAPPING
132 void createConvexPrimitives (Geometry *geo);
134 OSG_DRAWABLE_DLLMAPPING
135 Int32 createSharedIndex (Geometry *geo);
137 OSG_DRAWABLE_DLLMAPPING
138 Int32 createSingleIndex (Geometry *geo);
140 OSG_DRAWABLE_DLLMAPPING
141 UInt32 calcPrimitiveCount (Geometry *geo,
142 UInt32 &triangle,
143 UInt32 &line,
144 UInt32 &point,
145 UInt32 &patches);
147 /*! \} */
148 /*---------------------------------------------------------------------*/
149 /*! \name Debug Geometry functions */
150 /*! \{ */
152 OSG_DRAWABLE_DLLMAPPING
153 NodeTransitPtr calcVertexNormalsGeo (Geometry *geo,
154 Real32 length);
156 OSG_DRAWABLE_DLLMAPPING
157 void updateVertexNormalsGeo ( Geometry *pGeo,
158 Real32 length,
159 const Geometry *pRefGeo);
161 OSG_DRAWABLE_DLLMAPPING
162 NodeTransitPtr calcFaceNormalsGeo (Geometry *geo,
163 Real32 length);
165 /*! \} */
166 /*---------------------------------------------------------------------*/
167 /*! \name Merge helper functions */
168 /*! \{ */
170 OSG_DRAWABLE_DLLMAPPING
171 void separateProperties (Geometry *geo);
174 OSG_DRAWABLE_DLLMAPPING
175 void mergeGeometries (std::vector<Node *> &nodes,
176 std::vector<Node *> &results);
178 OSG_DRAWABLE_DLLMAPPING
179 bool mergeableGeo(const Geometry *geo1, const Geometry *geo2);
181 OSG_DRAWABLE_DLLMAPPING
182 GeometryTransitPtr mergeGeo(const Geometry *geo1, const Geometry *geo2);
184 /*! \} */
185 /*---------------------------------------------------------------------*/
186 /*! \name Global Helper */
187 /*! \{ */
189 OSG_DRAWABLE_DLLMAPPING
190 void setVBOUsageOnPropertyProtos(bool bVal);
192 /*! \} */
193 /*---------------------------------------------------------------------*/
195 OSG_END_NAMESPACE
197 #include "OSGGeoFunctions.inl"
199 #endif /* _OSGGEOFUNCTIONS_H_ */