1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2002 by the OpenSG Forum *
7 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
9 \*---------------------------------------------------------------------------*/
10 /*---------------------------------------------------------------------------*\
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. *
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. *
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. *
26 \*---------------------------------------------------------------------------*/
27 /*---------------------------------------------------------------------------*\
35 \*---------------------------------------------------------------------------*/
37 #ifndef _OSGGEOFUNCTIONS_H_
38 #define _OSGGEOFUNCTIONS_H_
44 #include "OSGDrawableDef.h"
45 #include "OSGBaseTypes.h"
46 #include "OSGGeometry.h"
50 /*---------------------------------------------------------------------*/
51 /*! \name Calc properties functions */
54 OSG_DRAWABLE_DLLMAPPING
55 void calcVertexNormals (Geometry
*geo
);
57 OSG_DRAWABLE_DLLMAPPING
58 void calcVertexNormals (Geometry
*geo
,
60 OSG_DRAWABLE_DLLMAPPING
61 void calcFaceNormals (Geometry
*geo
);
63 OSG_DRAWABLE_DLLMAPPING
64 void calcVertexTangentsProp (Geometry
*geo
,
70 OSG_DRAWABLE_DLLMAPPING
71 void calcVertexTangents (Geometry
*geo
,
76 OSG_DRAWABLE_DLLMAPPING
77 void calcVertexTexCoordsProp2D(Geometry
*geo
,
79 Geometry::TexCoordsIndex
);
81 OSG_DRAWABLE_DLLMAPPING
82 void calcVertexTexCoords (Geometry
*geo
,
86 /*---------------------------------------------------------------------*/
87 /*! \name Conversion functions */
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
,
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
=
113 bool normalPerVertex
= true,
114 bool colorPerVertex
= true,
115 bool createNormal
= true);
118 /*---------------------------------------------------------------------*/
119 /*! \name Optimization functions */
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
,
148 /*---------------------------------------------------------------------*/
149 /*! \name Debug Geometry functions */
152 OSG_DRAWABLE_DLLMAPPING
153 NodeTransitPtr
calcVertexNormalsGeo (Geometry
*geo
,
156 OSG_DRAWABLE_DLLMAPPING
157 void updateVertexNormalsGeo ( Geometry
*pGeo
,
159 const Geometry
*pRefGeo
);
161 OSG_DRAWABLE_DLLMAPPING
162 NodeTransitPtr
calcFaceNormalsGeo (Geometry
*geo
,
166 /*---------------------------------------------------------------------*/
167 /*! \name Merge helper functions */
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
);
185 /*---------------------------------------------------------------------*/
186 /*! \name Global Helper */
189 OSG_DRAWABLE_DLLMAPPING
190 void setVBOUsageOnPropertyProtos(bool bVal
);
193 /*---------------------------------------------------------------------*/
197 #include "OSGGeoFunctions.inl"
199 #endif /* _OSGGEOFUNCTIONS_H_ */