Coin  4.0.3
Coin3D core library
Loading...
Searching...
No Matches
SoNormalGenerator Class Reference

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 beginPolygon ()
 
void endPolygon ()
 
void generate (const float creaseAngle, const int32_t *striplens=NULL, const int numstrips=0)
 
void generateOverall (void)
 
void generatePerFace (void)
 
void generatePerStrip (const int32_t *striplens, const int numstrips)
 
const SbVec3fgetNormal (const int32_t i) const
 
const SbVec3fgetNormals () const
 
int getNumNormals () const
 
void polygonVertex (const SbVec3f &v)
 
void quad (const SbVec3f &v0, const SbVec3f &v1, const SbVec3f &v2, const SbVec3f &v3)
 
void reset (const SbBool ccw)
 
void setNormal (const int32_t index, const SbVec3f &normal)
 
void setNumNormals (const int num)
 
void triangle (const SbVec3f &v0, const SbVec3f &v1, const SbVec3f &v2)
 

Detailed Description

The SoNormalGenerator class is used to generate normals.

FIXME: document properly

Constructor & Destructor Documentation

◆ SoNormalGenerator()

SoNormalGenerator::SoNormalGenerator ( const SbBool isccw,
const int approxVertices = 64 )

Constructor with isccw indicating if polygons are specified in counterclockwise order. The approxVertices can be used to optimize normal generation.

◆ ~SoNormalGenerator()

SoNormalGenerator::~SoNormalGenerator ( )

Destructor.

Member Function Documentation

◆ beginPolygon()

void SoNormalGenerator::beginPolygon ( void )

Signals the start of a new polygon.

See also
SoNormalGenerator::polygonVertex()
SoNormalGenerator::endPolygon()

◆ endPolygon()

void SoNormalGenerator::endPolygon ( void )

◆ generate()

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.

◆ generateOverall()

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.

◆ generatePerFace()

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.

◆ generatePerStrip()

void SoNormalGenerator::generatePerStrip ( const int32_t * striplens,
const int numstrips )

Generates one normal per strip by averaging face normals.

◆ getNormal()

const SbVec3f & SoNormalGenerator::getNormal ( const int32_t i) const

Returns the normal at index i.

See also
SoNormalGenerator::getNumNormals()

◆ getNormals()

const SbVec3f * SoNormalGenerator::getNormals ( void ) const

Returns a pointer to the generated normals.

◆ getNumNormals()

int SoNormalGenerator::getNumNormals ( void ) const

Returns the number of normals generated.

◆ polygonVertex()

void SoNormalGenerator::polygonVertex ( const SbVec3f & v)

Adds a vertex to the current polygon.

See also
SoNormalGenerator::beginPolygon()
SoNormalGenerator::endPolygon()

◆ quad()

void SoNormalGenerator::quad ( const SbVec3f & v0,
const SbVec3f & v1,
const SbVec3f & v2,
const SbVec3f & v3 )

Convenience method for adding a quad

◆ reset()

void SoNormalGenerator::reset ( const SbBool ccwarg)

Resets the normal generator, making it possible to reuse it without allocating a new one.

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

◆ setNormal()

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.

◆ setNumNormals()

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.

◆ triangle()

void SoNormalGenerator::triangle ( const SbVec3f & v0,
const SbVec3f & v1,
const SbVec3f & v2 )

Convenience method for adding a triangle.


The documentation for this class was generated from the following files: