50#ifndef _SO_NORMAL_BUNDLE
51#define _SO_NORMAL_BUNDLE
105 { generator->beginPolygon(); }
107 { generator->polygonVertex(point); }
109 { generator->endPolygon(); }
115 { generator->triangle(p1, p2, p3); }
119 { generator->setupIndexedVertexArray(pointArray); }
121 { generator->polygonVertex(index); }
122 void triangle(
const int32_t index1,
const int32_t index2,
const int32_t index3)
123 { generator->triangle(index1,index2,index3); }
125 { generator->setupIndexedConnectivity(connectivityArray); }
127 { generator->setupApproxShapeSize(numVert,numFace); }
149 {
return generator->getNormals(); }
151 {
return generator->getNumNormals(); }
154 if (m_isIndexedNormal)
171 const int startIndex = 0
175 void set(SoNormalCache* nc);
180 {
return normElt->
getNum() != 0 ? normElt->
get(index - m_startIndex) : s_zVers; }
183 virtual void send(
int index)
const;
188 {
return generator->numNormalCrack(); }
191 {
return m_startIndex; }
195 SoNormalGenerator *generator;
205 bool m_isIndexedNormal;
#define TRUE
Possible value of SbBool.
SbBool shouldGenerate(int numNeeded)
void initGenerator(int initialNum=100)
void set(int32_t numNormals, const SbVec3f *normals, const SoNormalBindingElement::Binding binding, const int startIndex=0)
void beginPolygon()
Send a polygon's worth of vertices.
void triangle(const SbVec3f &p1, const SbVec3f &p2, const SbVec3f &p3)
Send a triangle.
int numNormalCrack() const
const SbVec3f & get(int index) const
int getStartIndex() const
int getNumGeneratedNormals() const
void setupIndexedConnectivity(const int32_t *connectivityArray)
Specifies a per-vertex connectivity array.
const SbVec3f * getGeneratedNormals() const
SoNormalBindingElement::Binding getNormalBinding() const
void polygonVertex(const SbVec3f &point)
void setupApproxShapeSize(const int32_t numVert, const int32_t numFace)
Resets the approximative number of vertices and faces that we have to generate normals for.
virtual ~SoNormalBundle()
virtual void send(int index) const
void setupIndexedVertexArray(const SbVec3f *pointArray)
Specifies a pointer to the array of points that will be used in subsequent calls to polygonVertex(ind...
void generate()
Calculate the normals once all vertices have been sent.
Abstract base class for all actions.
Abstract base class for all database nodes.
Binding
The choice of values is for compatibility with Open Inventor 2.0 binary format files:
@ PER_VERTEX
One normal for each vertex.
@ PER_VERTEX_INDEXED
One normal for each vertex, indexed.
Allows read-only access to the top element in the state.
int32_t getNum() const
Returns the number of normal vectors in an instance.
const SbVec3f & get(int index) const
Returns the indexed normal from an element.