Triangle index functor which calculates normals for the vertices of a geometry, use createNormalGenerator to instantiate this.
More...
#include <SurgSim/Graphics/TriangleNormalGenerator.h>
|
void | set (osg::Vec3Array *vertexArray, osg::Vec3Array *normalArray) |
| Sets the arrays required to generate normals. More...
|
|
void | normalize () |
| Normalizes the calculated normals, this needs to be called after the pass to normalize all the normals Due to the osg way this object is called there is no real good way of having this called automatically. More...
|
|
void | reset () |
| Resets all calculated normals to 0. More...
|
|
void | operator() (size_t vertexIndex1, size_t vertexIndex2, size_t vertexIndex3) |
| Calculates the triangle normal and adds it to each adjacent vertex normal. More...
|
|
Triangle index functor which calculates normals for the vertices of a geometry, use createNormalGenerator to instantiate this.
SurgSim::Graphics::TriangleNormalGenerator::TriangleNormalGenerator |
( |
| ) |
|
|
protected |
void SurgSim::Graphics::TriangleNormalGenerator::normalize |
( |
| ) |
|
Normalizes the calculated normals, this needs to be called after the pass to normalize all the normals Due to the osg way this object is called there is no real good way of having this called automatically.
void SurgSim::Graphics::TriangleNormalGenerator::operator() |
( |
size_t |
vertexIndex1, |
|
|
size_t |
vertexIndex2, |
|
|
size_t |
vertexIndex3 |
|
) |
| |
Calculates the triangle normal and adds it to each adjacent vertex normal.
- Parameters
-
vertexIndex1 | First triangle vertex index |
vertexIndex2 | Second triangle vertex index |
vertexIndex3 | Third triangle vertex index |
void SurgSim::Graphics::TriangleNormalGenerator::reset |
( |
| ) |
|
Resets all calculated normals to 0.
void SurgSim::Graphics::TriangleNormalGenerator::set |
( |
osg::Vec3Array * |
vertexArray, |
|
|
osg::Vec3Array * |
normalArray |
|
) |
| |
Sets the arrays required to generate normals.
- Precondition
- vertexArray and normalArray, need to have the same number of entries and not be nullptr
- Parameters
-
vertexArray | Array containing vertex positions |
normalArray | Array to store calculated normals |
osg::ref_ptr<osg::Vec3Array> SurgSim::Graphics::TriangleNormalGenerator::m_normalArray |
|
private |
Array storing calculated normals.
size_t SurgSim::Graphics::TriangleNormalGenerator::m_size |
|
private |
Size of vertex and normal array.
osg::ref_ptr<osg::Vec3Array> SurgSim::Graphics::TriangleNormalGenerator::m_vertexArray |
|
private |
Array containing vertex positions.
The documentation for this class was generated from the following files: