From Geoff Michel, speeling and typo fixes in osgUtil

This commit is contained in:
Robert Osfield 2004-10-24 14:42:40 +00:00
parent f347703370
commit a9e19fde9c
5 changed files with 50 additions and 48 deletions

View File

@ -24,47 +24,47 @@
namespace osgUtil
{
/**
This 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.
*/
class OSGUTIL_EXPORT TangentSpaceGenerator: public osg::Referenced {
public:
TangentSpaceGenerator();
TangentSpaceGenerator(const TangentSpaceGenerator &copy, const osg::CopyOp &copyop = osg::CopyOp::SHALLOW_COPY);
/**
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.
*/
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);
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 *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 *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::Vec4Array *getBinormalArray() { return B_.get(); }
inline const osg::Vec4Array *getBinormalArray() const { return B_.get(); }
inline void setBinormalArray(osg::Vec4Array *array) { B_ = array; }
protected:
virtual ~TangentSpaceGenerator() {}
TangentSpaceGenerator &operator=(const TangentSpaceGenerator &) { return *this; }
protected:
virtual ~TangentSpaceGenerator() {}
TangentSpaceGenerator &operator=(const TangentSpaceGenerator &) { return *this; }
void compute_basis_vectors(osg::PrimitiveSet *pset, const osg::Array *vx, const osg::Array *nx, const osg::Array *tx, int iA, int iB, int iC);
void compute_basis_vectors(osg::PrimitiveSet *pset, const osg::Array *vx, const osg::Array *nx, const osg::Array *tx, int iA, int iB, int iC);
private:
osg::ref_ptr<osg::Vec4Array> T_;
osg::ref_ptr<osg::Vec4Array> B_;
osg::ref_ptr<osg::Vec4Array> N_;
};
private:
osg::ref_ptr<osg::Vec4Array> T_;
osg::ref_ptr<osg::Vec4Array> B_;
osg::ref_ptr<osg::Vec4Array> N_;
};
}

View File

@ -27,12 +27,12 @@ class OSGUTIL_EXPORT TransformAttributeFunctor : public osg::Drawable::Attribute
{
public:
/** construct a functor to transform a drawable's vertex and normal attributes by specified matrix.*/
/** Construct a functor to transform a drawable's vertex and normal attributes by specified matrix.*/
TransformAttributeFunctor(const osg::Matrix& m);
virtual ~TransformAttributeFunctor();
/** do the work of transforming vertex and normal attributes. */
/** Do the work of transforming vertex and normal attributes. */
virtual void apply(osg::Drawable::AttributeType type,unsigned int count,osg::Vec3* begin);
osg::Matrix _m;

View File

@ -25,7 +25,7 @@
namespace osgUtil {
/** A tri stripping visitor for converting Geometry surface primitives into tri strips.
* The current implemention is based up Tanguy Fautre's triangulation code.
* The current implemention is based upon Tanguy Fautre's triangulation code.
*/
class OSGUTIL_EXPORT TriStripVisitor : public osg::NodeVisitor
{
@ -45,10 +45,10 @@ class OSGUTIL_EXPORT TriStripVisitor : public osg::NodeVisitor
*/
void stripify(osg::Geometry& drawable);
/** Stripfy the accumulated list of Geometry drawables.*/
/** Stripify (make into strips of tria or quads) the accumulated list of Geometry drawables.*/
void stripify();
/// accumulate the Geometry drawables to stripify
/// Accumulate the Geometry drawables to make into strips.
virtual void apply(osg::Geode& geode);
inline void setCacheSize( unsigned int size )

View File

@ -32,7 +32,7 @@ namespace osgUtil {
/**
* Basic UpdateVisitor implementation for animating a scene.
* This visitor traverses the scene graph, call each nodes appCallback if
* This visitor traverses the scene graph, calling each nodes appCallback if
* it exists.
*/
class OSGUTIL_EXPORT UpdateVisitor : public osg::NodeVisitor
@ -44,6 +44,7 @@ class OSGUTIL_EXPORT UpdateVisitor : public osg::NodeVisitor
virtual void reset();
/** During traversal each type of node calls its callbacks and its children traversed. */
virtual void apply(osg::Node& node) { handle_callbacks_and_traverse(node); }
virtual void apply(osg::Geode& node) { handle_geode_callbacks(node); }
@ -62,10 +63,10 @@ class OSGUTIL_EXPORT UpdateVisitor : public osg::NodeVisitor
protected:
// /** prevent unwanted copy construction.*/
// /** Prevent unwanted copy construction.*/
// UpdateVisitor(const UpdateVisitor&):osg::NodeVisitor() {}
/** prevent unwanted copy operator.*/
/** Prevent unwanted copy operator.*/
UpdateVisitor& operator = (const UpdateVisitor&) { return *this; }
inline void handle_callbacks_and_traverse(osg::Node& node)
@ -79,14 +80,15 @@ class OSGUTIL_EXPORT UpdateVisitor : public osg::NodeVisitor
{
osg::NodeCallback* callback = node.getUpdateCallback();
if (callback) (*callback)(&node,this);
/*else if (node.getNumChildrenRequiringUpdateTraversal()>0)*/ traverseGeode(node);
/*else if (node.getNumChildrenRequiringUpdateTraversal()>0)*/
traverseGeode(node);
}
inline void traverseGeode(osg::Geode& geode)
{
traverse((osg::Node&)geode);
// call the app callbacks on the drawables.
// Call the app callbacks on the drawables.
for(unsigned int i=0;i<geode.getNumDrawables();++i)
{
osg::Drawable::UpdateCallback* callback = geode.getDrawable(i)->getUpdateCallback();

View File

@ -20,8 +20,8 @@
extern "C" {
/**
* getVersion_osgUtil() returns the library version number.
* Numbering convention : osg_src-0.8-31 will return 0.8.31 from getVersion_osgUtil.
* osgUtilGetVersion() returns the library version number.
* Numbering convention : osg_src-0.8-31 will return 0.8.31 from osgUtilGetVersion.
*
* This C function can be also used to check for the existence of the OpenSceneGraph
* library using autoconf and its m4 macro AC_CHECK_LIB.
@ -38,8 +38,8 @@ extern "C" {
extern OSGUTIL_EXPORT const char* osgUtilGetVersion();
/**
* getLibraryName_osgUtil() returns the library name in human friendly form.
*/
* osgUtilGetLibraryName() returns the library name in human friendly form.
*/
extern OSGUTIL_EXPORT const char* osgUtilGetLibraryName();
}