Go to the documentation of this file.
16 #ifndef SURGSIM_GRAPHICS_TRIANGLENORMALGENERATOR_H
17 #define SURGSIM_GRAPHICS_TRIANGLENORMALGENERATOR_H
19 #include <osg/NodeVisitor>
21 #include <osg/Geometry>
22 #include <osg/TriangleIndexFunctor>
40 void set(osg::Vec3Array* vertexArray,
41 osg::Vec3Array* normalArray);
54 void operator() (
size_t vertexIndex1,
size_t vertexIndex2,
size_t vertexIndex3);
73 osg::Vec3Array* vertexArray,
74 osg::Vec3Array* normalArray);
void normalize()
Normalizes the calculated normals, this needs to be called after the pass to normalize all the normal...
Definition: TriangleNormalGenerator.cpp:49
TriangleNormalGenerator()
Constructor.
Definition: TriangleNormalGenerator.cpp:29
void set(osg::Vec3Array *vertexArray, osg::Vec3Array *normalArray)
Sets the arrays required to generate normals.
Definition: TriangleNormalGenerator.cpp:35
Definition: CompoundShapeToGraphics.cpp:29
void reset()
Resets all calculated normals to 0.
Definition: TriangleNormalGenerator.cpp:57
osg::ref_ptr< osg::Vec3Array > m_normalArray
Array storing calculated normals.
Definition: TriangleNormalGenerator.h:66
osg::ref_ptr< osg::Vec3Array > m_vertexArray
Array containing vertex positions.
Definition: TriangleNormalGenerator.h:63
size_t m_size
Size of vertex and normal array.
Definition: TriangleNormalGenerator.h:69
void operator()(size_t vertexIndex1, size_t vertexIndex2, size_t vertexIndex3)
Calculates the triangle normal and adds it to each adjacent vertex normal.
Definition: TriangleNormalGenerator.cpp:66
osg::TriangleIndexFunctor< TriangleNormalGenerator > createNormalGenerator(osg::Vec3Array *vertexArray, osg::Vec3Array *normalArray)
Definition: TriangleNormalGenerator.cpp:86
Triangle index functor which calculates normals for the vertices of a geometry, use createNormalGener...
Definition: TriangleNormalGenerator.h:32