Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

osgUtil::TangentSpaceGenerator Class Reference

The TangentSpaceGenerator class generates three arrays containing tangent-space basis vectors. More...

Inheritance diagram for osgUtil::TangentSpaceGenerator:

Inheritance graph
[legend]
List of all members.

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::Vec4ArraygetTangentArray ()
const osg::Vec4ArraygetTangentArray () const
void setTangentArray (osg::Vec4Array *array)
osg::Vec4ArraygetNormalArray ()
const osg::Vec4ArraygetNormalArray () const
void setNormalArray (osg::Vec4Array *array)
osg::Vec4ArraygetBinormalArray ()
const osg::Vec4ArraygetBinormalArray () const
void setBinormalArray (osg::Vec4Array *array)
osg::IndexArraygetIndices ()

Protected Member Functions

virtual ~TangentSpaceGenerator ()
TangentSpaceGeneratoroperator= (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 Attributes

osg::ref_ptr< osg::Vec4ArrayT_
osg::ref_ptr< osg::Vec4ArrayB_
osg::ref_ptr< osg::Vec4ArrayN_
osg::ref_ptr< osg::UIntArrayindices_

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

osgUtil::TangentSpaceGenerator::TangentSpaceGenerator  ) 
 

osgUtil::TangentSpaceGenerator::TangentSpaceGenerator const TangentSpaceGenerator copy,
const osg::CopyOp copyop = osg::CopyOp::SHALLOW_COPY
 

virtual osgUtil::TangentSpaceGenerator::~TangentSpaceGenerator  )  [inline, protected, virtual]
 


Member Function Documentation

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]
 

void osgUtil::TangentSpaceGenerator::generate osg::Geometry geo,
int  normal_map_tex_unit = 0
 

const osg::Vec4Array* osgUtil::TangentSpaceGenerator::getBinormalArray  )  const [inline]
 

osg::Vec4Array* osgUtil::TangentSpaceGenerator::getBinormalArray  )  [inline]
 

osg::IndexArray* osgUtil::TangentSpaceGenerator::getIndices  )  [inline]
 

const osg::Vec4Array* osgUtil::TangentSpaceGenerator::getNormalArray  )  const [inline]
 

osg::Vec4Array* osgUtil::TangentSpaceGenerator::getNormalArray  )  [inline]
 

const osg::Vec4Array* osgUtil::TangentSpaceGenerator::getTangentArray  )  const [inline]
 

osg::Vec4Array* osgUtil::TangentSpaceGenerator::getTangentArray  )  [inline]
 

TangentSpaceGenerator& osgUtil::TangentSpaceGenerator::operator= const TangentSpaceGenerator  )  [inline, protected]
 

void osgUtil::TangentSpaceGenerator::setBinormalArray osg::Vec4Array array  )  [inline]
 

void osgUtil::TangentSpaceGenerator::setNormalArray osg::Vec4Array array  )  [inline]
 

void osgUtil::TangentSpaceGenerator::setTangentArray osg::Vec4Array array  )  [inline]
 


Member Data Documentation

osg::ref_ptr<osg::Vec4Array> osgUtil::TangentSpaceGenerator::B_ [protected]
 

osg::ref_ptr<osg::UIntArray> osgUtil::TangentSpaceGenerator::indices_ [protected]
 

osg::ref_ptr<osg::Vec4Array> osgUtil::TangentSpaceGenerator::N_ [protected]
 

osg::ref_ptr<osg::Vec4Array> osgUtil::TangentSpaceGenerator::T_ [protected]
 


The documentation for this class was generated from the following file:
Generated at Thu Nov 24 16:25:50 2005 for the OpenSceneGraph by doxygen 1.3.6.