SoNormalGenerator(3)
π SoNormalGenerator(3) β Library Functions Manual β¨
okay bestie, gather round, because we're about to talk about normal generation and honestly? it's giving glow-up energy for your 3D geometry. this page lives in the Library Functions Manual section, and it's SoNormalGenerator(3) β say it with me, the icon itself.
π NAME π
SoNormalGenerator β the class that generates normals. that's it, that's the whole job, and it does it slayfully.
πΈ SYNOPSIS πΈ
first things first, you gotta pull it in:
#include <include/Inventor/misc/SoNormalGenerator.h>
β¨ Public Member Functions β¨
here's the whole squad, verbatim, no edits, no cuts:
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)
π¦ Detailed Description π¦
The SoNormalGenerator class is used to generate normals.
and then the source code literally says:
FIXME: document properly
not me reading the actual docs and finding a FIXME π iconic honestly. we move.
π Constructor & Destructor Documentation π
π SoNormalGenerator::SoNormalGenerator (const SbBool isccw, const int approxVertices = 64)
Constructor time, bestie. isccw tells the generator whether your polygons are specified in counter clockwise order β that's the vibe check that decides which way your normals face. and approxVertices is the little optimization hint: use it to optimize normal generation when you already know roughly how many vertices are coming.
π SoNormalGenerator::~SoNormalGenerator ()
Destructor. it's the goodbye kiss π«Ά, cleans up after itself, no drama.
π Member Function Documentation π
β void SoNormalGenerator::reset (const SbBool ccwarg)
Resets the normal generator, making it possible to reuse it without allocating a brand new one. recycling queen behavior β»οΈβ¨
This function is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API.
Since
Coin 2.0
β void SoNormalGenerator::beginPolygon (void )
Signals the start of a new polygon. like saying "okay we're starting, everyone focus" π£
See also
SoNormalGenerator::polygonVertex()SoNormalGenerator::endPolygon()
β void SoNormalGenerator::polygonVertex (const SbVec3f & v)
Adds a vertex to the current polygon. one vertex at a time, no skipping the line π
See also
SoNormalGenerator::beginPolygon()SoNormalGenerator::endPolygon()
β void SoNormalGenerator::endPolygon (void )
Signals the end of a polygon. that's a wrap, thank you for coming to my TED talk π¬
See also
SoNormalGenerator::beginPolygon()SoNormalGenerator::polygonVertex()
β void SoNormalGenerator::triangle (const SbVec3f & v0, const SbVec3f & v1, const SbVec3f & v2)
Convenience method for adding a triangle. three vertices and you're done, effortless.
β void SoNormalGenerator::quad (const SbVec3f & v0, const SbVec3f & v1, const SbVec3f & v2, const SbVec3f & v3)
Convenience method for adding a quad. four vertices, still effortless.
β void SoNormalGenerator::generate (const float creaseAngle, const int32_t * striplens = NULL, const int numstrips = 0)
Triggers the normal generation. this is the main character moment π₯. Normals are generated using creaseAngle to figure out which edges should be flat-shaded and which should be smooth-shaded. the angle is literally the vibe check between smooth and faceted.
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. no cap, this part is the hard part π
β void SoNormalGenerator::generatePerStrip (const int32_t * striplens, const int numstrips)
Generates one normal per strip by averaging face normals.
β void SoNormalGenerator::generatePerFace (void )
Generates the normals per face. Use this when PER_FACE normal binding is needed.
This method is not part of the OIV API.
β void SoNormalGenerator::generateOverall (void )
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. the receipts, basically π§Ύ
β void SoNormalGenerator::setNumNormals (const int num)
Sets the number of generated normals.
This method is not supported in Coin, and is provided for API compatibility only. it exists purely to be polite to old code, it does not actually do the thing π
β const SbVec3f * SoNormalGenerator::getNormals (void ) const
Returns a pointer to the generated normals. all of them, at once, in one big handoff π
β const SbVec3f & SoNormalGenerator::getNormal (const int32_t i) const
Returns the normal at index i. just the one, your fave.
See also
SoNormalGenerator::getNumNormals()
β void SoNormalGenerator::setNormal (const int32_t index, const SbVec3f & normal)
Sets the normal at index index to normal.
This method is not supported in Coin, and is provided for API compatibility only. same deal as setNumNormals, it's there for the vibes of backwards compatibility only π
π Author π
Generated automatically by Doxygen for Coin from the source code. the robots wrote it, I just gave it a personality bestie π§
and that's the whole page, we ate and left no crumbs π
ok so for the cute sign-off: this whole thing comes from Coin, Version 3.1.3, and it's the SoNormalGenerator(3) page, so if you ever need to cite it, that's your girl. periodt. πβ¨π¦
π¦ where this page comes from
- fedora 43: Coin3-devel 3.1.3-40.fc43 Β· GPL-2.0-only
- fedora 43: Coin3-devel 3.1.3-40.fc43 Β· GPL-2.0-only
- fedora 44: Coin3-devel 3.1.3-42.fc44 Β· GPL-2.0-only
- fedora 44: Coin3-devel 3.1.3-42.fc44 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms