Open Inventor Release 2024.1.0
 
Loading...
Searching...
No Matches
SoTangentGenerator.h File Reference

Go to the source code of this file.

Functions

 ~SoTangentGenerator ()
 Surface tangent generator.
 
void setupApproxShapeSize (int32_t approxNumVertices)
 Resets the approximative number of vertices that we have to generate tangents for.
 
void beginLineStrip ()
 Send a line strip's worth of vertices.
 
void lineStripVertex (const SbVec3f &point)
 
void endLineStrip ()
 
void setupIndexedVertexArray (const SbVec3f *pointArray)
 Specifies a pointer to the array of points that will be used in subsequent calls to polygonVertex(index) and triangle(index1,index2,index3).
 
void lineStripVertex (const int32_t pointIndex)
 Send a line strip's worth of vertices using indexed vertices.
 
void generate ()
 Calculate the tangents once all vertices have been sent.
 
int getNumTangents () const
 Returns number of tangents generated.
 
const SbVec3fgetTangents () const
 Returns a pointer to the array of tangents.
 
const SbVec3fgetTangent (int32_t i) const
 Returns the i'th tangent in the array.
 
SoTangentBindingElement::Binding getBinding () const
 
void setTangent (int32_t index, const SbVec3f &newTangent)
 Add or modify a tangent vector.
 

Function Documentation

◆ beginLineStrip()

void beginLineStrip ( )

Send a line strip's worth of vertices.

Begin a strip, send as many vertices as you want, and then end the strip.

Definition at line 62 of file SoTangentBundle.h.

◆ endLineStrip()

void endLineStrip ( )

Definition at line 72 of file SoTangentBundle.h.

◆ generate()

void generate ( )

Calculate the tangents once all vertices have been sent.

◆ getBinding()

SoTangentBindingElement::Binding getBinding ( ) const

Definition at line 123 of file SoTangentGenerator.h.

◆ getNumTangents()

int getNumTangents ( ) const

Returns number of tangents generated.


This will be equal to the number of points sent.
NOTE: must be called after generate().

Definition at line 100 of file SoTangentGenerator.h.

◆ getTangent()

const SbVec3f & getTangent ( int32_t  i) const

Returns the i'th tangent in the array.


NOTE: must be called after generate().

Definition at line 118 of file SoTangentGenerator.h.

◆ getTangents()

const SbVec3f * getTangents ( ) const

Returns a pointer to the array of tangents.


NOTE: must be called after generate().

Definition at line 109 of file SoTangentGenerator.h.

◆ lineStripVertex() [1/2]

void lineStripVertex ( const int32_t  pointIndex)

Send a line strip's worth of vertices using indexed vertices.


NOTE: must be called after setupIndexedVertexArray().

Definition at line 83 of file SoTangentBundle.h.

◆ lineStripVertex() [2/2]

void lineStripVertex ( const SbVec3f point)

Definition at line 67 of file SoTangentBundle.h.

◆ setTangent()

void setTangent ( int32_t  index,
const SbVec3f newTangent 
)

Add or modify a tangent vector.


Some shapes may need to adjust or reorder tangents after generation. This method can be used to change a tangent. It will insert room in the array if necessary to accommodate the new tangent. NOTE: must be called after generate().

◆ setupApproxShapeSize()

void setupApproxShapeSize ( int32_t  approxNumVertices)

Resets the approximative number of vertices that we have to generate tangents for.

These correspond to the same parameters in the constructor, but allows setting them after creation.
Note: Must be called before first call to polygonVertex or triangle calls..

Definition at line 88 of file SoTangentBundle.h.

◆ setupIndexedVertexArray()

void setupIndexedVertexArray ( const SbVec3f pointArray)

Specifies a pointer to the array of points that will be used in subsequent calls to polygonVertex(index) and triangle(index1,index2,index3).


Using this mode allows reusing vertices, avoiding data copy and increasing performance. IMPORTANT NOTE:

  • This function should be called before any call to polygonVertex/triangle functions.
  • The data should remain valid until generate() has ended.
  • Once setupIndexedVertexArray has been called, only "by index" functions are valid.

Definition at line 118 of file SoNormalBundle.h.

◆ ~SoTangentGenerator()

~SoTangentGenerator ( )

Surface tangent generator.

This class can be used by lines shape classes to generate tangents when they do not have valid ones specified. To generate tangents, create an instance of this class, then specify each line strip in the shape, then call generate(). After generate() is called, the tangents can be accessed from the instance. There will be one tangent generated for each vertex of each strip, in the order passed in.

For efficiency, a constructor is provided that takes an approximate number of vertices that will be specified. Use this constructor if you know roughly how many vertices will be sent; this will cut down on allocation overhead.

NOTE The SoTangentGenerator destructor DOES NOT delete the array of generated tangents. The caller is responsible for doing so. This allows the tangents to be cached elsewhere without having to copy them.