![]() |
Coin3D is Free Software, published under the BSD 3-clause license. |
https://coin3d.github.io https://www.kongsberg.com/en/kogt/ |
The SoNormalGenerator class is used to generate normals. More...
#include <include/Inventor/misc/SoNormalGenerator.h>
Public Member Functions | |
SoNormalGenerator (const SbBool ccw, const int approxVertices=64) | |
~SoNormalGenerator () | |
void | reset (const SbBool ccw) |
void | beginPolygon () |
void | polygonVertex (const SbVec3f &v) |
void | endPolygon () |
void | triangle (const SbVec3f &v0, const SbVec3f &v1, const SbVec3f &v2) |
void | quad (const SbVec3f &v0, const SbVec3f &v1, const SbVec3f &v2, const SbVec3f &v3) |
void | generate (const float creaseAngle, const int32_t *striplens=NULL, const int numstrips=0) |
void | generatePerStrip (const int32_t *striplens, const int numstrips) |
void | generatePerFace (void) |
void | generateOverall (void) |
int | getNumNormals () const |
void | setNumNormals (const int num) |
const SbVec3f * | getNormals () const |
const SbVec3f & | getNormal (const int32_t i) const |
void | setNormal (const int32_t index, const SbVec3f &normal) |
The SoNormalGenerator class is used to generate normals.
FIXME: document properly
Constructor with isccw indicating if polygons are specified in counterclockwise order. The approxVertices can be used to optimize normal generation.
SoNormalGenerator::~SoNormalGenerator | ( | ) |
Destructor.
Signals the start of a new polygon.
Adds a vertex to the current polygon.
Signals the end of a polygon.
Convenience method for adding a triangle.
void SoNormalGenerator::quad | ( | const SbVec3f & | v0, |
const SbVec3f & | v1, | ||
const SbVec3f & | v2, | ||
const SbVec3f & | v3 | ||
) |
Convenience method for adding a quad
void SoNormalGenerator::generate | ( | const float | creaseAngle, |
const int32_t * | striplens = NULL , |
||
const int | numstrips = 0 |
||
) |
Triggers the normal generation. Normals are generated using creaseAngle to find which edges should be flat-shaded and which should be smooth-shaded.
If normals are generated for triangle strips, the striplens and numstrips must be supplied. See src/nodes/SoTriangleStripSet.cpp (generateDefaultNormals()) for an example on how you send triangle strip information to this generator. It's not trivial, since you have to know how OpenGL/Coin generate triangles from triangle strips.
Generates one normal per strip by averaging face normals.
Generates the normals per face. Use this when PER_FACE normal binding is needed. This method is not part of the OIV API.
Generates one overall normal by averaging all face normals. Use when normal binding is OVERALL. This method is not part of the OIV API.
int SoNormalGenerator::getNumNormals | ( | void | ) | const |
Returns the number of normals generated.
Sets the number of generated normals. This method is not supported in Coin, and is provided for API compatibility only.
Returns a pointer to the generated normals.
Returns the normal at index i.
Sets the normal at index index to normal. This method is not supported in Coin, and is provided for API compatibility only.