TangentSpaceGenerator
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSGUTIL_TANGENTSPACEGENERATOR_
#define OSGUTIL_TANGENTSPACEGENERATOR_
#include <osgUtil/Export>
#include <osg/ref_ptr>
#include <osg/Referenced>
#include <osg/Array>
#include <osg/Geometry>
namespace osgUtil
{
class OSGUTIL_EXPORT TangentSpaceGenerator: public osg::Referenced {
public:
TangentSpaceGenerator();
TangentSpaceGenerator(const TangentSpaceGenerator &copy, const osg::CopyOp &copyop = osg::CopyOp::SHALLOW_COPY);
void generate(osg::Geometry *geo, int normal_map_tex_unit = 0);
inline osg::Vec4Array *getTangentArray() { return T_.get(); }
inline const osg::Vec4Array *getTangentArray() const { return T_.get(); }
inline void setTangentArray(osg::Vec4Array *array) { T_ = array; }
inline osg::Vec4Array *getNormalArray() { return N_.get(); }
inline const osg::Vec4Array *getNormalArray() const { return N_.get(); }
inline void setNormalArray(osg::Vec4Array *array) { N_ = array; }
inline osg::Vec4Array *getBinormalArray() { return B_.get(); }
inline const osg::Vec4Array *getBinormalArray() const { return B_.get(); }
inline void setBinormalArray(osg::Vec4Array *array) { B_ = array; }
inline osg::IndexArray *getIndices() { return indices_.get(); }
protected:
virtual ~TangentSpaceGenerator() {}
TangentSpaceGenerator &operator=(const TangentSpaceGenerator &) { return *this; }
void compute(osg::PrimitiveSet *pset,
const osg::Array *vx,
const osg::Array *nx,
const osg::Array *tx,
int iA, int iB, int iC);
osg::ref_ptr<osg::Vec4Array> T_;
osg::ref_ptr<osg::Vec4Array> B_;
osg::ref_ptr<osg::Vec4Array> N_;
osg::ref_ptr<osg::UIntArray> indices_;
};
}
#endif
Array
Geometry
Referenced
osgUtil::TangentSpaceGenerator::T_
osg::ref_ptr< osg::Vec4Array > T_
Definition TangentSpaceGenerator:70
osgUtil::TangentSpaceGenerator::getTangentArray
osg::Vec4Array * getTangentArray()
Definition TangentSpaceGenerator:45
osgUtil::TangentSpaceGenerator::generate
void generate(osg::Geometry *geo, int normal_map_tex_unit=0)
osgUtil::TangentSpaceGenerator::indices_
osg::ref_ptr< osg::UIntArray > indices_
Definition TangentSpaceGenerator:73
osgUtil::TangentSpaceGenerator::getBinormalArray
const osg::Vec4Array * getBinormalArray() const
Definition TangentSpaceGenerator:54
osgUtil::TangentSpaceGenerator::getBinormalArray
osg::Vec4Array * getBinormalArray()
Definition TangentSpaceGenerator:53
osgUtil::TangentSpaceGenerator::~TangentSpaceGenerator
virtual ~TangentSpaceGenerator()
Definition TangentSpaceGenerator:61
osgUtil::TangentSpaceGenerator::getIndices
osg::IndexArray * getIndices()
Definition TangentSpaceGenerator:57
osgUtil::TangentSpaceGenerator::setNormalArray
void setNormalArray(osg::Vec4Array *array)
Definition TangentSpaceGenerator:51
osgUtil::TangentSpaceGenerator::getNormalArray
osg::Vec4Array * getNormalArray()
Definition TangentSpaceGenerator:49
osgUtil::TangentSpaceGenerator::N_
osg::ref_ptr< osg::Vec4Array > N_
Definition TangentSpaceGenerator:72
osgUtil::TangentSpaceGenerator::compute
void compute(osg::PrimitiveSet *pset, const osg::Array *vx, const osg::Array *nx, const osg::Array *tx, int iA, int iB, int iC)
osgUtil::TangentSpaceGenerator::TangentSpaceGenerator
TangentSpaceGenerator(const TangentSpaceGenerator &copy, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
osgUtil::TangentSpaceGenerator::setTangentArray
void setTangentArray(osg::Vec4Array *array)
Definition TangentSpaceGenerator:47
osgUtil::TangentSpaceGenerator::setBinormalArray
void setBinormalArray(osg::Vec4Array *array)
Definition TangentSpaceGenerator:55
osgUtil::TangentSpaceGenerator::getTangentArray
const osg::Vec4Array * getTangentArray() const
Definition TangentSpaceGenerator:46
osgUtil::TangentSpaceGenerator::B_
osg::ref_ptr< osg::Vec4Array > B_
Definition TangentSpaceGenerator:71
osgUtil::TangentSpaceGenerator::getNormalArray
const osg::Vec4Array * getNormalArray() const
Definition TangentSpaceGenerator:50
osgUtil::TangentSpaceGenerator::operator=
TangentSpaceGenerator & operator=(const TangentSpaceGenerator &)
Definition TangentSpaceGenerator:62
osgUtil::TangentSpaceGenerator::TangentSpaceGenerator
TangentSpaceGenerator()
osg::Array
Definition Array:61
osg::CopyOp
Definition CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition CopyOp:47
osg::Geometry
Definition Geometry:31
osg::IndexArray
Definition Array:320
osg::PrimitiveSet
Definition PrimitiveSet:125
osg::Referenced
Definition Referenced:44
osg::ref_ptr
Definition ref_ptr:32
osgUtil
Definition NodeVisitor:25
osg::Vec4Array
TemplateArray< Vec4, Array::Vec4ArrayType, 4, GL_FLOAT > Vec4Array
Definition Array:450
Export
OSGUTIL_EXPORT
#define OSGUTIL_EXPORT
Definition osgUtil/Export:40
ref_ptr