From Geoff Michel, typos and spelling fixes.
This commit is contained in:
parent
be8476592e
commit
37c8b3a6fb
@ -30,7 +30,7 @@ namespace osgUtil
|
||||
|
||||
/** This is the base class for cube map generators.
|
||||
It exposes the necessary interface to access the six generated images;
|
||||
descendants should only override the compute_color() method.
|
||||
descendants should only override the compute_color() method.
|
||||
*/
|
||||
class OSGUTIL_EXPORT CubeMapGenerator: public osg::Referenced {
|
||||
public:
|
||||
@ -40,7 +40,7 @@ namespace osgUtil
|
||||
inline osg::Image *getImage(osg::TextureCubeMap::Face face);
|
||||
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
|
||||
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 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 return value should be the RGBA color associated with that reflection ray.
|
||||
*/
|
||||
|
@ -42,7 +42,7 @@ namespace osgUtil {
|
||||
* This visitor traverses the scene graph, collecting transparent and
|
||||
* opaque osg::Drawables into a depth sorted transparent bin and a state
|
||||
* 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.
|
||||
*/
|
||||
class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStack
|
||||
@ -154,25 +154,26 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
|
||||
|
||||
value_type computeNearestPointInFrustum(const osg::Matrix& matrix, const osg::Polytope::PlaneList& planes,const osg::Drawable& drawable);
|
||||
|
||||
bool updateCalculatedNearFar(const osg::Matrix& matrix,const osg::BoundingBox& bb);
|
||||
bool updateCalculatedNearFar(const osg::Matrix& matrix,const osg::BoundingBox& bb);
|
||||
|
||||
bool updateCalculatedNearFar(const osg::Matrix& matrix,const osg::Drawable& drawable, bool isBillboard=false);
|
||||
bool updateCalculatedNearFar(const osg::Matrix& matrix,const osg::Drawable& drawable, bool isBillboard=false);
|
||||
|
||||
void updateCalculatedNearFar(const osg::Vec3& pos);
|
||||
|
||||
void updateCalculatedNearFar(const osg::Vec3& pos);
|
||||
|
||||
/** Add a drawable to current render graph.*/
|
||||
inline void addDrawable(osg::Drawable* drawable,osg::RefMatrix* matrix);
|
||||
|
||||
/** Add a drawable and depth to current render graph.*/
|
||||
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);
|
||||
|
||||
/** 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);
|
||||
|
||||
/** 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();
|
||||
|
||||
|
||||
@ -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.*/
|
||||
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
|
||||
{
|
||||
double zn = znear;
|
||||
@ -203,7 +205,8 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
|
||||
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
|
||||
{
|
||||
double zn = znear;
|
||||
@ -230,10 +233,7 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
|
||||
|
||||
protected:
|
||||
|
||||
// /** prevent unwanted copy construction.*/
|
||||
// CullVisitor(const CullVisitor&): osg::NodeVisitor(), osg::CullStack() {}
|
||||
|
||||
/** prevent unwanted copy operator.*/
|
||||
/** Prevent unwanted copy operator.*/
|
||||
CullVisitor& operator = (const CullVisitor&) { return *this; }
|
||||
|
||||
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. */
|
||||
osg::ImpostorSprite* createImpostorSprite(osg::Impostor& node);
|
||||
|
||||
@ -268,11 +268,11 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
|
||||
value_type _computed_zfar;
|
||||
|
||||
|
||||
typedef std::vector< osg::ref_ptr<RenderLeaf> > RenderLeafList;
|
||||
RenderLeafList _reuseRenderLeafList;
|
||||
unsigned int _currentReuseRenderLeafIndex;
|
||||
|
||||
inline RenderLeaf* createOrReuseRenderLeaf(osg::Drawable* drawable,osg::RefMatrix* projection,osg::RefMatrix* matrix, float depth=0.0f);
|
||||
typedef std::vector< osg::ref_ptr<RenderLeaf> > RenderLeafList;
|
||||
RenderLeafList _reuseRenderLeafList;
|
||||
unsigned int _currentReuseRenderLeafIndex;
|
||||
|
||||
inline RenderLeaf* createOrReuseRenderLeaf(osg::Drawable* drawable,osg::RefMatrix* projection,osg::RefMatrix* matrix, float depth=0.0f);
|
||||
|
||||
osg::ref_ptr<osg::ImpostorSpriteManager> _impostorSpriteManager;
|
||||
|
||||
@ -317,7 +317,7 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
|
||||
|
||||
typedef std::multimap<value_type, MatrixPlanesDrawables> DistanceMatrixDrawableMap;
|
||||
DistanceMatrixDrawableMap _nearPlaneCandidateMap;
|
||||
|
||||
|
||||
};
|
||||
|
||||
inline void CullVisitor::addDrawable(osg::Drawable* drawable,osg::RefMatrix* matrix)
|
||||
@ -347,13 +347,13 @@ inline void CullVisitor::addDrawableAndDepth(osg::Drawable* drawable,osg::RefMat
|
||||
_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)
|
||||
{
|
||||
_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)
|
||||
{
|
||||
_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)
|
||||
{
|
||||
// skip of any already reused renderleaf.
|
||||
// Skips any already reused renderleaf.
|
||||
while (_currentReuseRenderLeafIndex<_reuseRenderLeafList.size() &&
|
||||
_reuseRenderLeafList[_currentReuseRenderLeafIndex]->referenceCount()>1)
|
||||
{
|
||||
@ -369,8 +369,7 @@ inline RenderLeaf* CullVisitor::createOrReuseRenderLeaf(osg::Drawable* drawable,
|
||||
++_currentReuseRenderLeafIndex;
|
||||
}
|
||||
|
||||
// if still within list, element must be singularly referenced
|
||||
// there return it to be reused.
|
||||
// If still within list, element must be singularly referenced then return it to be reused.
|
||||
if (_currentReuseRenderLeafIndex<_reuseRenderLeafList.size())
|
||||
{
|
||||
RenderLeaf* renderleaf = _reuseRenderLeafList[_currentReuseRenderLeafIndex++].get();
|
||||
@ -378,7 +377,7 @@ inline RenderLeaf* CullVisitor::createOrReuseRenderLeaf(osg::Drawable* drawable,
|
||||
return renderleaf;
|
||||
}
|
||||
|
||||
// otherwise need to create new renderleaf.
|
||||
// Otherwise need to create new renderleaf.
|
||||
RenderLeaf* renderleaf = new RenderLeaf(drawable,projection,matrix,depth);
|
||||
_reuseRenderLeafList.push_back(renderleaf);
|
||||
++_currentReuseRenderLeafIndex;
|
||||
|
@ -25,7 +25,7 @@
|
||||
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
|
||||
its triangulate() method to start the triangulation. Then you can obtain the
|
||||
generated primitive by calling the getTriangles() method.
|
||||
@ -37,31 +37,31 @@ public:
|
||||
explicit DelaunayTriangulator(osg::Vec3Array *points, osg::Vec3Array *normals = 0);
|
||||
DelaunayTriangulator(const DelaunayTriangulator ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY);
|
||||
|
||||
/// Get the const input point array.
|
||||
/** Get the const input point array. */
|
||||
inline const osg::Vec3Array *getInputPointArray() const;
|
||||
|
||||
/// Get the input point array.
|
||||
/** Get the input point array. */
|
||||
inline osg::Vec3Array *getInputPointArray();
|
||||
|
||||
/// Set the input point array.
|
||||
/** Set the input point array. */
|
||||
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;
|
||||
|
||||
/// Get the output normal array (optional).
|
||||
/** Get the output normal array (optional). */
|
||||
inline osg::Vec3Array *getOutputNormalArray();
|
||||
|
||||
/// Set the output normal array (optional).
|
||||
/** Set the output normal array (optional). */
|
||||
inline void setOutputNormalArray(osg::Vec3Array *normals);
|
||||
|
||||
/// Start triangulation.
|
||||
/** Start triangulation. */
|
||||
bool triangulate();
|
||||
|
||||
/// Get the generated primitive (call triangulate() first).
|
||||
/** Get the generated primitive (call triangulate() first). */
|
||||
inline const osg::DrawElementsUInt *getTriangles() const;
|
||||
|
||||
/// Get the generated primitive (call triangulate() first).
|
||||
/** Get the generated primitive (call triangulate() first). */
|
||||
inline osg::DrawElementsUInt *getTriangles();
|
||||
|
||||
protected:
|
||||
|
@ -22,16 +22,16 @@
|
||||
|
||||
namespace osgUtil {
|
||||
|
||||
/** A visitor for traversing a scene graph establishing the OpenGL visuals are 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
|
||||
* src/osgGLUT/Viewer.cpp's Viewer::open() method for an example how to use it.
|
||||
/** A visitor for traversing a scene graph establishing which OpenGL visuals are
|
||||
* required to support rendering of that scene graph. The results can then be used by
|
||||
* 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 of how to use it.
|
||||
*/
|
||||
class OSGUTIL_EXPORT DisplayRequirementsVisitor : public osg::NodeVisitor
|
||||
{
|
||||
public:
|
||||
|
||||
/** Default to traversing all children, and reqiresDoubleBuffer,
|
||||
/** Default to traversing all children, and requiresDoubleBuffer,
|
||||
* requiresRGB and requiresDepthBuffer to true and with
|
||||
* alpha and stencil off.*/
|
||||
DisplayRequirementsVisitor();
|
||||
|
@ -26,13 +26,13 @@
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__) || defined( __BCPLUSPLUS__) || defined( __MWERKS__)
|
||||
# ifdef OSGUTIL_LIBRARY
|
||||
# define OSGUTIL_EXPORT __declspec(dllexport)
|
||||
# else
|
||||
# define OSGUTIL_EXPORT __declspec(dllimport)
|
||||
#endif /* OSGUTIL_LIBRARY */
|
||||
# ifdef OSGUTIL_LIBRARY
|
||||
# define OSGUTIL_EXPORT __declspec(dllexport)
|
||||
# else
|
||||
# define OSGUTIL_EXPORT __declspec(dllimport)
|
||||
#endif /* OSGUTIL_LIBRARY */
|
||||
#else
|
||||
#define OSGUTIL_EXPORT
|
||||
#define OSGUTIL_EXPORT
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -43,7 +43,7 @@ class OSGUTIL_EXPORT GLObjectsVisitor : public osg::NodeVisitor
|
||||
|
||||
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
|
||||
* display list/texture objects etc. Default mode is to compile
|
||||
* GL objects.
|
||||
|
@ -20,33 +20,33 @@
|
||||
namespace osgUtil
|
||||
{
|
||||
|
||||
/** This cube map generator produces an Half-way vector map, useful for
|
||||
hardware-based specular lighting effects.
|
||||
It computes: C = normalize(R - L), where C is the resulting color,
|
||||
R is the reflection vector and L is the light direction.
|
||||
*/
|
||||
class OSGUTIL_EXPORT HalfWayMapGenerator: public CubeMapGenerator {
|
||||
public:
|
||||
HalfWayMapGenerator(const osg::Vec3 &light_direction, int texture_size = 64);
|
||||
HalfWayMapGenerator(const HalfWayMapGenerator ©, const osg::CopyOp ©op);
|
||||
/** This cube map generator produces an Half-way vector map, useful for
|
||||
* hardware-based specular lighting effects.
|
||||
* It computes: C = normalize(R - L), where C is the resulting color,
|
||||
* R is the reflection vector and L is the light direction.
|
||||
*/
|
||||
class OSGUTIL_EXPORT HalfWayMapGenerator: public CubeMapGenerator {
|
||||
public:
|
||||
HalfWayMapGenerator(const osg::Vec3 &light_direction, int texture_size = 64);
|
||||
HalfWayMapGenerator(const HalfWayMapGenerator ©, const osg::CopyOp ©op);
|
||||
|
||||
protected:
|
||||
virtual ~HalfWayMapGenerator() {}
|
||||
HalfWayMapGenerator &operator=(const HalfWayMapGenerator &) { return *this; }
|
||||
protected:
|
||||
virtual ~HalfWayMapGenerator() {}
|
||||
HalfWayMapGenerator &operator=(const HalfWayMapGenerator &) { return *this; }
|
||||
|
||||
inline virtual osg::Vec4 compute_color(const osg::Vec3 &R) const;
|
||||
inline virtual osg::Vec4 compute_color(const osg::Vec3 &R) const;
|
||||
|
||||
private:
|
||||
osg::Vec3 ldir_;
|
||||
};
|
||||
private:
|
||||
osg::Vec3 ldir_;
|
||||
};
|
||||
|
||||
// INLINE METHODS
|
||||
// INLINE METHODS
|
||||
|
||||
inline osg::Vec4 HalfWayMapGenerator::compute_color(const osg::Vec3 &R) const
|
||||
{
|
||||
const osg::Vec3 V = (R / R.length()) - ldir_;
|
||||
return vector_to_color(V / V.length());
|
||||
}
|
||||
inline osg::Vec4 HalfWayMapGenerator::compute_color(const osg::Vec3 &R) const
|
||||
{
|
||||
const osg::Vec3 V = (R / R.length()) - ldir_;
|
||||
return vector_to_color(V / V.length());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -21,10 +21,10 @@ namespace osgUtil
|
||||
{
|
||||
|
||||
/** This cube map generator produces a specular highlight map.
|
||||
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
|
||||
and n is the specular exponent.
|
||||
*/
|
||||
* 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
|
||||
* and n is the specular exponent.
|
||||
*/
|
||||
class OSGUTIL_EXPORT HighlightMapGenerator: public CubeMapGenerator {
|
||||
public:
|
||||
HighlightMapGenerator(
|
||||
|
@ -22,13 +22,13 @@
|
||||
namespace osgUtil {
|
||||
|
||||
/** 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
|
||||
{
|
||||
public:
|
||||
|
||||
/// default to traversing all children.
|
||||
/** Default to traversing all children. */
|
||||
InsertImpostorsVisitor();
|
||||
|
||||
void setImpostorThresholdRatio(float ratio) { _impostorThresholdRatio = ratio; }
|
||||
@ -37,7 +37,7 @@ class OSGUTIL_EXPORT InsertImpostorsVisitor : public osg::NodeVisitor
|
||||
void setMaximumNumberOfNestedImpostors(unsigned int num) { _maximumNumNestedImpostors = num; }
|
||||
unsigned int getMaximumNumberOfNestedImpostors() const { return _maximumNumNestedImpostors; }
|
||||
|
||||
/** empty visitor, make it ready for next traversal.*/
|
||||
/** Empty visitor, make it ready for next traversal. */
|
||||
void reset();
|
||||
|
||||
virtual void apply(osg::Node& node);
|
||||
@ -48,7 +48,7 @@ class OSGUTIL_EXPORT InsertImpostorsVisitor : public osg::NodeVisitor
|
||||
|
||||
virtual void apply(osg::Impostor& node);
|
||||
|
||||
/* insert the required impostors into the scene graph.*/
|
||||
/* Insert the required impostors into the scene graph. */
|
||||
void insertImpostors();
|
||||
|
||||
protected:
|
||||
|
@ -29,7 +29,13 @@ namespace osgUtil {
|
||||
|
||||
|
||||
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:
|
||||
|
||||
Hit();
|
||||
@ -85,7 +91,6 @@ class OSGUTIL_EXPORT IntersectVisitor : public osg::NodeVisitor
|
||||
/** Add a line segment to use for intersection testing during scene traversal.*/
|
||||
void addLineSegment(osg::LineSegment* seg);
|
||||
|
||||
//typedef std::multiset<Hit> HitList;
|
||||
typedef std::vector<Hit> HitList;
|
||||
typedef std::map<osg::LineSegment*,HitList > LineSegmentHitListMap;
|
||||
HitList& getHitList(osg::LineSegment* seg) { return _segHitList[seg]; }
|
||||
|
@ -25,8 +25,8 @@
|
||||
|
||||
namespace osgUtil {
|
||||
|
||||
/** Insert impostor nodes into scene graph.
|
||||
* For example of usage see src/Demos/osgimpostor.
|
||||
/** Traverses scene graph to improve efficiency. See OptimizationOptions.
|
||||
* For example of usage see examples/osgimpostor or osgviewer.
|
||||
*/
|
||||
|
||||
class OSGUTIL_EXPORT Optimizer
|
||||
@ -69,50 +69,50 @@ class OSGUTIL_EXPORT Optimizer
|
||||
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();
|
||||
|
||||
/** traverse the node and its subgraph with a series of optimization
|
||||
* visitors, specificied by the OptizationOptions.*/
|
||||
/** Traverse the node and its subgraph with a series of optimization
|
||||
* visitors, specified by the OptimizationOptions.*/
|
||||
void optimize(osg::Node* node);
|
||||
|
||||
/** traverse the node and its subgraph with a series of optimization
|
||||
* visitors, specificied by the OptizationOptions.*/
|
||||
/** Traverse the node and its subgraph with a series of optimization
|
||||
* visitors, specified by the OptimizationOptions.*/
|
||||
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);
|
||||
if (itr!=_permissableOptimizationsMap.end()) return itr->second;
|
||||
PermissibleOptimizationsMap::const_iterator itr = _permissibleOptimizationsMap.find(object);
|
||||
if (itr!=_permissibleOptimizationsMap.end()) return itr->second;
|
||||
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; }
|
||||
const PermissableOptimizationsMap& getPrimissableOptionsMap() const { return _permissableOptimizationsMap; }
|
||||
PermissibleOptimizationsMap& getPermissibleOptionsMap() { return _permissibleOptimizationsMap; }
|
||||
const PermissibleOptimizationsMap& getPermissibleOptionsMap() const { return _permissibleOptimizationsMap; }
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
PermissableOptimizationsMap _permissableOptimizationsMap;
|
||||
PermissibleOptimizationsMap _permissibleOptimizationsMap;
|
||||
|
||||
|
||||
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
|
||||
* now redundant transforms.*/
|
||||
class OSGUTIL_EXPORT FlattenStaticTransformsVisitor : public osg::NodeVisitor
|
||||
@ -132,9 +132,9 @@ class OSGUTIL_EXPORT Optimizer
|
||||
|
||||
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
|
||||
{
|
||||
public:
|
||||
@ -168,9 +168,9 @@ class OSGUTIL_EXPORT Optimizer
|
||||
|
||||
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:
|
||||
@ -198,9 +198,9 @@ class OSGUTIL_EXPORT Optimizer
|
||||
|
||||
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;
|
||||
@ -223,16 +223,15 @@ class OSGUTIL_EXPORT Optimizer
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
/** Tesselate all geodes, to remove POLYGONS
|
||||
* complementary ranges.*/
|
||||
/** Tesselate all geodes, to remove POLYGONS.*/
|
||||
class OSGUTIL_EXPORT TesselateVisitor : public osg::NodeVisitor
|
||||
{
|
||||
public:
|
||||
@ -263,9 +262,9 @@ class OSGUTIL_EXPORT Optimizer
|
||||
|
||||
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;
|
||||
@ -292,9 +291,9 @@ class OSGUTIL_EXPORT Optimizer
|
||||
|
||||
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:
|
||||
@ -322,9 +321,9 @@ class OSGUTIL_EXPORT Optimizer
|
||||
|
||||
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;
|
||||
@ -355,9 +354,9 @@ class OSGUTIL_EXPORT Optimizer
|
||||
static bool mergePrimitive(osg::DrawElementsUShort& lhs,osg::DrawElementsUShort& 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;
|
||||
@ -381,9 +380,9 @@ class OSGUTIL_EXPORT Optimizer
|
||||
typedef std::set<osg::Group*> 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;
|
||||
@ -406,9 +405,9 @@ class OSGUTIL_EXPORT Optimizer
|
||||
typedef std::set<osg::Node*> 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;
|
||||
@ -437,9 +436,9 @@ class OSGUTIL_EXPORT Optimizer
|
||||
void apply(osg::StateSet& stateset);
|
||||
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;
|
||||
|
@ -18,37 +18,37 @@
|
||||
namespace osgUtil
|
||||
{
|
||||
|
||||
/** This is the most simple cube map generator. It performs a direct association
|
||||
between reflection vector and RGBA color (C = R).
|
||||
*/
|
||||
class ReflectionMapGenerator: public CubeMapGenerator {
|
||||
public:
|
||||
inline ReflectionMapGenerator(int texture_size = 64);
|
||||
inline ReflectionMapGenerator(const ReflectionMapGenerator ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY);
|
||||
/** This is the most simple cube map generator. It performs a direct association
|
||||
between reflection vector and RGBA color (C = R).
|
||||
*/
|
||||
class ReflectionMapGenerator: public CubeMapGenerator {
|
||||
public:
|
||||
inline ReflectionMapGenerator(int texture_size = 64);
|
||||
inline ReflectionMapGenerator(const ReflectionMapGenerator ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY);
|
||||
|
||||
protected:
|
||||
virtual ~ReflectionMapGenerator() {}
|
||||
ReflectionMapGenerator &operator=(const ReflectionMapGenerator &) { return *this; }
|
||||
protected:
|
||||
virtual ~ReflectionMapGenerator() {}
|
||||
ReflectionMapGenerator &operator=(const ReflectionMapGenerator &) { return *this; }
|
||||
|
||||
inline virtual osg::Vec4 compute_color(const osg::Vec3 &R) const;
|
||||
};
|
||||
inline virtual osg::Vec4 compute_color(const osg::Vec3 &R) const;
|
||||
};
|
||||
|
||||
// INLINE METHODS
|
||||
// INLINE METHODS
|
||||
|
||||
inline ReflectionMapGenerator::ReflectionMapGenerator(int texture_size)
|
||||
: CubeMapGenerator(texture_size)
|
||||
{
|
||||
}
|
||||
inline ReflectionMapGenerator::ReflectionMapGenerator(int texture_size)
|
||||
: CubeMapGenerator(texture_size)
|
||||
{
|
||||
}
|
||||
|
||||
inline ReflectionMapGenerator::ReflectionMapGenerator(const ReflectionMapGenerator ©, const osg::CopyOp ©op)
|
||||
: CubeMapGenerator(copy, copyop)
|
||||
{
|
||||
}
|
||||
inline ReflectionMapGenerator::ReflectionMapGenerator(const ReflectionMapGenerator ©, const osg::CopyOp ©op)
|
||||
: CubeMapGenerator(copy, copyop)
|
||||
{
|
||||
}
|
||||
|
||||
inline osg::Vec4 ReflectionMapGenerator::compute_color(const osg::Vec3 &R) const
|
||||
{
|
||||
return vector_to_color(R / R.length());
|
||||
}
|
||||
inline osg::Vec4 ReflectionMapGenerator::compute_color(const osg::Vec3 &R) const
|
||||
{
|
||||
return vector_to_color(R / R.length());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,10 @@ namespace osgUtil {
|
||||
class RenderStage;
|
||||
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
|
||||
{
|
||||
@ -68,7 +71,7 @@ class OSGUTIL_EXPORT RenderBin : public osg::Object
|
||||
RenderStage* getStage() { return _stage; }
|
||||
const RenderStage* getStage() const { return _stage; }
|
||||
|
||||
int getBinNum() const { return _binNum; }
|
||||
int getBinNum() const { return _binNum; }
|
||||
|
||||
RenderGraphList& getRenderGraphList() { return _renderGraphList; }
|
||||
const RenderGraphList& getRenderGraphList() const { return _renderGraphList; }
|
||||
@ -90,7 +93,7 @@ class OSGUTIL_EXPORT RenderBin : public osg::Object
|
||||
void sort();
|
||||
|
||||
virtual void sortImplementation();
|
||||
|
||||
|
||||
void setSortMode(SortMode mode);
|
||||
SortMode getSortMode() const { return _sortMode; }
|
||||
|
||||
@ -122,7 +125,7 @@ class OSGUTIL_EXPORT RenderBin : public osg::Object
|
||||
DrawCallback* getDrawCallback() { 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);
|
||||
void getPrims(Statistics* primStats);
|
||||
bool getPrims(Statistics* primStats, int nbin);
|
||||
|
@ -36,6 +36,8 @@ struct LeafDepthSortFunctor
|
||||
}
|
||||
};
|
||||
|
||||
/** RenderGraph - contained in a renderBin, defines the scene to be drawn.
|
||||
*/
|
||||
class OSGUTIL_EXPORT RenderGraph : public osg::Referenced
|
||||
{
|
||||
public:
|
||||
@ -139,14 +141,14 @@ class OSGUTIL_EXPORT RenderGraph : public osg::Referenced
|
||||
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();
|
||||
|
||||
/** 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.*/
|
||||
void clean();
|
||||
|
||||
/** recursively prune the RenderGraph of empty children.*/
|
||||
/** Recursively prune the RenderGraph of empty children.*/
|
||||
void prune();
|
||||
|
||||
|
||||
|
@ -23,10 +23,10 @@
|
||||
|
||||
namespace osgUtil {
|
||||
|
||||
// forward declare RenderGraph
|
||||
// Forward declare 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
|
||||
{
|
||||
@ -41,28 +41,27 @@ class OSGUTIL_EXPORT RenderLeaf : public osg::Referenced
|
||||
_depth(depth) {}
|
||||
|
||||
|
||||
inline void set(osg::Drawable* drawable,osg::RefMatrix* projection,osg::RefMatrix* modelview, float depth=0.0f)
|
||||
{
|
||||
_parent = 0;
|
||||
_drawable = drawable;
|
||||
_projection = projection,
|
||||
_modelview = modelview,
|
||||
_depth = depth;
|
||||
}
|
||||
|
||||
inline void reset()
|
||||
{
|
||||
_parent = 0;
|
||||
_drawable = 0;
|
||||
_projection = 0;
|
||||
_modelview = 0;
|
||||
_depth = 0.0f;
|
||||
}
|
||||
|
||||
|
||||
inline void set(osg::Drawable* drawable,osg::RefMatrix* projection,osg::RefMatrix* modelview, float depth=0.0f)
|
||||
{
|
||||
_parent = 0;
|
||||
_drawable = drawable;
|
||||
_projection = projection,
|
||||
_modelview = modelview,
|
||||
_depth = depth;
|
||||
}
|
||||
|
||||
inline void reset()
|
||||
{
|
||||
_parent = 0;
|
||||
_drawable = 0;
|
||||
_projection = 0;
|
||||
_modelview = 0;
|
||||
_depth = 0.0f;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
public:
|
||||
|
@ -23,7 +23,7 @@
|
||||
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
|
||||
* matrices and rendering the RenderBin's enclosed with this RenderStage.
|
||||
* 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(..).
|
||||
* 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; }
|
||||
|
||||
/** 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
|
||||
* 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; }
|
||||
|
||||
/** Get the clear depth.*/
|
||||
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*/
|
||||
void setClearStencil(int stencil) { _clearStencil=stencil; }
|
||||
|
||||
@ -125,12 +125,12 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin
|
||||
virtual void drawPreRenderStages(osg::State& state,RenderLeaf*& previous);
|
||||
|
||||
virtual void draw(osg::State& state,RenderLeaf*& previous);
|
||||
|
||||
|
||||
virtual void drawImplementation(osg::State& state,RenderLeaf*& previous);
|
||||
|
||||
void addToDependencyList(RenderStage* rs);
|
||||
|
||||
/** extract stats for current draw list. */
|
||||
/** Extract stats for current draw list. */
|
||||
bool getStats(Statistics* primStats);
|
||||
|
||||
#ifndef USE_DEPRECATED_API
|
||||
|
@ -24,7 +24,7 @@
|
||||
namespace osgUtil {
|
||||
|
||||
/**
|
||||
* RenderBin base class.
|
||||
* RenderStageLighting base class. Used in RenderStage class.
|
||||
*/
|
||||
class OSGUTIL_EXPORT RenderStageLighting : public osg::Object
|
||||
{
|
||||
|
@ -27,8 +27,9 @@
|
||||
namespace osgUtil {
|
||||
|
||||
/**
|
||||
* SceneView is literally a view of a scene, encapsulating the
|
||||
* camera (modelview+projection matrices), global state, lights and the scene itself. Provides
|
||||
* SceneView is literally a view of a scene, encapsulating the 'camera'
|
||||
* (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.
|
||||
*/
|
||||
class OSGUTIL_EXPORT SceneView : public osg::Referenced, public osg::CullSettings
|
||||
@ -50,14 +51,14 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced, public osg::CullSetting
|
||||
|
||||
/** Set scene view to use default global state, light, camera
|
||||
* and render visitor.
|
||||
*/
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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(); }
|
||||
|
||||
/** 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)
|
||||
{
|
||||
if (viewport) _viewport = viewport;
|
||||
@ -118,7 +119,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced, public osg::CullSetting
|
||||
/** Set the color used in glClearColor().
|
||||
Defaults to an off blue 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; }
|
||||
|
||||
|
||||
@ -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. */
|
||||
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,
|
||||
double bottom, double top,
|
||||
double zNear, double zFar);
|
||||
@ -177,7 +178,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced, public osg::CullSetting
|
||||
/** Get the const projection matrix.*/
|
||||
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.*/
|
||||
bool getProjectionMatrixAsOrtho(double& left, double& right,
|
||||
double& bottom, double& top,
|
||||
@ -189,11 +190,11 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced, public osg::CullSetting
|
||||
double& bottom, double& top,
|
||||
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.
|
||||
* Note, if matrix is not a symetric perspective matrix then the shear will be lost.
|
||||
* Asymetric metrices occur when stereo, power walls, caves and reality center display are used.
|
||||
* In these configuration one should use the AsFrustum method instead.*/
|
||||
* Note, if matrix is not a symmetric perspective matrix then the shear will be lost.
|
||||
* Asymmetric matrices occur when stereo, power walls, caves and reality center display are used.
|
||||
* In these configurations one should use the 'getProjectionMatrixAsFrustum' method instead.*/
|
||||
bool getProjectionMatrixAsPerspective(double& fovy,double& aspectRatio,
|
||||
double& zNear, double& zFar);
|
||||
|
||||
@ -290,7 +291,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced, public osg::CullSetting
|
||||
{
|
||||
/** Use fusion distance from the value set on the SceneView.*/
|
||||
USE_FUSION_DISTANCE_VALUE,
|
||||
/** Compute the fusion distance by multiplying the screen distance by the fusion distance value.*/
|
||||
/** Compute the fusion distance by multiplying the screen distance by the fusion distance value.*/
|
||||
PROPORTIONAL_TO_SCREEN_DISTANCE
|
||||
};
|
||||
|
||||
@ -308,13 +309,13 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced, public osg::CullSetting
|
||||
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; }
|
||||
|
||||
/** get whether the draw method should call renderer->prioritizeTexture.*/
|
||||
/** Get whether the draw method should call renderer->prioritizeTexture.*/
|
||||
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
|
||||
{
|
||||
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
|
||||
for projectWindowIntoObject to produce valid values. Consistent with OpenGL
|
||||
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,...).
|
||||
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.*/
|
||||
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(); }
|
||||
|
||||
|
||||
@ -399,8 +400,8 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced, public osg::CullSetting
|
||||
/** Do init traversal of attached scene graph using Init NodeVisitor.
|
||||
* The init traversal is called once for each SceneView, and should
|
||||
* be used to compile display list, texture objects intialize data
|
||||
* not otherwise intializaed during scene graph loading. Note, is
|
||||
* called automatically by update&cull if it hasn't already been called
|
||||
* not otherwise intialized during scene graph loading. Note, is
|
||||
* called automatically by update & cull if it hasn't already been called
|
||||
* elsewhere. Also init() should only ever be called within a valid
|
||||
* graphics context.*/
|
||||
virtual void init();
|
||||
|
@ -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 ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY);
|
||||
/**
|
||||
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 ©, const osg::CopyOp ©op = 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_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
@ -81,9 +81,9 @@ class OSGUTIL_EXPORT TriStripVisitor : public osg::NodeVisitor
|
||||
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; }
|
||||
|
@ -93,7 +93,7 @@ class OSGUTIL_EXPORT UpdateVisitor : public osg::NodeVisitor
|
||||
if (callback) callback->update(this,geode.getDrawable(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ static bool isNodeEmpty(const osg::Node& node)
|
||||
|
||||
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");
|
||||
@ -293,8 +293,8 @@ void Optimizer::StateVisitor::apply(osg::Node& node)
|
||||
osg::StateSet* ss = node.getStateSet();
|
||||
if (ss && ss->getDataVariance()==osg::Object::STATIC)
|
||||
{
|
||||
if (isOperationPermissableForObject(&node) &&
|
||||
isOperationPermissableForObject(ss))
|
||||
if (isOperationPermissibleForObject(&node) &&
|
||||
isOperationPermissibleForObject(ss))
|
||||
{
|
||||
addStateSet(ss,&node);
|
||||
}
|
||||
@ -305,14 +305,14 @@ void Optimizer::StateVisitor::apply(osg::Node& node)
|
||||
|
||||
void Optimizer::StateVisitor::apply(osg::Geode& geode)
|
||||
{
|
||||
if (!isOperationPermissableForObject(&geode)) return;
|
||||
if (!isOperationPermissibleForObject(&geode)) return;
|
||||
|
||||
osg::StateSet* ss = geode.getStateSet();
|
||||
|
||||
|
||||
if (ss && ss->getDataVariance()==osg::Object::STATIC)
|
||||
{
|
||||
if (isOperationPermissableForObject(ss))
|
||||
if (isOperationPermissibleForObject(ss))
|
||||
{
|
||||
addStateSet(ss,&geode);
|
||||
}
|
||||
@ -325,8 +325,8 @@ void Optimizer::StateVisitor::apply(osg::Geode& geode)
|
||||
ss = drawable->getStateSet();
|
||||
if (ss && ss->getDataVariance()==osg::Object::STATIC)
|
||||
{
|
||||
if (isOperationPermissableForObject(drawable) &&
|
||||
isOperationPermissableForObject(ss))
|
||||
if (isOperationPermissibleForObject(drawable) &&
|
||||
isOperationPermissibleForObject(ss))
|
||||
{
|
||||
addStateSet(ss,drawable);
|
||||
}
|
||||
@ -585,7 +585,7 @@ class CollectLowestTransformsVisitor : public osg::NodeVisitor
|
||||
void disableTransform(osg::Transform* transform);
|
||||
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.
|
||||
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.
|
||||
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:
|
||||
@ -831,7 +831,7 @@ void CollectLowestTransformsVisitor::setUpMaps()
|
||||
ObjectStruct& os = oitr->second;
|
||||
if (os._canBeApplied)
|
||||
{
|
||||
if (os._moreThanOneMatrixRequired || !isOperationPermissableForObject(object))
|
||||
if (os._moreThanOneMatrixRequired || !isOperationPermissibleForObject(object))
|
||||
{
|
||||
disableObject(oitr);
|
||||
}
|
||||
@ -1151,7 +1151,7 @@ void Optimizer::RemoveRedundantNodesVisitor::apply(osg::Group& group)
|
||||
{
|
||||
if (group.getNumParents()>0 && group.getNumChildren()<=1)
|
||||
{
|
||||
if (isNodeEmpty(group) && isOperationPermissableForObject(&group))
|
||||
if (isNodeEmpty(group) && isOperationPermissibleForObject(&group))
|
||||
{
|
||||
_redundantNodeList.insert(&group);
|
||||
}
|
||||
@ -1165,7 +1165,7 @@ void Optimizer::RemoveRedundantNodesVisitor::apply(osg::Transform& transform)
|
||||
{
|
||||
if (transform.getNumParents()>0 &&
|
||||
transform.getDataVariance()==osg::Object::STATIC &&
|
||||
isOperationPermissableForObject(&transform))
|
||||
isOperationPermissibleForObject(&transform))
|
||||
{
|
||||
static osg::Matrix identity;
|
||||
osg::Matrix matrix;
|
||||
@ -1224,7 +1224,7 @@ void Optimizer::CombineLODsVisitor::apply(osg::LOD& lod)
|
||||
{
|
||||
if (typeid(*lod.getParent(i))==typeid(osg::Group))
|
||||
{
|
||||
if (isOperationPermissableForObject(&lod))
|
||||
if (isOperationPermissibleForObject(&lod))
|
||||
{
|
||||
_groupList.insert(lod.getParent(i));
|
||||
}
|
||||
@ -1448,12 +1448,12 @@ struct LessGeometryPrimitiveType
|
||||
|
||||
void Optimizer::CheckGeometryVisitor::checkGeode(osg::Geode& geode)
|
||||
{
|
||||
if (isOperationPermissableForObject(&geode))
|
||||
if (isOperationPermissibleForObject(&geode))
|
||||
{
|
||||
for(unsigned int i=0;i<geode.getNumDrawables();++i)
|
||||
{
|
||||
osg::Geometry* geom = geode.getDrawable(i)->asGeometry();
|
||||
if (geom && isOperationPermissableForObject(geom))
|
||||
if (geom && isOperationPermissibleForObject(geom))
|
||||
{
|
||||
geom->computeCorrectBindingsAndArraySizes();
|
||||
}
|
||||
@ -1463,7 +1463,7 @@ void Optimizer::CheckGeometryVisitor::checkGeode(osg::Geode& geode)
|
||||
|
||||
bool Optimizer::MergeGeometryVisitor::mergeGeode(osg::Geode& geode)
|
||||
{
|
||||
if (!isOperationPermissableForObject(&geode)) return false;
|
||||
if (!isOperationPermissibleForObject(&geode)) return false;
|
||||
|
||||
#if 1
|
||||
|
||||
@ -1984,7 +1984,7 @@ void Optimizer::SpatializeGroupsVisitor::apply(osg::Group& group)
|
||||
{
|
||||
if (typeid(group)==typeid(osg::Group) || group.asTransform())
|
||||
{
|
||||
if (isOperationPermissableForObject(&group))
|
||||
if (isOperationPermissibleForObject(&group))
|
||||
{
|
||||
_groupsToDivideList.insert(&group);
|
||||
}
|
||||
@ -2173,7 +2173,7 @@ bool Optimizer::SpatializeGroupsVisitor::divide(osg::Group* group, unsigned int
|
||||
|
||||
void Optimizer::CopySharedSubgraphsVisitor::apply(osg::Node& node)
|
||||
{
|
||||
if (node.getNumParents()>1 && !isOperationPermissableForObject(&node))
|
||||
if (node.getNumParents()>1 && !isOperationPermissibleForObject(&node))
|
||||
{
|
||||
_sharedNodeList.insert(&node);
|
||||
}
|
||||
@ -2215,8 +2215,8 @@ void Optimizer::TextureVisitor::apply(osg::Node& node)
|
||||
|
||||
osg::StateSet* ss = node.getStateSet();
|
||||
if (ss &&
|
||||
isOperationPermissableForObject(&node) &&
|
||||
isOperationPermissableForObject(ss))
|
||||
isOperationPermissibleForObject(&node) &&
|
||||
isOperationPermissibleForObject(ss))
|
||||
{
|
||||
apply(*ss);
|
||||
}
|
||||
@ -2226,11 +2226,11 @@ void Optimizer::TextureVisitor::apply(osg::Node& node)
|
||||
|
||||
void Optimizer::TextureVisitor::apply(osg::Geode& geode)
|
||||
{
|
||||
if (!isOperationPermissableForObject(&geode)) return;
|
||||
if (!isOperationPermissibleForObject(&geode)) return;
|
||||
|
||||
osg::StateSet* ss = geode.getStateSet();
|
||||
|
||||
if (ss && isOperationPermissableForObject(ss))
|
||||
if (ss && isOperationPermissibleForObject(ss))
|
||||
{
|
||||
apply(*ss);
|
||||
}
|
||||
@ -2242,8 +2242,8 @@ void Optimizer::TextureVisitor::apply(osg::Geode& geode)
|
||||
{
|
||||
ss = drawable->getStateSet();
|
||||
if (ss &&
|
||||
isOperationPermissableForObject(drawable) &&
|
||||
isOperationPermissableForObject(ss))
|
||||
isOperationPermissibleForObject(drawable) &&
|
||||
isOperationPermissibleForObject(ss))
|
||||
{
|
||||
apply(*ss);
|
||||
}
|
||||
@ -2257,7 +2257,7 @@ void Optimizer::TextureVisitor::apply(osg::StateSet& stateset)
|
||||
{
|
||||
osg::StateAttribute* sa = stateset.getTextureAttribute(i,osg::StateAttribute::TEXTURE);
|
||||
osg::Texture* texture = dynamic_cast<osg::Texture*>(sa);
|
||||
if (texture && isOperationPermissableForObject(texture))
|
||||
if (texture && isOperationPermissibleForObject(texture))
|
||||
{
|
||||
apply(*texture);
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ void RenderBin::sortByState()
|
||||
{
|
||||
// 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
|
||||
// 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.
|
||||
// cout << "doing sortByState "<<this<<endl;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user