16 #ifndef SURGSIM_GRAPHICS_TANGENTSPACEGENERATOR_H 17 #define SURGSIM_GRAPHICS_TANGENTSPACEGENERATOR_H 19 #include <osg/NodeVisitor> 21 #include <osg/Geometry> 51 void set(
const osg::Vec3Array* vertexArray,
52 const osg::Vec3Array* normalArray,
53 const osg::Vec2Array* textureCoordArray,
54 osg::Vec4Array* tangentArray,
55 osg::Vec4Array* bitangentArray);
68 void operator()(
unsigned int vertexIndex1,
unsigned int vertexIndex2,
unsigned int vertexIndex3);
116 void apply(osg::Geode& geode)
override;
125 static void generateTangentSpace(osg::Geometry* geometry,
126 int textureCoordUnit,
127 int tangentAttribIndex,
128 int bitangentAttribIndex,
Definition: CompoundShapeToGraphics.cpp:29
bool m_createOrthonormalBasis
Whether or not to create a fully orthonormal basis; otherwise, each tangent is separately orthonormal...
Definition: TangentSpaceGenerator.h:143
bool getBasisOrthonormality()
Definition: TangentSpaceGenerator.cpp:81
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.
Definition: TangentSpaceGenerator.cpp:77
int m_tangentAttribIndex
Index of the vertex attribute array to store the calculated tangents.
Definition: TangentSpaceGenerator.h:136
Node visitor which calculates the tangent space basis vectors from the texture coordinates of any geo...
Definition: TangentSpaceGenerator.h:93
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...
Definition: TangentSpaceGenerator.cpp:140
void reset()
Resets all calculated tangent space basis vectors to 0.
Definition: TangentSpaceGenerator.cpp:129
void orthogonalize()
Orthogonalize and normalize the calculated tangent space basis vectors.
Definition: TangentSpaceGenerator.cpp:116
GenerateTangentSpaceTriangleIndexFunctor()
Constructor.
Definition: TangentSpaceGenerator.cpp:67
const osg::Vec3Array * m_vertexArray
Array containing vertex positions.
Definition: TangentSpaceGenerator.h:72
bool m_createOrthonormalBasis
Whether or not to create a fully orthonormal basis; otherwise, each tangent is separately orthonormal...
Definition: TangentSpaceGenerator.h:88
Triangle index functor which calculates the tangent space basis vectors for the vertices of a geometr...
Definition: TangentSpaceGenerator.h:30
int m_textureCoordUnit
Texture unit of texture coordinates to use for calculating the tangent space.
Definition: TangentSpaceGenerator.h:133
osg::Vec4Array * m_tangentArray
Array storing calculated tangents.
Definition: TangentSpaceGenerator.h:81
osg::Vec4Array * m_bitangentArray
Array storing calculated bitangents.
Definition: TangentSpaceGenerator.h:84
const osg::Vec2Array * m_textureCoordArray
Array containing texture coordinates.
Definition: TangentSpaceGenerator.h:78
const osg::Vec3Array * m_normalArray
Array containing normals.
Definition: TangentSpaceGenerator.h:75
int m_bitangentAttribIndex
Index of the vertex attribute array to store the calculated bitangents.
Definition: TangentSpaceGenerator.h:139