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);
72 const osg::Vec3Array* m_vertexArray;
75 const osg::Vec3Array* m_normalArray;
78 const osg::Vec2Array* m_textureCoordArray;
81 osg::Vec4Array* m_tangentArray;
84 osg::Vec4Array* m_bitangentArray;
88 bool m_createOrthonormalBasis;
116 void apply(osg::Geode& geode)
override;
125 static void generateTangentSpace(osg::Geometry* geometry,
126 int textureCoordUnit,
127 int tangentAttribIndex,
128 int bitangentAttribIndex,
133 int m_textureCoordUnit;
136 int m_tangentAttribIndex;
139 int m_bitangentAttribIndex;
143 bool m_createOrthonormalBasis;
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
bool getBasisOrthonormality()
Definition: TangentSpaceGenerator.cpp:82
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:78
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:141
void reset()
Resets all calculated tangent space basis vectors to 0.
Definition: TangentSpaceGenerator.cpp:130
void orthogonalize()
Orthogonalize and normalize the calculated tangent space basis vectors.
Definition: TangentSpaceGenerator.cpp:117
GenerateTangentSpaceTriangleIndexFunctor()
Constructor.
Definition: TangentSpaceGenerator.cpp:68
Triangle index functor which calculates the tangent space basis vectors for the vertices of a geometr...
Definition: TangentSpaceGenerator.h:30