Public Member Functions | Private Attributes | 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 <SurgSim/Graphics/TangentSpaceGenerator.h>

Public Member Functions

 GenerateTangentSpaceTriangleIndexFunctor ()
 Constructor. More...
 
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. More...
 
void reset ()
 Resets all calculated tangent space basis vectors to 0. More...
 
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...
 

Private Attributes

const osg::Vec3Array * m_vertexArray
 Array containing vertex positions. More...
 
const osg::Vec3Array * m_normalArray
 Array containing normals. More...
 
const osg::Vec2Array * m_textureCoordArray
 Array containing texture coordinates. More...
 
osg::Vec4Array * m_tangentArray
 Array storing calculated tangents. More...
 
osg::Vec4Array * m_bitangentArray
 Array storing calculated bitangents. More...
 
bool m_createOrthonormalBasis
 Whether or not to create a fully orthonormal basis; otherwise, each tangent is separately orthonormal to the normal, but not to each other. More...
 

Detailed Description

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

Constructor & Destructor Documentation

§ GenerateTangentSpaceTriangleIndexFunctor()

SurgSim::Graphics::GenerateTangentSpaceTriangleIndexFunctor::GenerateTangentSpaceTriangleIndexFunctor ( )

Constructor.

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

§ orthogonalize()

void SurgSim::Graphics::GenerateTangentSpaceTriangleIndexFunctor::orthogonalize ( )

Orthogonalize and normalize the calculated tangent space basis vectors.

§ reset()

void SurgSim::Graphics::GenerateTangentSpaceTriangleIndexFunctor::reset ( )

Resets all calculated tangent space basis vectors to 0.

§ 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

Member Data Documentation

§ m_bitangentArray

osg::Vec4Array* SurgSim::Graphics::GenerateTangentSpaceTriangleIndexFunctor::m_bitangentArray
private

Array storing calculated bitangents.

§ m_createOrthonormalBasis

bool SurgSim::Graphics::GenerateTangentSpaceTriangleIndexFunctor::m_createOrthonormalBasis
private

Whether or not to create a fully orthonormal basis; otherwise, each tangent is separately orthonormal to the normal, but not to each other.

§ m_normalArray

const osg::Vec3Array* SurgSim::Graphics::GenerateTangentSpaceTriangleIndexFunctor::m_normalArray
private

Array containing normals.

§ m_tangentArray

osg::Vec4Array* SurgSim::Graphics::GenerateTangentSpaceTriangleIndexFunctor::m_tangentArray
private

Array storing calculated tangents.

§ m_textureCoordArray

const osg::Vec2Array* SurgSim::Graphics::GenerateTangentSpaceTriangleIndexFunctor::m_textureCoordArray
private

Array containing texture coordinates.

§ m_vertexArray

const osg::Vec3Array* SurgSim::Graphics::GenerateTangentSpaceTriangleIndexFunctor::m_vertexArray
private

Array containing vertex positions.


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