OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
osgUtil::TangentSpaceGenerator Class Reference

#include <TangentSpaceGenerator.h>

Inheritance diagram for osgUtil::TangentSpaceGenerator:
Inheritance graph
[legend]
Collaboration diagram for osgUtil::TangentSpaceGenerator:
Collaboration graph
[legend]

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 ()
 
- Public Member Functions inherited from osg::Referenced
 Referenced ()
 
 Referenced (bool threadSafeRefUnref)
 
 Referenced (const Referenced &)
 
Referencedoperator= (const Referenced &)
 
virtual void setThreadSafeRefUnref (bool threadSafe)
 
bool getThreadSafeRefUnref () const
 
OpenThreads::MutexgetRefMutex () const
 
int ref () const
 
int unref () const
 
int unref_nodelete () const
 
int referenceCount () const
 
ObserverSetgetObserverSet () const
 
ObserverSetgetOrCreateObserverSet () const
 
void addObserver (Observer *observer) const
 
void removeObserver (Observer *observer) const
 

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 Member Functions inherited from osg::Referenced
virtual ~Referenced ()
 
void signalObserversAndDelete (bool signalDelete, bool doDelete) const
 
void deleteUsingDeleteHandler () const
 

Protected Attributes

osg::ref_ptr< osg::Vec4ArrayT_
 
osg::ref_ptr< osg::Vec4ArrayB_
 
osg::ref_ptr< osg::Vec4ArrayN_
 
osg::ref_ptr< osg::UIntArrayindices_
 
- 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::MutexgetGlobalReferencedMutex ()
 
static void setThreadSafeReferenceCounting (bool enableThreadSafeReferenceCounting)
 
static bool getThreadSafeReferenceCounting ()
 
static void setDeleteHandler (DeleteHandler *handler)
 
static DeleteHandlergetDeleteHandler ()
 

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.

Definition at line 38 of file TangentSpaceGenerator.h.

Constructor & Destructor Documentation

osgUtil::TangentSpaceGenerator::TangentSpaceGenerator ( )
osgUtil::TangentSpaceGenerator::TangentSpaceGenerator ( const TangentSpaceGenerator copy,
const osg::CopyOp copyop = osg::CopyOp::SHALLOW_COPY 
)
virtual osgUtil::TangentSpaceGenerator::~TangentSpaceGenerator ( )
inlineprotectedvirtual

Definition at line 61 of file TangentSpaceGenerator.h.

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 
)
osg::Vec4Array* osgUtil::TangentSpaceGenerator::getBinormalArray ( )
inline

Definition at line 53 of file TangentSpaceGenerator.h.

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

Definition at line 54 of file TangentSpaceGenerator.h.

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

Definition at line 57 of file TangentSpaceGenerator.h.

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

Definition at line 49 of file TangentSpaceGenerator.h.

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

Definition at line 50 of file TangentSpaceGenerator.h.

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

Definition at line 45 of file TangentSpaceGenerator.h.

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

Definition at line 46 of file TangentSpaceGenerator.h.

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

Definition at line 62 of file TangentSpaceGenerator.h.

void osgUtil::TangentSpaceGenerator::setBinormalArray ( osg::Vec4Array array)
inline

Definition at line 55 of file TangentSpaceGenerator.h.

void osgUtil::TangentSpaceGenerator::setNormalArray ( osg::Vec4Array array)
inline

Definition at line 51 of file TangentSpaceGenerator.h.

void osgUtil::TangentSpaceGenerator::setTangentArray ( osg::Vec4Array array)
inline

Definition at line 47 of file TangentSpaceGenerator.h.

Member Data Documentation

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

Definition at line 71 of file TangentSpaceGenerator.h.

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

Definition at line 73 of file TangentSpaceGenerator.h.

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

Definition at line 72 of file TangentSpaceGenerator.h.

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

Definition at line 70 of file TangentSpaceGenerator.h.


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