OpenSceneGraph
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
osgUtil::TangentSpaceGenerator Class Reference

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

Inheritance diagram for osgUtil::TangentSpaceGenerator:
Inheritance 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)
 Deprecated, Referenced is now always uses thread safe ref/unref, use default Referenced() constructor instead. More...
 
 Referenced (const Referenced &)
 
Referencedoperator= (const Referenced &)
 
virtual void setThreadSafeRefUnref (bool)
 Deprecated, Referenced is always theadsafe so there method now has no effect and does not need to be called. More...
 
bool getThreadSafeRefUnref () const
 Get whether a mutex is used to ensure ref() and unref() are thread safe. More...
 
OpenThreads::MutexgetRefMutex () const
 Get the mutex used to ensure thread safety of ref()/unref(). More...
 
int ref () const
 Increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
int unref () const
 Decrement the reference count by one, indicating that a pointer to this object is no longer referencing it. More...
 
int unref_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is no longer referencing it. More...
 
int referenceCount () const
 Return the number of pointers currently referencing this object. More...
 
ObserverSetgetObserverSet () const
 Get the ObserverSet if one is attached, otherwise return NULL. More...
 
ObserverSetgetOrCreateObserverSet () const
 Get the ObserverSet if one is attached, otherwise create an ObserverSet, attach it, then return this newly created ObserverSet. More...
 
void addObserver (Observer *observer) const
 Add a Observer that is observing this object, notify the Observer when this object gets deleted. More...
 
void removeObserver (Observer *observer) const
 Remove Observer that is observing this object. More...
 

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 ()
 Get the optional global Referenced mutex, this can be shared between all osg::Referenced. More...
 
static void setDeleteHandler (DeleteHandler *handler)
 Set a DeleteHandler to which deletion of all referenced counted objects will be delegated. More...
 
static DeleteHandlergetDeleteHandler ()
 Get a DeleteHandler. More...
 

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 ( )

◆ TangentSpaceGenerator() [2/2]

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

◆ ~TangentSpaceGenerator()

virtual osgUtil::TangentSpaceGenerator::~TangentSpaceGenerator ( )
inlineprotectedvirtual

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

◆ getBinormalArray() [2/2]

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

◆ getIndices()

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

◆ getNormalArray() [1/2]

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

◆ getNormalArray() [2/2]

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

◆ getTangentArray() [1/2]

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

◆ getTangentArray() [2/2]

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

◆ operator=()

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

◆ setBinormalArray()

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

◆ setNormalArray()

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

◆ setTangentArray()

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

Member Data Documentation

◆ B_

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

◆ indices_

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

◆ N_

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

◆ T_

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

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