osgUtil::TangentSpaceGenerator Class Reference

`#include <TangentSpaceGenerator>`

Inheritance diagram for osgUtil::TangentSpaceGenerator:

## Public Member Functions

| TangentSpaceGenerator ()
| TangentSpaceGenerator (const TangentSpaceGenerator &copy, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
void | generate (osg::Geometry *geo, int normal_map_tex_unit=0)
osg::Vec4Array * | getTangentArray ()
const osg::Vec4Array * | getTangentArray () const
void | setTangentArray (osg::Vec4Array *array)
osg::Vec4Array * | getNormalArray ()
const osg::Vec4Array * | getNormalArray () const
void | setNormalArray (osg::Vec4Array *array)
osg::Vec4Array * | getBinormalArray ()
const osg::Vec4Array * | getBinormalArray () const
void | setBinormalArray (osg::Vec4Array *array)
osg::IndexArray * | getIndices ()
Public Member Functions inherited from osg::Referenced
| Referenced ()
| Referenced (bool threadSafeRefUnref)
| Referenced (const Referenced &)
Referenced & | operator= (const Referenced &)
virtual void | setThreadSafeRefUnref (bool)
bool | getThreadSafeRefUnref () const
OpenThreads::Mutex * | getRefMutex () const
int | ref () const
int | unref () const
int | unref_nodelete () const
int | referenceCount () const
ObserverSet * | getObserverSet () const
ObserverSet * | getOrCreateObserverSet () const
void | addObserver (Observer *observer) const
void | removeObserver (Observer *observer) const

## Protected Member Functions

virtual | ~TangentSpaceGenerator ()
TangentSpaceGenerator & | operator= (const TangentSpaceGenerator &)
void | compute (osg::PrimitiveSet *pset, const osg::Array *vx, const osg::Array *nx, const osg::Array *tx, int iA, int iB, int iC)
Protected Member Functions inherited from osg::Referenced
virtual | ~Referenced ()
void | signalObserversAndDelete (bool signalDelete, bool doDelete) const
void | deleteUsingDeleteHandler () const

## Protected Attributes

osg::ref_ptr< osg::Vec4Array > | T_
osg::ref_ptr< osg::Vec4Array > | B_
osg::ref_ptr< osg::Vec4Array > | N_
osg::ref_ptr< osg::UIntArray > | indices_
Protected Attributes inherited from osg::Referenced
OpenThreads::AtomicPtr | _observerSet
OpenThreads::Atomic | _refCount

## Additional Inherited Members

Static Public Member Functions inherited from osg::Referenced
static OpenThreads::Mutex * | getGlobalReferencedMutex ()
static void | setDeleteHandler (DeleteHandler *handler)
static DeleteHandler * | getDeleteHandler ()

## Detailed Description

The TangentSpaceGenerator class generates three arrays containing tangent-space basis vectors. It takes a texture-mapped Geometry object as input, traverses its primitive sets and computes Tangent, Normal and Binormal vectors for each vertex, storing them into arrays. The resulting arrays can be used as vertex program varying (per-vertex) parameters, enabling advanced effects like bump-mapping. To use this class, simply call the generate() method specifying the Geometry object you want to process and the texture unit that contains UV mapping for the normal map; then you can retrieve the TBN arrays by calling getTangentArray(), getNormalArray() and getBinormalArray() methods.

## Constructor & Destructor Documentation

## TangentSpaceGenerator() [1/2]

osgUtil::TangentSpaceGenerator::TangentSpaceGenerator | ( |  | ) |

Referenced by operator=(), and TangentSpaceGenerator().

## TangentSpaceGenerator() [2/2]

osgUtil::TangentSpaceGenerator::TangentSpaceGenerator | ( | const TangentSpaceGenerator & | copy,
|  | const osg::CopyOp & | copyop = osg::CopyOp::SHALLOW_COPY )

References osg::CopyOp::SHALLOW_COPY, and TangentSpaceGenerator().

## ~TangentSpaceGenerator()

virtual osgUtil::TangentSpaceGenerator::~TangentSpaceGenerator | ( |  | ) |

inline protected virtual

## Member Function Documentation

## compute()

void osgUtil::TangentSpaceGenerator::compute | ( | osg::PrimitiveSet * | pset,
|  | const osg::Array * | vx,
|  | const osg::Array * | nx,
|  | const osg::Array * | tx,
|  | int | iA,
|  | int | iB,
|  | int | iC )

protected

## generate()

void osgUtil::TangentSpaceGenerator::generate | ( | osg::Geometry * | geo,
|  | int | normal_map_tex_unit = 0 )

## getBinormalArray() [1/2]

osg::Vec4Array * osgUtil::TangentSpaceGenerator::getBinormalArray | ( |  | ) |

inline

References B_.

## getBinormalArray() [2/2]

const osg::Vec4Array * osgUtil::TangentSpaceGenerator::getBinormalArray | ( |  | ) | const

inline

References B_.

## getIndices()

osg::IndexArray * osgUtil::TangentSpaceGenerator::getIndices | ( |  | ) |

inline

References indices_.

## getNormalArray() [1/2]

osg::Vec4Array * osgUtil::TangentSpaceGenerator::getNormalArray | ( |  | ) |

inline

References N_.

## getNormalArray() [2/2]

const osg::Vec4Array * osgUtil::TangentSpaceGenerator::getNormalArray | ( |  | ) | const

inline

References N_.

## getTangentArray() [1/2]

osg::Vec4Array * osgUtil::TangentSpaceGenerator::getTangentArray | ( |  | ) |

inline

References T_.

## getTangentArray() [2/2]

const osg::Vec4Array * osgUtil::TangentSpaceGenerator::getTangentArray | ( |  | ) | const

inline

References T_.

## operator=()

TangentSpaceGenerator & osgUtil::TangentSpaceGenerator::operator= | ( | const TangentSpaceGenerator & |  | ) |

inline protected

References TangentSpaceGenerator().

## setBinormalArray()

void osgUtil::TangentSpaceGenerator::setBinormalArray | ( | osg::Vec4Array * | array | ) |

inline

References B_.

## setNormalArray()

void osgUtil::TangentSpaceGenerator::setNormalArray | ( | osg::Vec4Array * | array | ) |

inline

References N_.

## setTangentArray()

void osgUtil::TangentSpaceGenerator::setTangentArray | ( | osg::Vec4Array * | array | ) |

inline

References T_.

## Member Data Documentation

## B_

osg::ref_ptr<osg::Vec4Array> osgUtil::TangentSpaceGenerator::B_

protected

Referenced by getBinormalArray(), getBinormalArray(), and setBinormalArray().

## indices_

osg::ref_ptr<osg::UIntArray> osgUtil::TangentSpaceGenerator::indices_

protected

Referenced by getIndices().

## N_

osg::ref_ptr<osg::Vec4Array> osgUtil::TangentSpaceGenerator::N_

protected

Referenced by getNormalArray(), getNormalArray(), and setNormalArray().

## T_

osg::ref_ptr<osg::Vec4Array> osgUtil::TangentSpaceGenerator::T_

protected

Referenced by getTangentArray(), getTangentArray(), and setTangentArray().

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

- TangentSpaceGenerator