Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
SurgSim::Graphics::TangentSpaceGenerator Class Reference

Node visitor which calculates the tangent space basis vectors from the texture coordinates of any geometry it encounters. More...

#include <SurgSim/Graphics/TangentSpaceGenerator.h>

Inheritance diagram for SurgSim::Graphics::TangentSpaceGenerator:

Public Member Functions

 TangentSpaceGenerator (int textureCoordUnit, int tangentAttribIndex, int bitangentAttribIndex)
 Constructor. More...
 
virtual ~TangentSpaceGenerator ()
 Destructor. 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 ()
 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. More...
 
void apply (osg::Geode &geode) override
 Generates tangent space vectors for all geometry in the geode. More...
 

Static Public Member Functions

static void generateTangentSpace (osg::Geometry *geometry, int textureCoordUnit, int tangentAttribIndex, int bitangentAttribIndex, bool orthonormal)
 Generates tangent space basis vectors for the geometry. More...
 

Private Attributes

int m_textureCoordUnit
 Texture unit of texture coordinates to use for calculating the tangent space. More...
 
int m_tangentAttribIndex
 Index of the vertex attribute array to store the calculated tangents. More...
 
int m_bitangentAttribIndex
 Index of the vertex attribute array to store the 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

Node visitor which calculates the tangent space basis vectors from the texture coordinates of any geometry it encounters.

Constructor & Destructor Documentation

◆ TangentSpaceGenerator()

SurgSim::Graphics::TangentSpaceGenerator::TangentSpaceGenerator ( int  textureCoordUnit,
int  tangentAttribIndex,
int  bitangentAttribIndex 
)

Constructor.

Parameters
textureCoordUnitTexture unit of texture coordinates to use for calculating the tangent space
tangentAttribIndexIndex of the vertex attribute array to store the calculated tangents
bitangentAttribIndexIndex of the vertex attribute array to store the calculated bitangents

◆ ~TangentSpaceGenerator()

SurgSim::Graphics::TangentSpaceGenerator::~TangentSpaceGenerator ( )
virtual

Destructor.

Member Function Documentation

◆ apply()

void SurgSim::Graphics::TangentSpaceGenerator::apply ( osg::Geode &  geode)
override

Generates tangent space vectors for all geometry in the geode.

Parameters
geodeGeode to generate tangent space vectors

◆ generateTangentSpace()

void SurgSim::Graphics::TangentSpaceGenerator::generateTangentSpace ( osg::Geometry *  geometry,
int  textureCoordUnit,
int  tangentAttribIndex,
int  bitangentAttribIndex,
bool  orthonormal 
)
static

Generates tangent space basis vectors for the geometry.

Parameters
geometryGeometry to generate normals
textureCoordUnitTexture unit of texture coordinates to use for calculating the tangent space
tangentAttribIndexIndex of the vertex attribute array to store the calculated tangents
bitangentAttribIndexIndex of the vertex attribute array to store the calculated bi-tangents
orthonormalWhether or not to create a fully orthonormal basis; otherwise, each tangent is separately orthonormal to the normal, but not to each other

◆ getBasisOrthonormality()

bool SurgSim::Graphics::TangentSpaceGenerator::getBasisOrthonormality ( )

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.

◆ setBasisOrthonormality()

void SurgSim::Graphics::TangentSpaceGenerator::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_bitangentAttribIndex

int SurgSim::Graphics::TangentSpaceGenerator::m_bitangentAttribIndex
private

Index of the vertex attribute array to store the calculated bitangents.

◆ m_createOrthonormalBasis

bool SurgSim::Graphics::TangentSpaceGenerator::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_tangentAttribIndex

int SurgSim::Graphics::TangentSpaceGenerator::m_tangentAttribIndex
private

Index of the vertex attribute array to store the calculated tangents.

◆ m_textureCoordUnit

int SurgSim::Graphics::TangentSpaceGenerator::m_textureCoordUnit
private

Texture unit of texture coordinates to use for calculating the tangent space.


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