52#ifndef _SO_NORMAL_GENERATOR_
53#define _SO_NORMAL_GENERATOR_
55#include <Inventor/SbLinear.h>
56#include <Inventor/elements/SoNeighborToleranceElement.h>
59#include <Inventor/STL/vector>
60#include <Inventor/STL/utility>
111 const int approxNumVertices=16,
112 const int approxNumFaces=6,
113 const float creaseAngle =0.0f,
120 ~SoNormalGenerator();
128 void setupApproxShapeSize(
const int32_t approxNumVertices,
const int32_t approxNumFaces);
135 void polygonVertex(
const SbVec3f &point);
151 void setupIndexedVertexArray(
const SbVec3f* pointArray);
158 void setupIndexedConnectivity(
const int32_t* connectivityArray);
164 void polygonVertex(
const int32_t pointIndex);
170 void triangle(
const int32_t index1,
const int32_t index2,
const int32_t index3);
180 int getNumNormals()
const {
return numVertNormals; }
186 void setNumNormals(
int newNum);
192 const SbVec3f *getNormals()
const
193 {
return vertNormals; }
199 const SbVec3f & getNormal(int32_t i)
const
200 {
return vertNormals[i]; }
210 void setNormal(int32_t index,
const SbVec3f &newNormal);
218 int32_t numNormalCrack()
const
219 {
return m_numNormalCrack; };
227 void setNormalBuffer(int32_t numNormals,
const SbVec3f *normals);
232 bool isIndexedMode()
const
233 {
return m_isIndexedMode; }
236 void endPolygon_( int32_t numVertices );
238 inline void addPolygonNormal(
const SbVec3f &vec1,
const SbVec3f &vec2 )
239 { polygonSum += (vec1).cross(vec2); }
249 SbVec3f *points, *faceNormals, *vertNormals;
250 int32_t *pointIndexes;
251 int32_t numPoints, numVertNormals;
252 int32_t maxPoints, maxFaceNormals, maxVertNormals;
258 float m_toleranceFactor;
260 int32_t m_approxNumVertices;
261 int32_t m_approxNumFaces;
263 int32_t m_pointIndex;
266 int32_t beginPolygonIndex;
270 int m_numNormalCrack;
271 bool m_isIndexedMode;
272 int32_t *m_userConnectivity;
275 void growPointsArray(
const int requestedMaxPoints);
277 void growNormalFaceArray(
const int requestedNormalFaceArraySize);
280 inline bool needToComputeConnectivity( )
const
281 {
return (( m_creaseAngle != 0.0f ) && ( m_userConnectivity == NULL )); }
286 int32_t* computeConnectivity( std::vector < std::pair< int, size_t > > &indicesClasses );
289 void evalConnectedVerticesIndicesClasses( int32_t* indirect,
size_t numPoints,
290 std::vector < std::pair< int, size_t > > &indicesClasses )
const;
295 static SbBool s_useOldTolerance;
static float getDefault()
Returns the default tolerance factor value.