From Geoff Michel, typos and spelling fixes.

This commit is contained in:
Robert Osfield 2004-09-26 18:39:34 +00:00
parent be8476592e
commit 37c8b3a6fb
23 changed files with 281 additions and 273 deletions

View File

@ -40,7 +40,7 @@ namespace osgUtil
inline osg::Image *getImage(osg::TextureCubeMap::Face face); inline osg::Image *getImage(osg::TextureCubeMap::Face face);
inline const osg::Image *getImage(osg::TextureCubeMap::Face face) const; inline const osg::Image *getImage(osg::TextureCubeMap::Face face) const;
/** generate the six cube images. /** Generate the six cube images.
If use_osg_system is true, then the OSG's coordinate system is used instead If use_osg_system is true, then the OSG's coordinate system is used instead
of the default OpenGL one. of the default OpenGL one.
*/ */
@ -53,7 +53,7 @@ namespace osgUtil
inline void set_pixel(int index, int c, int r, const osg::Vec4 &color); inline void set_pixel(int index, int c, int r, const osg::Vec4 &color);
inline static osg::Vec4 vector_to_color(const osg::Vec3 &vec); inline static osg::Vec4 vector_to_color(const osg::Vec3 &vec);
/** override this method to define how colors are computed. /** Override this method to define how colors are computed.
The parameter R is the reflection vector, pointing from the center of the cube. The parameter R is the reflection vector, pointing from the center of the cube.
The return value should be the RGBA color associated with that reflection ray. The return value should be the RGBA color associated with that reflection ray.
*/ */

View File

@ -42,7 +42,7 @@ namespace osgUtil {
* This visitor traverses the scene graph, collecting transparent and * This visitor traverses the scene graph, collecting transparent and
* opaque osg::Drawables into a depth sorted transparent bin and a state * opaque osg::Drawables into a depth sorted transparent bin and a state
* sorted opaque bin. The opaque bin is rendered first, and then the * sorted opaque bin. The opaque bin is rendered first, and then the
* transparent bin in rendered in order from the furthest osg::Drawable * transparent bin is rendered in order from the furthest osg::Drawable
* from the eye to the one nearest the eye. * from the eye to the one nearest the eye.
*/ */
class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStack class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStack
@ -166,13 +166,14 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
/** Add a drawable and depth to current render graph.*/ /** Add a drawable and depth to current render graph.*/
inline void addDrawableAndDepth(osg::Drawable* drawable,osg::RefMatrix* matrix,float depth); inline void addDrawableAndDepth(osg::Drawable* drawable,osg::RefMatrix* matrix,float depth);
/** Add an attribute which is positioned related to the modelview matrix.*/ /** Add an attribute which is positioned relative to the modelview matrix.*/
inline void addPositionedAttribute(osg::RefMatrix* matrix,const osg::StateAttribute* attr); inline void addPositionedAttribute(osg::RefMatrix* matrix,const osg::StateAttribute* attr);
/** Add an attribute which is positioned related to the modelview matrix.*/ /** Add an attribute which is positioned relative to the modelview matrix.*/
inline void addPositionedTextureAttribute(unsigned int textureUnit, osg::RefMatrix* matrix,const osg::StateAttribute* attr); inline void addPositionedTextureAttribute(unsigned int textureUnit, osg::RefMatrix* matrix,const osg::StateAttribute* attr);
/** reimplement CullStack's popProjectionMatrix() adding clamping of the projection matrix to the computed near and far.*/ /** Re-implement CullStack's popProjectionMatrix() adding clamping of the projection matrix to
* the computed near and far.*/
virtual void popProjectionMatrix(); virtual void popProjectionMatrix();
@ -184,7 +185,8 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
* Note, do not call this method directly, use clampProjectionMatrix(..) instead, unless you want to bypass the callback.*/ * Note, do not call this method directly, use clampProjectionMatrix(..) instead, unless you want to bypass the callback.*/
virtual bool clampProjectionMatrixImplementation(osg::Matrixd& projection, double& znear, double& zfar) const; virtual bool clampProjectionMatrixImplementation(osg::Matrixd& projection, double& znear, double& zfar) const;
/** clamp the projection float matrix to computed near and far values, use callback if it exists, otherwise use default CullVisitro implemntation.*/ /** Clamp the projection float matrix to computed near and far values, use callback if it exists,
* otherwise use default CullVisitor implementation.*/
inline bool clampProjectionMatrix(osg::Matrixf& projection, value_type& znear, value_type& zfar) const inline bool clampProjectionMatrix(osg::Matrixf& projection, value_type& znear, value_type& zfar) const
{ {
double zn = znear; double zn = znear;
@ -203,7 +205,8 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
return false; return false;
} }
/** clamp the projection double matrix to computed near and far values, use callback if it exists, otherwise use default CullVisitro implemntation.*/ /** Clamp the projection double matrix to computed near and far values, use callback if it exists,
* otherwise use default CullVisitor implementation.*/
inline bool clampProjectionMatrix(osg::Matrixd& projection, value_type& znear, value_type& zfar) const inline bool clampProjectionMatrix(osg::Matrixd& projection, value_type& znear, value_type& zfar) const
{ {
double zn = znear; double zn = znear;
@ -230,10 +233,7 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
protected: protected:
// /** prevent unwanted copy construction.*/ /** Prevent unwanted copy operator.*/
// CullVisitor(const CullVisitor&): osg::NodeVisitor(), osg::CullStack() {}
/** prevent unwanted copy operator.*/
CullVisitor& operator = (const CullVisitor&) { return *this; } CullVisitor& operator = (const CullVisitor&) { return *this; }
inline void handle_cull_callbacks_and_traverse(osg::Node& node) inline void handle_cull_callbacks_and_traverse(osg::Node& node)
@ -251,7 +251,7 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
} }
/** create an impostor sprite by setting up a pre-rendering stage /** Create an impostor sprite by setting up a pre-rendering stage
* to generate the impostor texture. */ * to generate the impostor texture. */
osg::ImpostorSprite* createImpostorSprite(osg::Impostor& node); osg::ImpostorSprite* createImpostorSprite(osg::Impostor& node);
@ -347,13 +347,13 @@ inline void CullVisitor::addDrawableAndDepth(osg::Drawable* drawable,osg::RefMat
_currentRenderGraph->addLeaf(createOrReuseRenderLeaf(drawable,_projectionStack.back().get(),matrix,depth)); _currentRenderGraph->addLeaf(createOrReuseRenderLeaf(drawable,_projectionStack.back().get(),matrix,depth));
} }
/** Add an attribute which is positioned related to the modelview matrix.*/ /** Add an attribute which is positioned relative to the modelview matrix.*/
inline void CullVisitor::addPositionedAttribute(osg::RefMatrix* matrix,const osg::StateAttribute* attr) inline void CullVisitor::addPositionedAttribute(osg::RefMatrix* matrix,const osg::StateAttribute* attr)
{ {
_currentRenderBin->getStage()->addPositionedAttribute(matrix,attr); _currentRenderBin->getStage()->addPositionedAttribute(matrix,attr);
} }
/** Add an attribute which is positioned related to the modelview matrix.*/ /** Add an attribute which is positioned relative to the modelview matrix.*/
inline void CullVisitor::addPositionedTextureAttribute(unsigned int textureUnit, osg::RefMatrix* matrix,const osg::StateAttribute* attr) inline void CullVisitor::addPositionedTextureAttribute(unsigned int textureUnit, osg::RefMatrix* matrix,const osg::StateAttribute* attr)
{ {
_currentRenderBin->getStage()->addPositionedTextureAttribute(textureUnit,matrix,attr); _currentRenderBin->getStage()->addPositionedTextureAttribute(textureUnit,matrix,attr);
@ -361,7 +361,7 @@ inline void CullVisitor::addPositionedTextureAttribute(unsigned int textureUnit,
inline RenderLeaf* CullVisitor::createOrReuseRenderLeaf(osg::Drawable* drawable,osg::RefMatrix* projection,osg::RefMatrix* matrix, float depth) inline RenderLeaf* CullVisitor::createOrReuseRenderLeaf(osg::Drawable* drawable,osg::RefMatrix* projection,osg::RefMatrix* matrix, float depth)
{ {
// skip of any already reused renderleaf. // Skips any already reused renderleaf.
while (_currentReuseRenderLeafIndex<_reuseRenderLeafList.size() && while (_currentReuseRenderLeafIndex<_reuseRenderLeafList.size() &&
_reuseRenderLeafList[_currentReuseRenderLeafIndex]->referenceCount()>1) _reuseRenderLeafList[_currentReuseRenderLeafIndex]->referenceCount()>1)
{ {
@ -369,8 +369,7 @@ inline RenderLeaf* CullVisitor::createOrReuseRenderLeaf(osg::Drawable* drawable,
++_currentReuseRenderLeafIndex; ++_currentReuseRenderLeafIndex;
} }
// if still within list, element must be singularly referenced // If still within list, element must be singularly referenced then return it to be reused.
// there return it to be reused.
if (_currentReuseRenderLeafIndex<_reuseRenderLeafList.size()) if (_currentReuseRenderLeafIndex<_reuseRenderLeafList.size())
{ {
RenderLeaf* renderleaf = _reuseRenderLeafList[_currentReuseRenderLeafIndex++].get(); RenderLeaf* renderleaf = _reuseRenderLeafList[_currentReuseRenderLeafIndex++].get();
@ -378,7 +377,7 @@ inline RenderLeaf* CullVisitor::createOrReuseRenderLeaf(osg::Drawable* drawable,
return renderleaf; return renderleaf;
} }
// otherwise need to create new renderleaf. // Otherwise need to create new renderleaf.
RenderLeaf* renderleaf = new RenderLeaf(drawable,projection,matrix,depth); RenderLeaf* renderleaf = new RenderLeaf(drawable,projection,matrix,depth);
_reuseRenderLeafList.push_back(renderleaf); _reuseRenderLeafList.push_back(renderleaf);
++_currentReuseRenderLeafIndex; ++_currentReuseRenderLeafIndex;

View File

@ -25,7 +25,7 @@
namespace osgUtil namespace osgUtil
{ {
/** Utility class that triangulates an irregolar network of sample points. /** Utility class that triangulates an irregular network of sample points.
Just create a DelaunayTriangulator, assign it the sample point array and call Just create a DelaunayTriangulator, assign it the sample point array and call
its triangulate() method to start the triangulation. Then you can obtain the its triangulate() method to start the triangulation. Then you can obtain the
generated primitive by calling the getTriangles() method. generated primitive by calling the getTriangles() method.
@ -37,31 +37,31 @@ public:
explicit DelaunayTriangulator(osg::Vec3Array *points, osg::Vec3Array *normals = 0); explicit DelaunayTriangulator(osg::Vec3Array *points, osg::Vec3Array *normals = 0);
DelaunayTriangulator(const DelaunayTriangulator &copy, const osg::CopyOp &copyop = osg::CopyOp::SHALLOW_COPY); DelaunayTriangulator(const DelaunayTriangulator &copy, const osg::CopyOp &copyop = osg::CopyOp::SHALLOW_COPY);
/// Get the const input point array. /** Get the const input point array. */
inline const osg::Vec3Array *getInputPointArray() const; inline const osg::Vec3Array *getInputPointArray() const;
/// Get the input point array. /** Get the input point array. */
inline osg::Vec3Array *getInputPointArray(); inline osg::Vec3Array *getInputPointArray();
/// Set the input point array. /** Set the input point array. */
inline void setInputPointArray(osg::Vec3Array *points); inline void setInputPointArray(osg::Vec3Array *points);
/// Get the const output normal array (optional). /** Get the const output normal array (optional). */
inline const osg::Vec3Array *getOutputNormalArray() const; inline const osg::Vec3Array *getOutputNormalArray() const;
/// Get the output normal array (optional). /** Get the output normal array (optional). */
inline osg::Vec3Array *getOutputNormalArray(); inline osg::Vec3Array *getOutputNormalArray();
/// Set the output normal array (optional). /** Set the output normal array (optional). */
inline void setOutputNormalArray(osg::Vec3Array *normals); inline void setOutputNormalArray(osg::Vec3Array *normals);
/// Start triangulation. /** Start triangulation. */
bool triangulate(); bool triangulate();
/// Get the generated primitive (call triangulate() first). /** Get the generated primitive (call triangulate() first). */
inline const osg::DrawElementsUInt *getTriangles() const; inline const osg::DrawElementsUInt *getTriangles() const;
/// Get the generated primitive (call triangulate() first). /** Get the generated primitive (call triangulate() first). */
inline osg::DrawElementsUInt *getTriangles(); inline osg::DrawElementsUInt *getTriangles();
protected: protected:

View File

@ -22,16 +22,16 @@
namespace osgUtil { namespace osgUtil {
/** A visitor for traversing a scene graph establishing the OpenGL visuals are required /** A visitor for traversing a scene graph establishing which OpenGL visuals are
* to support rendering of that scene graph. The results can then be used by * required to support rendering of that scene graph. The results can then be used by
* applications to set up there windows with the correct visuals. Have a look at * applications to set up their windows with the correct visuals. Have a look at
* src/osgGLUT/Viewer.cpp's Viewer::open() method for an example how to use it. * src/osgGLUT/Viewer.cpp's Viewer::open() method for an example of how to use it.
*/ */
class OSGUTIL_EXPORT DisplayRequirementsVisitor : public osg::NodeVisitor class OSGUTIL_EXPORT DisplayRequirementsVisitor : public osg::NodeVisitor
{ {
public: public:
/** Default to traversing all children, and reqiresDoubleBuffer, /** Default to traversing all children, and requiresDoubleBuffer,
* requiresRGB and requiresDepthBuffer to true and with * requiresRGB and requiresDepthBuffer to true and with
* alpha and stencil off.*/ * alpha and stencil off.*/
DisplayRequirementsVisitor(); DisplayRequirementsVisitor();

View File

@ -43,7 +43,7 @@ class OSGUTIL_EXPORT GLObjectsVisitor : public osg::NodeVisitor
typedef unsigned int Mode; typedef unsigned int Mode;
/** Construct a GLObjectsVisior to traverse all child, operating on /** Construct a GLObjectsVisitor to traverse all children, operating on
* node according to specified mode, such as to compile or release * node according to specified mode, such as to compile or release
* display list/texture objects etc. Default mode is to compile * display list/texture objects etc. Default mode is to compile
* GL objects. * GL objects.

View File

@ -21,9 +21,9 @@ namespace osgUtil
{ {
/** This cube map generator produces an Half-way vector map, useful for /** This cube map generator produces an Half-way vector map, useful for
hardware-based specular lighting effects. * hardware-based specular lighting effects.
It computes: C = normalize(R - L), where C is the resulting color, * It computes: C = normalize(R - L), where C is the resulting color,
R is the reflection vector and L is the light direction. * R is the reflection vector and L is the light direction.
*/ */
class OSGUTIL_EXPORT HalfWayMapGenerator: public CubeMapGenerator { class OSGUTIL_EXPORT HalfWayMapGenerator: public CubeMapGenerator {
public: public:

View File

@ -21,9 +21,9 @@ namespace osgUtil
{ {
/** This cube map generator produces a specular highlight map. /** This cube map generator produces a specular highlight map.
The vector-color association is: C = (R dot (-L)) ^ n, where C is the * The vector-color association is: C = (R dot (-L)) ^ n, where C is the
resulting color, R is the reflection vector, L is the light direction * resulting color, R is the reflection vector, L is the light direction
and n is the specular exponent. * and n is the specular exponent.
*/ */
class OSGUTIL_EXPORT HighlightMapGenerator: public CubeMapGenerator { class OSGUTIL_EXPORT HighlightMapGenerator: public CubeMapGenerator {
public: public:

View File

@ -22,13 +22,13 @@
namespace osgUtil { namespace osgUtil {
/** Insert impostor nodes into scene graph. /** Insert impostor nodes into scene graph.
* For example of usage see src/Demos/osgimpostor. * For example of usage see examples/osgimpostor.
*/ */
class OSGUTIL_EXPORT InsertImpostorsVisitor : public osg::NodeVisitor class OSGUTIL_EXPORT InsertImpostorsVisitor : public osg::NodeVisitor
{ {
public: public:
/// default to traversing all children. /** Default to traversing all children. */
InsertImpostorsVisitor(); InsertImpostorsVisitor();
void setImpostorThresholdRatio(float ratio) { _impostorThresholdRatio = ratio; } void setImpostorThresholdRatio(float ratio) { _impostorThresholdRatio = ratio; }
@ -37,7 +37,7 @@ class OSGUTIL_EXPORT InsertImpostorsVisitor : public osg::NodeVisitor
void setMaximumNumberOfNestedImpostors(unsigned int num) { _maximumNumNestedImpostors = num; } void setMaximumNumberOfNestedImpostors(unsigned int num) { _maximumNumNestedImpostors = num; }
unsigned int getMaximumNumberOfNestedImpostors() const { return _maximumNumNestedImpostors; } unsigned int getMaximumNumberOfNestedImpostors() const { return _maximumNumNestedImpostors; }
/** empty visitor, make it ready for next traversal.*/ /** Empty visitor, make it ready for next traversal. */
void reset(); void reset();
virtual void apply(osg::Node& node); virtual void apply(osg::Node& node);
@ -48,7 +48,7 @@ class OSGUTIL_EXPORT InsertImpostorsVisitor : public osg::NodeVisitor
virtual void apply(osg::Impostor& node); virtual void apply(osg::Impostor& node);
/* insert the required impostors into the scene graph.*/ /* Insert the required impostors into the scene graph. */
void insertImpostors(); void insertImpostors();
protected: protected:

View File

@ -30,6 +30,12 @@ namespace osgUtil {
class OSGUTIL_EXPORT Hit class OSGUTIL_EXPORT Hit
{ {
/** Describes a point in space produced by an intersection of a line with a scene.
* A Hit is always on a surface as rendered by the Open Scene Graph scene (usually
* a triangle or other primitive, but a special hit handler could return a
* different value perhaps: a sphere shape might return a Hit on the true sphere
* rather than the approximate tesselated sphere rendered.
*/
public: public:
Hit(); Hit();
@ -85,7 +91,6 @@ class OSGUTIL_EXPORT IntersectVisitor : public osg::NodeVisitor
/** Add a line segment to use for intersection testing during scene traversal.*/ /** Add a line segment to use for intersection testing during scene traversal.*/
void addLineSegment(osg::LineSegment* seg); void addLineSegment(osg::LineSegment* seg);
//typedef std::multiset<Hit> HitList;
typedef std::vector<Hit> HitList; typedef std::vector<Hit> HitList;
typedef std::map<osg::LineSegment*,HitList > LineSegmentHitListMap; typedef std::map<osg::LineSegment*,HitList > LineSegmentHitListMap;
HitList& getHitList(osg::LineSegment* seg) { return _segHitList[seg]; } HitList& getHitList(osg::LineSegment* seg) { return _segHitList[seg]; }

View File

@ -25,8 +25,8 @@
namespace osgUtil { namespace osgUtil {
/** Insert impostor nodes into scene graph. /** Traverses scene graph to improve efficiency. See OptimizationOptions.
* For example of usage see src/Demos/osgimpostor. * For example of usage see examples/osgimpostor or osgviewer.
*/ */
class OSGUTIL_EXPORT Optimizer class OSGUTIL_EXPORT Optimizer
@ -69,50 +69,50 @@ class OSGUTIL_EXPORT Optimizer
OPTIMIZE_TEXTURE_SETTINGS OPTIMIZE_TEXTURE_SETTINGS
}; };
/** reset internal data to initial state - the getPrimissableOptionsMap is cleared.*/ /** Reset internal data to initial state - the getPermissibleOptionsMap is cleared.*/
void reset(); void reset();
/** traverse the node and its subgraph with a series of optimization /** Traverse the node and its subgraph with a series of optimization
* visitors, specificied by the OptizationOptions.*/ * visitors, specified by the OptimizationOptions.*/
void optimize(osg::Node* node); void optimize(osg::Node* node);
/** traverse the node and its subgraph with a series of optimization /** Traverse the node and its subgraph with a series of optimization
* visitors, specificied by the OptizationOptions.*/ * visitors, specified by the OptimizationOptions.*/
virtual void optimize(osg::Node* node, unsigned int options); virtual void optimize(osg::Node* node, unsigned int options);
inline void setPermissableOptimizationsForObject(const osg::Object* object, unsigned int options) inline void setPermissibleOptimizationsForObject(const osg::Object* object, unsigned int options)
{ {
_permissableOptimizationsMap[object] = options; _permissibleOptimizationsMap[object] = options;
} }
inline unsigned int getPermissableOptimizationsForObject(const osg::Object* object) const inline unsigned int getPermissibleOptimizationsForObject(const osg::Object* object) const
{ {
PermissableOptimizationsMap::const_iterator itr = _permissableOptimizationsMap.find(object); PermissibleOptimizationsMap::const_iterator itr = _permissibleOptimizationsMap.find(object);
if (itr!=_permissableOptimizationsMap.end()) return itr->second; if (itr!=_permissibleOptimizationsMap.end()) return itr->second;
else return 0xffffffff; else return 0xffffffff;
} }
inline bool isOperationPermissableForObject(const osg::Object* object,unsigned int option) const inline bool isOperationPermissibleForObject(const osg::Object* object,unsigned int option) const
{ {
return (option & getPermissableOptimizationsForObject(object))!=0; return (option & getPermissibleOptimizationsForObject(object))!=0;
} }
typedef std::map<const osg::Object*,unsigned int> PermissableOptimizationsMap; typedef std::map<const osg::Object*,unsigned int> PermissibleOptimizationsMap;
PermissableOptimizationsMap& getPrimissableOptionsMap() { return _permissableOptimizationsMap; } PermissibleOptimizationsMap& getPermissibleOptionsMap() { return _permissibleOptimizationsMap; }
const PermissableOptimizationsMap& getPrimissableOptionsMap() const { return _permissableOptimizationsMap; } const PermissibleOptimizationsMap& getPermissibleOptionsMap() const { return _permissibleOptimizationsMap; }
protected: protected:
PermissableOptimizationsMap _permissableOptimizationsMap; PermissibleOptimizationsMap _permissibleOptimizationsMap;
public: public:
/** Flatten Static Trasform nodes by applying their transform to the /** Flatten Static Transform nodes by applying their transform to the
* geometry on the leaves of the scene graph, then removing the * geometry on the leaves of the scene graph, then removing the
* now redundant transforms.*/ * now redundant transforms.*/
class OSGUTIL_EXPORT FlattenStaticTransformsVisitor : public osg::NodeVisitor class OSGUTIL_EXPORT FlattenStaticTransformsVisitor : public osg::NodeVisitor
@ -132,9 +132,9 @@ class OSGUTIL_EXPORT Optimizer
bool removeTransforms(osg::Node* nodeWeCannotRemove); bool removeTransforms(osg::Node* nodeWeCannotRemove);
inline bool isOperationPermissableForObject(const osg::Object* object) const inline bool isOperationPermissibleForObject(const osg::Object* object) const
{ {
return _optimizer ? _optimizer->isOperationPermissableForObject(object,FLATTEN_STATIC_TRANSFORMS) : true; return _optimizer ? _optimizer->isOperationPermissibleForObject(object,FLATTEN_STATIC_TRANSFORMS) : true;
} }
@ -155,7 +155,7 @@ class OSGUTIL_EXPORT Optimizer
}; };
/** Combine Static Trasform nodes that sit above on another.*/ /** Combine Static Transform nodes that sit above one another.*/
class OSGUTIL_EXPORT CombineStaticTransformsVisitor : public osg::NodeVisitor class OSGUTIL_EXPORT CombineStaticTransformsVisitor : public osg::NodeVisitor
{ {
public: public:
@ -168,9 +168,9 @@ class OSGUTIL_EXPORT Optimizer
bool removeTransforms(osg::Node* nodeWeCannotRemove); bool removeTransforms(osg::Node* nodeWeCannotRemove);
inline bool isOperationPermissableForObject(const osg::Object* object) const inline bool isOperationPermissibleForObject(const osg::Object* object) const
{ {
return _optimizer ? _optimizer->isOperationPermissableForObject(object,FLATTEN_STATIC_TRANSFORMS) : true; return _optimizer ? _optimizer->isOperationPermissibleForObject(object,FLATTEN_STATIC_TRANSFORMS) : true;
} }
protected: protected:
@ -198,9 +198,9 @@ class OSGUTIL_EXPORT Optimizer
void removeEmptyNodes(); void removeEmptyNodes();
inline bool isOperationPermissableForObject(const osg::Object* object) const inline bool isOperationPermissibleForObject(const osg::Object* object) const
{ {
return _optimizer ? _optimizer->isOperationPermissableForObject(object,REMOVE_REDUNDANT_NODES) : true; return _optimizer ? _optimizer->isOperationPermissibleForObject(object,REMOVE_REDUNDANT_NODES) : true;
} }
Optimizer* _optimizer; Optimizer* _optimizer;
@ -223,16 +223,15 @@ class OSGUTIL_EXPORT Optimizer
void removeRedundantNodes(); void removeRedundantNodes();
inline bool isOperationPermissableForObject(const osg::Object* object) const inline bool isOperationPermissibleForObject(const osg::Object* object) const
{ {
return _optimizer ? _optimizer->isOperationPermissableForObject(object,REMOVE_REDUNDANT_NODES) : true; return _optimizer ? _optimizer->isOperationPermissibleForObject(object,REMOVE_REDUNDANT_NODES) : true;
} }
Optimizer* _optimizer; Optimizer* _optimizer;
}; };
/** Tesselate all geodes, to remove POLYGONS /** Tesselate all geodes, to remove POLYGONS.*/
* complementary ranges.*/
class OSGUTIL_EXPORT TesselateVisitor : public osg::NodeVisitor class OSGUTIL_EXPORT TesselateVisitor : public osg::NodeVisitor
{ {
public: public:
@ -263,9 +262,9 @@ class OSGUTIL_EXPORT Optimizer
void combineLODs(); void combineLODs();
inline bool isOperationPermissableForObject(const osg::Object* object) const inline bool isOperationPermissibleForObject(const osg::Object* object) const
{ {
return _optimizer ? _optimizer->isOperationPermissableForObject(object,COMBINE_ADJACENT_LODS) : true; return _optimizer ? _optimizer->isOperationPermissibleForObject(object,COMBINE_ADJACENT_LODS) : true;
} }
Optimizer* _optimizer; Optimizer* _optimizer;
@ -292,9 +291,9 @@ class OSGUTIL_EXPORT Optimizer
void optimize(); void optimize();
inline bool isOperationPermissableForObject(const osg::Object* object) const inline bool isOperationPermissibleForObject(const osg::Object* object) const
{ {
return _optimizer ? _optimizer->isOperationPermissableForObject(object,SHARE_DUPLICATE_STATE) : true; return _optimizer ? _optimizer->isOperationPermissibleForObject(object,SHARE_DUPLICATE_STATE) : true;
} }
protected: protected:
@ -322,9 +321,9 @@ class OSGUTIL_EXPORT Optimizer
void checkGeode(osg::Geode& geode); void checkGeode(osg::Geode& geode);
inline bool isOperationPermissableForObject(const osg::Object* object) const inline bool isOperationPermissibleForObject(const osg::Object* object) const
{ {
return _optimizer ? _optimizer->isOperationPermissableForObject(object,CHECK_GEOMETRY) : true; return _optimizer ? _optimizer->isOperationPermissibleForObject(object,CHECK_GEOMETRY) : true;
} }
Optimizer* _optimizer; Optimizer* _optimizer;
@ -355,9 +354,9 @@ class OSGUTIL_EXPORT Optimizer
static bool mergePrimitive(osg::DrawElementsUShort& lhs,osg::DrawElementsUShort& rhs); static bool mergePrimitive(osg::DrawElementsUShort& lhs,osg::DrawElementsUShort& rhs);
static bool mergePrimitive(osg::DrawElementsUInt& lhs,osg::DrawElementsUInt& rhs); static bool mergePrimitive(osg::DrawElementsUInt& lhs,osg::DrawElementsUInt& rhs);
inline bool isOperationPermissableForObject(const osg::Object* object) const inline bool isOperationPermissibleForObject(const osg::Object* object) const
{ {
return _optimizer ? _optimizer->isOperationPermissableForObject(object,MERGE_GEOMETRY) : true; return _optimizer ? _optimizer->isOperationPermissibleForObject(object,MERGE_GEOMETRY) : true;
} }
Optimizer* _optimizer; Optimizer* _optimizer;
@ -381,9 +380,9 @@ class OSGUTIL_EXPORT Optimizer
typedef std::set<osg::Group*> GroupsToDivideList; typedef std::set<osg::Group*> GroupsToDivideList;
GroupsToDivideList _groupsToDivideList; GroupsToDivideList _groupsToDivideList;
inline bool isOperationPermissableForObject(const osg::Object* object) const inline bool isOperationPermissibleForObject(const osg::Object* object) const
{ {
return _optimizer ? _optimizer->isOperationPermissableForObject(object,SPATIALIZE_GROUPS) : true; return _optimizer ? _optimizer->isOperationPermissibleForObject(object,SPATIALIZE_GROUPS) : true;
} }
Optimizer* _optimizer; Optimizer* _optimizer;
@ -406,9 +405,9 @@ class OSGUTIL_EXPORT Optimizer
typedef std::set<osg::Node*> SharedNodeList; typedef std::set<osg::Node*> SharedNodeList;
SharedNodeList _sharedNodeList; SharedNodeList _sharedNodeList;
inline bool isOperationPermissableForObject(const osg::Object* object) const inline bool isOperationPermissibleForObject(const osg::Object* object) const
{ {
return _optimizer ? _optimizer->isOperationPermissableForObject(object,COPY_SHARED_NODES) : true; return _optimizer ? _optimizer->isOperationPermissibleForObject(object,COPY_SHARED_NODES) : true;
} }
Optimizer* _optimizer; Optimizer* _optimizer;
@ -437,9 +436,9 @@ class OSGUTIL_EXPORT Optimizer
void apply(osg::StateSet& stateset); void apply(osg::StateSet& stateset);
void apply(osg::Texture& texture); void apply(osg::Texture& texture);
inline bool isOperationPermissableForObject(const osg::Object* object) const inline bool isOperationPermissibleForObject(const osg::Object* object) const
{ {
return _optimizer ? _optimizer->isOperationPermissableForObject(object,OPTIMIZE_TEXTURE_SETTINGS) : true; return _optimizer ? _optimizer->isOperationPermissibleForObject(object,OPTIMIZE_TEXTURE_SETTINGS) : true;
} }
Optimizer* _optimizer; Optimizer* _optimizer;

View File

@ -25,7 +25,10 @@ namespace osgUtil {
class RenderStage; class RenderStage;
class Statistics; class Statistics;
/** /**
* RenderBin base class. * RenderBin base class. Renderbin contains geometries to be rendered as a group,
* renderbins are rendered once each. They can improve efficiency or
* use different rendering algorithms.
* A renderBin can contain further renderBins producing a tree hierarchy of renderBins.
*/ */
class OSGUTIL_EXPORT RenderBin : public osg::Object class OSGUTIL_EXPORT RenderBin : public osg::Object
{ {
@ -122,7 +125,7 @@ class OSGUTIL_EXPORT RenderBin : public osg::Object
DrawCallback* getDrawCallback() { return _drawCallback.get(); } DrawCallback* getDrawCallback() { return _drawCallback.get(); }
const DrawCallback* getDrawCallback() const { return _drawCallback.get(); } const DrawCallback* getDrawCallback() const { return _drawCallback.get(); }
/** extract stats for current draw list. */ /** Extract stats for current draw list. */
bool getStats(Statistics* primStats); bool getStats(Statistics* primStats);
void getPrims(Statistics* primStats); void getPrims(Statistics* primStats);
bool getPrims(Statistics* primStats, int nbin); bool getPrims(Statistics* primStats, int nbin);

View File

@ -36,6 +36,8 @@ struct LeafDepthSortFunctor
} }
}; };
/** RenderGraph - contained in a renderBin, defines the scene to be drawn.
*/
class OSGUTIL_EXPORT RenderGraph : public osg::Referenced class OSGUTIL_EXPORT RenderGraph : public osg::Referenced
{ {
public: public:
@ -139,14 +141,14 @@ class OSGUTIL_EXPORT RenderGraph : public osg::Referenced
std::sort(_leaves.begin(),_leaves.end(),LeafDepthSortFunctor()); std::sort(_leaves.begin(),_leaves.end(),LeafDepthSortFunctor());
} }
/** reset the internal contents of a RenderGraph, including deleting all children.*/ /** Reset the internal contents of a RenderGraph, including deleting all children.*/
void reset(); void reset();
/** recursively clean the RenderGraph of all its drawables, lights and depths. /** Recursively clean the RenderGraph of all its drawables, lights and depths.
* Leaves children intact, and ready to be populated again.*/ * Leaves children intact, and ready to be populated again.*/
void clean(); void clean();
/** recursively prune the RenderGraph of empty children.*/ /** Recursively prune the RenderGraph of empty children.*/
void prune(); void prune();

View File

@ -23,10 +23,10 @@
namespace osgUtil { namespace osgUtil {
// forward declare RenderGraph // Forward declare RenderGraph
class RenderGraph; class RenderGraph;
/** container class for all data required for rendering of drawables. /** Container class for all data required for rendering of drawables.
*/ */
class OSGUTIL_EXPORT RenderLeaf : public osg::Referenced class OSGUTIL_EXPORT RenderLeaf : public osg::Referenced
{ {
@ -59,10 +59,9 @@ class OSGUTIL_EXPORT RenderLeaf : public osg::Referenced
_depth = 0.0f; _depth = 0.0f;
} }
virtual void render(osg::State& state,RenderLeaf* previous); virtual void render(osg::State& state,RenderLeaf* previous);
/// allow RenderGraph to change the RenderLeaf's _parent. /// Allow RenderGraph to change the RenderLeaf's _parent.
friend class osgUtil::RenderGraph; friend class osgUtil::RenderGraph;
public: public:

View File

@ -23,7 +23,7 @@
namespace osgUtil { namespace osgUtil {
/** /**
* RenderState base class. Used for encapsulate a complete stage in * RenderStage base class. Used for encapsulate a complete stage in
* rendering - setting up of viewport, the projection and model * rendering - setting up of viewport, the projection and model
* matrices and rendering the RenderBin's enclosed with this RenderStage. * matrices and rendering the RenderBin's enclosed with this RenderStage.
* RenderStage also has a dependency list of other RenderStages, each * RenderStage also has a dependency list of other RenderStages, each
@ -81,7 +81,7 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin
/** Set the clear accum used in glClearAccum(..). /** Set the clear accum used in glClearAccum(..).
* glClearAcumm is only called if mask & GL_ACCUM_BUFFER_BIT is true*/ * glClearAcumm is only called if mask & GL_ACCUM_BUFFER_BIT is true. */
void setClearAccum(const osg::Vec4& color) { _clearAccum=color; } void setClearAccum(const osg::Vec4& color) { _clearAccum=color; }
/** Get the clear accum.*/ /** Get the clear accum.*/
@ -90,14 +90,14 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin
/** Set the clear depth used in glClearDepth(..). Defaults to 1.0 /** Set the clear depth used in glClearDepth(..). Defaults to 1.0
* glClearDepth is only called if mask & GL_DEPTH_BUFFER_BIT is true*/ * glClearDepth is only called if mask & GL_DEPTH_BUFFER_BIT is true. */
void setClearDepth(double depth) { _clearDepth=depth; } void setClearDepth(double depth) { _clearDepth=depth; }
/** Get the clear depth.*/ /** Get the clear depth.*/
double getClearDepth() const { return _clearDepth; } double getClearDepth() const { return _clearDepth; }
/** Set the clear stencil value used in glClearStencil(). Defaults to 0 /** Set the clear stencil value used in glClearStencil(). Defaults to 0;
* glClearStencil is only called if mask & GL_STENCIL_BUFFER_BIT is true*/ * glClearStencil is only called if mask & GL_STENCIL_BUFFER_BIT is true*/
void setClearStencil(int stencil) { _clearStencil=stencil; } void setClearStencil(int stencil) { _clearStencil=stencil; }
@ -130,7 +130,7 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin
void addToDependencyList(RenderStage* rs); void addToDependencyList(RenderStage* rs);
/** extract stats for current draw list. */ /** Extract stats for current draw list. */
bool getStats(Statistics* primStats); bool getStats(Statistics* primStats);
#ifndef USE_DEPRECATED_API #ifndef USE_DEPRECATED_API

View File

@ -24,7 +24,7 @@
namespace osgUtil { namespace osgUtil {
/** /**
* RenderBin base class. * RenderStageLighting base class. Used in RenderStage class.
*/ */
class OSGUTIL_EXPORT RenderStageLighting : public osg::Object class OSGUTIL_EXPORT RenderStageLighting : public osg::Object
{ {

View File

@ -27,8 +27,9 @@
namespace osgUtil { namespace osgUtil {
/** /**
* SceneView is literally a view of a scene, encapsulating the * SceneView is literally a view of a scene, encapsulating the 'camera'
* camera (modelview+projection matrices), global state, lights and the scene itself. Provides * (not to be confused with Producer::Camera) (modelview+projection matrices),
* global state, lights and the scene itself. Provides
* methods for setting up the view and rendering it. * methods for setting up the view and rendering it.
*/ */
class OSGUTIL_EXPORT SceneView : public osg::Referenced, public osg::CullSettings class OSGUTIL_EXPORT SceneView : public osg::Referenced, public osg::CullSettings
@ -53,11 +54,11 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced, public osg::CullSetting
*/ */
void setDefaults(unsigned int options = STANDARD_SETTINGS); void setDefaults(unsigned int options = STANDARD_SETTINGS);
/** Set the data which to view. The data will typically be /** Set the data to view. The data will typically be
* an osg::Scene but can be any osg::Node type. * an osg::Scene but can be any osg::Node type.
*/ */
void setSceneData(osg::Node* node) { _sceneData = node; } void setSceneData(osg::Node* node) { _sceneData = node; }
/** Get the scene data which to view. The data will typically be /** Get the scene data to view. The data will typically be
* an osg::Scene but can be any osg::Node type. * an osg::Scene but can be any osg::Node type.
*/ */
osg::Node* getSceneData() { return _sceneData.get(); } osg::Node* getSceneData() { return _sceneData.get(); }
@ -67,7 +68,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced, public osg::CullSetting
*/ */
const osg::Node* getSceneData() const { return _sceneData.get(); } const osg::Node* getSceneData() const { return _sceneData.get(); }
/** Set the viewport of the scene view to use specfied osg::Viewport. */ /** Set the viewport of the scene view to use specified osg::Viewport. */
void setViewport(osg::Viewport* viewport) void setViewport(osg::Viewport* viewport)
{ {
if (viewport) _viewport = viewport; if (viewport) _viewport = viewport;
@ -118,7 +119,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced, public osg::CullSetting
/** Set the color used in glClearColor(). /** Set the color used in glClearColor().
Defaults to an off blue color.*/ Defaults to an off blue color.*/
void setClearColor(const osg::Vec4& color) { _clearColor=color; } void setClearColor(const osg::Vec4& color) { _clearColor=color; }
/** Get the color usinged in glClearColor.*/ /** Get the color used in glClearColor.*/
const osg::Vec4& getClearColor() const { return _clearColor; } const osg::Vec4& getClearColor() const { return _clearColor; }
@ -152,7 +153,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced, public osg::CullSetting
/** Set the projection matrix. Can be thought of as setting the lens of a camera. */ /** Set the projection matrix. Can be thought of as setting the lens of a camera. */
inline void setProjectionMatrix(const osg::Matrixd& matrix) { _projectionMatrix.set(matrix); } inline void setProjectionMatrix(const osg::Matrixd& matrix) { _projectionMatrix.set(matrix); }
/** Set to a orthographic projection. See OpenGL glOrtho for documentation further details.*/ /** Set to an orthographic projection. See OpenGL glOrtho for documentation further details.*/
void setProjectionMatrixAsOrtho(double left, double right, void setProjectionMatrixAsOrtho(double left, double right,
double bottom, double top, double bottom, double top,
double zNear, double zFar); double zNear, double zFar);
@ -177,7 +178,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced, public osg::CullSetting
/** Get the const projection matrix.*/ /** Get the const projection matrix.*/
const osg::Matrixd& getProjectionMatrix() const { return _projectionMatrix; } const osg::Matrixd& getProjectionMatrix() const { return _projectionMatrix; }
/** Get the othorgraphic settings of the orthographic projection matrix. /** Get the othographic settings of the orthographic projection matrix.
* Returns false if matrix is not an orthographic matrix, where parameter values are undefined.*/ * Returns false if matrix is not an orthographic matrix, where parameter values are undefined.*/
bool getProjectionMatrixAsOrtho(double& left, double& right, bool getProjectionMatrixAsOrtho(double& left, double& right,
double& bottom, double& top, double& bottom, double& top,
@ -189,11 +190,11 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced, public osg::CullSetting
double& bottom, double& top, double& bottom, double& top,
double& zNear, double& zFar); double& zNear, double& zFar);
/** Get the frustum setting of a symetric perspective projection matrix. /** Get the frustum setting of a symmetric perspective projection matrix.
* Returns false if matrix is not a perspective matrix, where parameter values are undefined. * Returns false if matrix is not a perspective matrix, where parameter values are undefined.
* Note, if matrix is not a symetric perspective matrix then the shear will be lost. * Note, if matrix is not a symmetric perspective matrix then the shear will be lost.
* Asymetric metrices occur when stereo, power walls, caves and reality center display are used. * Asymmetric matrices occur when stereo, power walls, caves and reality center display are used.
* In these configuration one should use the AsFrustum method instead.*/ * In these configurations one should use the 'getProjectionMatrixAsFrustum' method instead.*/
bool getProjectionMatrixAsPerspective(double& fovy,double& aspectRatio, bool getProjectionMatrixAsPerspective(double& fovy,double& aspectRatio,
double& zNear, double& zFar); double& zNear, double& zFar);
@ -308,13 +309,13 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced, public osg::CullSetting
float getFusionDistanceValue() const { return _fusionDistanceValue; } float getFusionDistanceValue() const { return _fusionDistanceValue; }
/** set whether the draw method should call renderer->prioritizeTexture.*/ /** Set whether the draw method should call renderer->prioritizeTexture.*/
void setPrioritizeTextures(bool pt) { _prioritizeTextures = pt; } void setPrioritizeTextures(bool pt) { _prioritizeTextures = pt; }
/** get whether the draw method should call renderer->prioritizeTexture.*/ /** Get whether the draw method should call renderer->prioritizeTexture.*/
bool getPrioritizeTextures() const { return _prioritizeTextures; } bool getPrioritizeTextures() const { return _prioritizeTextures; }
/** callback for overidding the default method for compute the offset projection and view matrices.*/ /** Callback for overidding the default method for compute the offset projection and view matrices.*/
struct ComputeStereoMatricesCallback : public osg::Referenced struct ComputeStereoMatricesCallback : public osg::Referenced
{ {
virtual osg::Matrixd computeLeftEyeProjection(const osg::Matrixd& projection) const = 0; virtual osg::Matrixd computeLeftEyeProjection(const osg::Matrixd& projection) const = 0;
@ -349,7 +350,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced, public osg::CullSetting
Note, current implementation requires that SceneView::draw() has been previously called Note, current implementation requires that SceneView::draw() has been previously called
for projectWindowIntoObject to produce valid values. Consistent with OpenGL for projectWindowIntoObject to produce valid values. Consistent with OpenGL
windows coordinates are calculated relative to the bottom left of the window, windows coordinates are calculated relative to the bottom left of the window,
whereas as window API's normally have the top left as the origin, whereas window API's normally have the top left as the origin,
so you may need to pass in (mouseX,window_height-mouseY,...). so you may need to pass in (mouseX,window_height-mouseY,...).
Returns true on successful projection. Returns true on successful projection.
*/ */
@ -359,7 +360,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced, public osg::CullSetting
/** Set the frame stamp for the current frame.*/ /** Set the frame stamp for the current frame.*/
inline void setFrameStamp(osg::FrameStamp* fs) { _frameStamp = fs; } inline void setFrameStamp(osg::FrameStamp* fs) { _frameStamp = fs; }
/** Set the frame stamp for the current frame.*/ /** Get the frame stamp for the current frame.*/
inline const osg::FrameStamp* getFrameStamp() const { return _frameStamp.get(); } inline const osg::FrameStamp* getFrameStamp() const { return _frameStamp.get(); }
@ -399,7 +400,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced, public osg::CullSetting
/** Do init traversal of attached scene graph using Init NodeVisitor. /** Do init traversal of attached scene graph using Init NodeVisitor.
* The init traversal is called once for each SceneView, and should * The init traversal is called once for each SceneView, and should
* be used to compile display list, texture objects intialize data * be used to compile display list, texture objects intialize data
* not otherwise intializaed during scene graph loading. Note, is * not otherwise intialized during scene graph loading. Note, is
* called automatically by update & cull if it hasn't already been called * called automatically by update & cull if it hasn't already been called
* elsewhere. Also init() should only ever be called within a valid * elsewhere. Also init() should only ever be called within a valid
* graphics context.*/ * graphics context.*/

View File

@ -81,9 +81,9 @@ class OSGUTIL_EXPORT TriStripVisitor : public osg::NodeVisitor
return _minStripSize; return _minStripSize;
} }
inline bool isOperationPermissableForObject(const osg::Object* object) const inline bool isOperationPermissibleForObject(const osg::Object* object) const
{ {
return _optimizer ? _optimizer->isOperationPermissableForObject(object,osgUtil::Optimizer::TRISTRIP_GEOMETRY) : true; return _optimizer ? _optimizer->isOperationPermissibleForObject(object,osgUtil::Optimizer::TRISTRIP_GEOMETRY) : true;
} }
void setGenerateFourPointPrimitivesQuads(bool flag) { _generateFourPointPrimitivesQuads = flag; } void setGenerateFourPointPrimitivesQuads(bool flag) { _generateFourPointPrimitivesQuads = flag; }

View File

@ -54,7 +54,7 @@ static bool isNodeEmpty(const osg::Node& node)
void Optimizer::reset() void Optimizer::reset()
{ {
_permissableOptimizationsMap.clear(); _permissibleOptimizationsMap.clear();
} }
static osg::ApplicationUsageProxy Optimizer_e0(osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_OPTIMIZER \"<type> [<type>]\"","OFF | DEFAULT | FLATTEN_STATIC_TRANSFORMS | REMOVE_REDUNDANT_NODES | COMBINE_ADJACENT_LODS | SHARE_DUPLICATE_STATE | MERGE_GEOMETRY | SPATIALIZE_GROUPS | COPY_SHARED_NODES | TRISTRIP_GEOMETRY | OPTIMIZE_TEXTURE_SETTINGS"); static osg::ApplicationUsageProxy Optimizer_e0(osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_OPTIMIZER \"<type> [<type>]\"","OFF | DEFAULT | FLATTEN_STATIC_TRANSFORMS | REMOVE_REDUNDANT_NODES | COMBINE_ADJACENT_LODS | SHARE_DUPLICATE_STATE | MERGE_GEOMETRY | SPATIALIZE_GROUPS | COPY_SHARED_NODES | TRISTRIP_GEOMETRY | OPTIMIZE_TEXTURE_SETTINGS");
@ -293,8 +293,8 @@ void Optimizer::StateVisitor::apply(osg::Node& node)
osg::StateSet* ss = node.getStateSet(); osg::StateSet* ss = node.getStateSet();
if (ss && ss->getDataVariance()==osg::Object::STATIC) if (ss && ss->getDataVariance()==osg::Object::STATIC)
{ {
if (isOperationPermissableForObject(&node) && if (isOperationPermissibleForObject(&node) &&
isOperationPermissableForObject(ss)) isOperationPermissibleForObject(ss))
{ {
addStateSet(ss,&node); addStateSet(ss,&node);
} }
@ -305,14 +305,14 @@ void Optimizer::StateVisitor::apply(osg::Node& node)
void Optimizer::StateVisitor::apply(osg::Geode& geode) void Optimizer::StateVisitor::apply(osg::Geode& geode)
{ {
if (!isOperationPermissableForObject(&geode)) return; if (!isOperationPermissibleForObject(&geode)) return;
osg::StateSet* ss = geode.getStateSet(); osg::StateSet* ss = geode.getStateSet();
if (ss && ss->getDataVariance()==osg::Object::STATIC) if (ss && ss->getDataVariance()==osg::Object::STATIC)
{ {
if (isOperationPermissableForObject(ss)) if (isOperationPermissibleForObject(ss))
{ {
addStateSet(ss,&geode); addStateSet(ss,&geode);
} }
@ -325,8 +325,8 @@ void Optimizer::StateVisitor::apply(osg::Geode& geode)
ss = drawable->getStateSet(); ss = drawable->getStateSet();
if (ss && ss->getDataVariance()==osg::Object::STATIC) if (ss && ss->getDataVariance()==osg::Object::STATIC)
{ {
if (isOperationPermissableForObject(drawable) && if (isOperationPermissibleForObject(drawable) &&
isOperationPermissableForObject(ss)) isOperationPermissibleForObject(ss))
{ {
addStateSet(ss,drawable); addStateSet(ss,drawable);
} }
@ -585,7 +585,7 @@ class CollectLowestTransformsVisitor : public osg::NodeVisitor
void disableTransform(osg::Transform* transform); void disableTransform(osg::Transform* transform);
bool removeTransforms(osg::Node* nodeWeCannotRemove); bool removeTransforms(osg::Node* nodeWeCannotRemove);
inline bool isOperationPermissableForObject(const osg::Object* object) inline bool isOperationPermissibleForObject(const osg::Object* object)
{ {
// disable if cannot apply transform functor. // disable if cannot apply transform functor.
const osg::Drawable* drawable = dynamic_cast<const osg::Drawable*>(object); const osg::Drawable* drawable = dynamic_cast<const osg::Drawable*>(object);
@ -594,7 +594,7 @@ class CollectLowestTransformsVisitor : public osg::NodeVisitor
// disable if object is a light point node. // disable if object is a light point node.
if (strcmp(object->className(),"LightPointNode")==0) return false; if (strcmp(object->className(),"LightPointNode")==0) return false;
return _optimizer ? _optimizer->isOperationPermissableForObject(object,Optimizer::FLATTEN_STATIC_TRANSFORMS) : true; return _optimizer ? _optimizer->isOperationPermissibleForObject(object,Optimizer::FLATTEN_STATIC_TRANSFORMS) : true;
} }
protected: protected:
@ -831,7 +831,7 @@ void CollectLowestTransformsVisitor::setUpMaps()
ObjectStruct& os = oitr->second; ObjectStruct& os = oitr->second;
if (os._canBeApplied) if (os._canBeApplied)
{ {
if (os._moreThanOneMatrixRequired || !isOperationPermissableForObject(object)) if (os._moreThanOneMatrixRequired || !isOperationPermissibleForObject(object))
{ {
disableObject(oitr); disableObject(oitr);
} }
@ -1151,7 +1151,7 @@ void Optimizer::RemoveRedundantNodesVisitor::apply(osg::Group& group)
{ {
if (group.getNumParents()>0 && group.getNumChildren()<=1) if (group.getNumParents()>0 && group.getNumChildren()<=1)
{ {
if (isNodeEmpty(group) && isOperationPermissableForObject(&group)) if (isNodeEmpty(group) && isOperationPermissibleForObject(&group))
{ {
_redundantNodeList.insert(&group); _redundantNodeList.insert(&group);
} }
@ -1165,7 +1165,7 @@ void Optimizer::RemoveRedundantNodesVisitor::apply(osg::Transform& transform)
{ {
if (transform.getNumParents()>0 && if (transform.getNumParents()>0 &&
transform.getDataVariance()==osg::Object::STATIC && transform.getDataVariance()==osg::Object::STATIC &&
isOperationPermissableForObject(&transform)) isOperationPermissibleForObject(&transform))
{ {
static osg::Matrix identity; static osg::Matrix identity;
osg::Matrix matrix; osg::Matrix matrix;
@ -1224,7 +1224,7 @@ void Optimizer::CombineLODsVisitor::apply(osg::LOD& lod)
{ {
if (typeid(*lod.getParent(i))==typeid(osg::Group)) if (typeid(*lod.getParent(i))==typeid(osg::Group))
{ {
if (isOperationPermissableForObject(&lod)) if (isOperationPermissibleForObject(&lod))
{ {
_groupList.insert(lod.getParent(i)); _groupList.insert(lod.getParent(i));
} }
@ -1448,12 +1448,12 @@ struct LessGeometryPrimitiveType
void Optimizer::CheckGeometryVisitor::checkGeode(osg::Geode& geode) void Optimizer::CheckGeometryVisitor::checkGeode(osg::Geode& geode)
{ {
if (isOperationPermissableForObject(&geode)) if (isOperationPermissibleForObject(&geode))
{ {
for(unsigned int i=0;i<geode.getNumDrawables();++i) for(unsigned int i=0;i<geode.getNumDrawables();++i)
{ {
osg::Geometry* geom = geode.getDrawable(i)->asGeometry(); osg::Geometry* geom = geode.getDrawable(i)->asGeometry();
if (geom && isOperationPermissableForObject(geom)) if (geom && isOperationPermissibleForObject(geom))
{ {
geom->computeCorrectBindingsAndArraySizes(); geom->computeCorrectBindingsAndArraySizes();
} }
@ -1463,7 +1463,7 @@ void Optimizer::CheckGeometryVisitor::checkGeode(osg::Geode& geode)
bool Optimizer::MergeGeometryVisitor::mergeGeode(osg::Geode& geode) bool Optimizer::MergeGeometryVisitor::mergeGeode(osg::Geode& geode)
{ {
if (!isOperationPermissableForObject(&geode)) return false; if (!isOperationPermissibleForObject(&geode)) return false;
#if 1 #if 1
@ -1984,7 +1984,7 @@ void Optimizer::SpatializeGroupsVisitor::apply(osg::Group& group)
{ {
if (typeid(group)==typeid(osg::Group) || group.asTransform()) if (typeid(group)==typeid(osg::Group) || group.asTransform())
{ {
if (isOperationPermissableForObject(&group)) if (isOperationPermissibleForObject(&group))
{ {
_groupsToDivideList.insert(&group); _groupsToDivideList.insert(&group);
} }
@ -2173,7 +2173,7 @@ bool Optimizer::SpatializeGroupsVisitor::divide(osg::Group* group, unsigned int
void Optimizer::CopySharedSubgraphsVisitor::apply(osg::Node& node) void Optimizer::CopySharedSubgraphsVisitor::apply(osg::Node& node)
{ {
if (node.getNumParents()>1 && !isOperationPermissableForObject(&node)) if (node.getNumParents()>1 && !isOperationPermissibleForObject(&node))
{ {
_sharedNodeList.insert(&node); _sharedNodeList.insert(&node);
} }
@ -2215,8 +2215,8 @@ void Optimizer::TextureVisitor::apply(osg::Node& node)
osg::StateSet* ss = node.getStateSet(); osg::StateSet* ss = node.getStateSet();
if (ss && if (ss &&
isOperationPermissableForObject(&node) && isOperationPermissibleForObject(&node) &&
isOperationPermissableForObject(ss)) isOperationPermissibleForObject(ss))
{ {
apply(*ss); apply(*ss);
} }
@ -2226,11 +2226,11 @@ void Optimizer::TextureVisitor::apply(osg::Node& node)
void Optimizer::TextureVisitor::apply(osg::Geode& geode) void Optimizer::TextureVisitor::apply(osg::Geode& geode)
{ {
if (!isOperationPermissableForObject(&geode)) return; if (!isOperationPermissibleForObject(&geode)) return;
osg::StateSet* ss = geode.getStateSet(); osg::StateSet* ss = geode.getStateSet();
if (ss && isOperationPermissableForObject(ss)) if (ss && isOperationPermissibleForObject(ss))
{ {
apply(*ss); apply(*ss);
} }
@ -2242,8 +2242,8 @@ void Optimizer::TextureVisitor::apply(osg::Geode& geode)
{ {
ss = drawable->getStateSet(); ss = drawable->getStateSet();
if (ss && if (ss &&
isOperationPermissableForObject(drawable) && isOperationPermissibleForObject(drawable) &&
isOperationPermissableForObject(ss)) isOperationPermissibleForObject(ss))
{ {
apply(*ss); apply(*ss);
} }
@ -2257,7 +2257,7 @@ void Optimizer::TextureVisitor::apply(osg::StateSet& stateset)
{ {
osg::StateAttribute* sa = stateset.getTextureAttribute(i,osg::StateAttribute::TEXTURE); osg::StateAttribute* sa = stateset.getTextureAttribute(i,osg::StateAttribute::TEXTURE);
osg::Texture* texture = dynamic_cast<osg::Texture*>(sa); osg::Texture* texture = dynamic_cast<osg::Texture*>(sa);
if (texture && isOperationPermissableForObject(texture)) if (texture && isOperationPermissibleForObject(texture))
{ {
apply(*texture); apply(*texture);
} }

View File

@ -168,7 +168,7 @@ void RenderBin::sortByState()
{ {
// actually we'll do nothing right now, as fine grained sorting by state // actually we'll do nothing right now, as fine grained sorting by state
// appears to cost more to do than it saves in draw. The contents of // appears to cost more to do than it saves in draw. The contents of
// the RenderGraph leaves is already coasrse grained sorted, this // the RenderGraph leaves is already coarse grained sorted, this
// sorting is as a function of the cull traversal. // sorting is as a function of the cull traversal.
// cout << "doing sortByState "<<this<<endl; // cout << "doing sortByState "<<this<<endl;
} }