opensurgsim
Public Member Functions | List of all members
SurgSim::Graphics::GenerateTangentSpaceTriangleIndexFunctor Class Reference

Triangle index functor which calculates the tangent space basis vectors for the vertices of a geometry from texture coordinates. More...

#include <TangentSpaceGenerator.h>

Public Member Functions

 GenerateTangentSpaceTriangleIndexFunctor ()
 Constructor.
 
void setBasisOrthonormality (bool orthonormal)
 Sets whether the three tangent space basis vectors are made to be orthonormal; otherwise, each tangent is separately orthonormal to the normal, but not to each other. More...
 
bool getBasisOrthonormality ()
 
void set (const osg::Vec3Array *vertexArray, const osg::Vec3Array *normalArray, const osg::Vec2Array *textureCoordArray, osg::Vec4Array *tangentArray, osg::Vec4Array *bitangentArray)
 Sets the arrays required to generate tangent space basis vectors. More...
 
void orthogonalize ()
 Orthogonalize and normalize the calculated tangent space basis vectors.
 
void reset ()
 Resets all calculated tangent space basis vectors to 0.
 
void operator() (unsigned int vertexIndex1, unsigned int vertexIndex2, unsigned int vertexIndex3)
 Calculates the triangle tangent space basis vectors and adds it to each adjacent vertex's tangent. More...
 

Detailed Description

Triangle index functor which calculates the tangent space basis vectors for the vertices of a geometry from texture coordinates.

Member Function Documentation

§ getBasisOrthonormality()

bool SurgSim::Graphics::GenerateTangentSpaceTriangleIndexFunctor::getBasisOrthonormality ( )
Returns
Gets whether the three tangent space basis vectors are made to be orthonormal; otherwise, each tangent is separately orthonormal to the normal, but not to each other

§ operator()()

void SurgSim::Graphics::GenerateTangentSpaceTriangleIndexFunctor::operator() ( unsigned int  vertexIndex1,
unsigned int  vertexIndex2,
unsigned int  vertexIndex3 
)

Calculates the triangle tangent space basis vectors and adds it to each adjacent vertex's tangent.

Parameters
vertexIndex1First triangle vertex index
vertexIndex2Second triangle vertex index
vertexIndex3Third triangle vertex index

§ set()

void SurgSim::Graphics::GenerateTangentSpaceTriangleIndexFunctor::set ( const osg::Vec3Array *  vertexArray,
const osg::Vec3Array *  normalArray,
const osg::Vec2Array *  textureCoordArray,
osg::Vec4Array *  tangentArray,
osg::Vec4Array *  bitangentArray 
)

Sets the arrays required to generate tangent space basis vectors.

Parameters
vertexArrayArray containing vertex positions
normalArrayArray containing vertex normals
textureCoordArrayArray containing texture coordinates
tangentArrayArray to store calculated tangents
bitangentArrayArray to store calculated bitangents

§ setBasisOrthonormality()

void SurgSim::Graphics::GenerateTangentSpaceTriangleIndexFunctor::setBasisOrthonormality ( bool  orthonormal)

Sets whether the three tangent space basis vectors are made to be orthonormal; otherwise, each tangent is separately orthonormal to the normal, but not to each other.

Parameters
orthonormalWhether or not to create a fully orthonormal basis

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