Ran script to remove trailing spaces and tabs
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
namespace osgUtil {
|
||||
|
||||
template <typename InType, typename OutType,
|
||||
unsigned int InSize = InType::num_components,
|
||||
template <typename InType, typename OutType,
|
||||
unsigned int InSize = InType::num_components,
|
||||
unsigned int OutSize = OutType::num_components>
|
||||
struct ConvertVec
|
||||
{
|
||||
@@ -31,9 +31,9 @@ template <typename InType, typename OutType>
|
||||
struct ConvertVec<InType, OutType, 2, 2>
|
||||
{
|
||||
static void convert(InType & in, OutType & out)
|
||||
{
|
||||
out.set(static_cast<typename OutType::value_type>(in.x()),
|
||||
static_cast<typename OutType::value_type>(in.y()));
|
||||
{
|
||||
out.set(static_cast<typename OutType::value_type>(in.x()),
|
||||
static_cast<typename OutType::value_type>(in.y()));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -41,10 +41,10 @@ template <typename InType, typename OutType>
|
||||
struct ConvertVec<InType, OutType, 2, 3>
|
||||
{
|
||||
static void convert(InType & in, OutType & out)
|
||||
{
|
||||
out.set(static_cast<typename OutType::value_type>(in.x()),
|
||||
static_cast<typename OutType::value_type>(in.y()),
|
||||
static_cast<typename OutType::value_type>(0.0));
|
||||
{
|
||||
out.set(static_cast<typename OutType::value_type>(in.x()),
|
||||
static_cast<typename OutType::value_type>(in.y()),
|
||||
static_cast<typename OutType::value_type>(0.0));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -52,11 +52,11 @@ template <typename InType, typename OutType>
|
||||
struct ConvertVec<InType, OutType, 2, 4>
|
||||
{
|
||||
static void convert(InType & in, OutType & out)
|
||||
{
|
||||
out.set(static_cast<typename OutType::value_type>(in.x()),
|
||||
static_cast<typename OutType::value_type>(in.y()),
|
||||
static_cast<typename OutType::value_type>(0.0),
|
||||
static_cast<typename OutType::value_type>(1.0));
|
||||
{
|
||||
out.set(static_cast<typename OutType::value_type>(in.x()),
|
||||
static_cast<typename OutType::value_type>(in.y()),
|
||||
static_cast<typename OutType::value_type>(0.0),
|
||||
static_cast<typename OutType::value_type>(1.0));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -68,9 +68,9 @@ template <typename InType, typename OutType>
|
||||
struct ConvertVec<InType, OutType, 3, 2>
|
||||
{
|
||||
static void convert(InType & in, OutType & out)
|
||||
{
|
||||
out.set(static_cast<typename OutType::value_type>(in.x()),
|
||||
static_cast<typename OutType::value_type>(in.y()));
|
||||
{
|
||||
out.set(static_cast<typename OutType::value_type>(in.x()),
|
||||
static_cast<typename OutType::value_type>(in.y()));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -78,10 +78,10 @@ template <typename InType, typename OutType>
|
||||
struct ConvertVec<InType, OutType, 3, 3>
|
||||
{
|
||||
static void convert(InType & in, OutType & out)
|
||||
{
|
||||
out.set(static_cast<typename OutType::value_type>(in.x()),
|
||||
static_cast<typename OutType::value_type>(in.y()),
|
||||
static_cast<typename OutType::value_type>(in.z()));
|
||||
{
|
||||
out.set(static_cast<typename OutType::value_type>(in.x()),
|
||||
static_cast<typename OutType::value_type>(in.y()),
|
||||
static_cast<typename OutType::value_type>(in.z()));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -89,11 +89,11 @@ template <typename InType, typename OutType>
|
||||
struct ConvertVec<InType, OutType, 3, 4>
|
||||
{
|
||||
static void convert(InType & in, OutType & out)
|
||||
{
|
||||
out.set(static_cast<typename OutType::value_type>(in.x()),
|
||||
static_cast<typename OutType::value_type>(in.y()),
|
||||
static_cast<typename OutType::value_type>(in.z()),
|
||||
static_cast<typename OutType::value_type>(1.0));
|
||||
{
|
||||
out.set(static_cast<typename OutType::value_type>(in.x()),
|
||||
static_cast<typename OutType::value_type>(in.y()),
|
||||
static_cast<typename OutType::value_type>(in.z()),
|
||||
static_cast<typename OutType::value_type>(1.0));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -105,9 +105,9 @@ template <typename InType, typename OutType>
|
||||
struct ConvertVec<InType, OutType, 4, 2>
|
||||
{
|
||||
static void convert(InType & in, OutType & out)
|
||||
{
|
||||
out.set(static_cast<typename OutType::value_type>(in.x()/in.w()),
|
||||
static_cast<typename OutType::value_type>(in.y()/in.w()));
|
||||
{
|
||||
out.set(static_cast<typename OutType::value_type>(in.x()/in.w()),
|
||||
static_cast<typename OutType::value_type>(in.y()/in.w()));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -115,10 +115,10 @@ template <typename InType, typename OutType>
|
||||
struct ConvertVec<InType, OutType, 4, 3>
|
||||
{
|
||||
static void convert(InType & in, OutType & out)
|
||||
{
|
||||
out.set(static_cast<typename OutType::value_type>(in.x()/in.w()),
|
||||
static_cast<typename OutType::value_type>(in.y()/in.w()),
|
||||
static_cast<typename OutType::value_type>(in.z()/in.w()));
|
||||
{
|
||||
out.set(static_cast<typename OutType::value_type>(in.x()/in.w()),
|
||||
static_cast<typename OutType::value_type>(in.y()/in.w()),
|
||||
static_cast<typename OutType::value_type>(in.z()/in.w()));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -126,11 +126,11 @@ template <typename InType, typename OutType>
|
||||
struct ConvertVec<InType, OutType, 4, 4>
|
||||
{
|
||||
static void convert(InType & in, OutType & out)
|
||||
{
|
||||
out.set(static_cast<typename OutType::value_type>(in.x()),
|
||||
static_cast<typename OutType::value_type>(in.y()),
|
||||
static_cast<typename OutType::value_type>(in.z()),
|
||||
static_cast<typename OutType::value_type>(in.w()));
|
||||
{
|
||||
out.set(static_cast<typename OutType::value_type>(in.x()),
|
||||
static_cast<typename OutType::value_type>(in.y()),
|
||||
static_cast<typename OutType::value_type>(in.z()),
|
||||
static_cast<typename OutType::value_type>(in.w()));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
#ifndef OSGUTIL_CUBEMAPGENERATOR_
|
||||
@@ -28,7 +28,7 @@
|
||||
namespace osgUtil
|
||||
{
|
||||
|
||||
/** This is the base class for cube map generators.
|
||||
/** 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.
|
||||
*/
|
||||
@@ -40,8 +40,8 @@ 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.
|
||||
If use_osg_system is true, then the OSG's coordinate system is used instead
|
||||
/** 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.
|
||||
*/
|
||||
void generateMap(bool use_osg_system = true);
|
||||
@@ -51,9 +51,9 @@ namespace osgUtil
|
||||
CubeMapGenerator &operator=(const CubeMapGenerator &) { return *this; }
|
||||
|
||||
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 return value should be the RGBA color associated with that reflection ray.
|
||||
*/
|
||||
@@ -63,7 +63,7 @@ namespace osgUtil
|
||||
int texture_size_;
|
||||
|
||||
typedef std::vector<osg::ref_ptr<osg::Image> > Image_list;
|
||||
Image_list images_;
|
||||
Image_list images_;
|
||||
};
|
||||
|
||||
// INLINE METHODS
|
||||
@@ -76,7 +76,7 @@ namespace osgUtil
|
||||
case osg::TextureCubeMap::POSITIVE_Y: return images_[2].get();
|
||||
case osg::TextureCubeMap::NEGATIVE_Y: return images_[3].get();
|
||||
case osg::TextureCubeMap::POSITIVE_Z: return images_[4].get();
|
||||
case osg::TextureCubeMap::NEGATIVE_Z: return images_[5].get();
|
||||
case osg::TextureCubeMap::NEGATIVE_Z: return images_[5].get();
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
@@ -89,7 +89,7 @@ namespace osgUtil
|
||||
case osg::TextureCubeMap::POSITIVE_Y: return images_[2].get();
|
||||
case osg::TextureCubeMap::NEGATIVE_Y: return images_[3].get();
|
||||
case osg::TextureCubeMap::POSITIVE_Z: return images_[4].get();
|
||||
case osg::TextureCubeMap::NEGATIVE_Z: return images_[5].get();
|
||||
case osg::TextureCubeMap::NEGATIVE_Z: return images_[5].get();
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
@@ -101,7 +101,7 @@ namespace osgUtil
|
||||
*(i->data(c, r)+0) = static_cast<unsigned char>(osg::clampBetween(color.x(),0.0f,1.0f) * 255);
|
||||
*(i->data(c, r)+1) = static_cast<unsigned char>(osg::clampBetween(color.y(),0.0f,1.0f) * 255);
|
||||
*(i->data(c, r)+2) = static_cast<unsigned char>(osg::clampBetween(color.z(),0.0f,1.0f) * 255);
|
||||
*(i->data(c, r)+3) = static_cast<unsigned char>(osg::clampBetween(color.w(),0.0f,1.0f) * 255);
|
||||
*(i->data(c, r)+3) = static_cast<unsigned char>(osg::clampBetween(color.w(),0.0f,1.0f) * 255);
|
||||
} else {
|
||||
osg::notify(osg::WARN) << "Warning: CubeMapGenerator::set_pixel(): invalid image index\n";
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -43,17 +43,17 @@ namespace osgUtil {
|
||||
* 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 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
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
typedef osg::Matrix::value_type value_type;
|
||||
|
||||
|
||||
|
||||
CullVisitor();
|
||||
|
||||
|
||||
/// Copy constructor that does a shallow copy.
|
||||
CullVisitor(const CullVisitor&);
|
||||
|
||||
@@ -64,7 +64,7 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
|
||||
|
||||
/** get the prototype singleton used by CullVisitor::create().*/
|
||||
static osg::ref_ptr<CullVisitor>& prototype();
|
||||
|
||||
|
||||
/** create a CullVisitor by cloning CullVisitor::prototype().*/
|
||||
static CullVisitor* create();
|
||||
|
||||
@@ -130,7 +130,7 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
|
||||
++_numberOfEncloseOverrideRenderBinDetails;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Pop the top state set and hence associated state group.
|
||||
* Move the current state group to the parent of the popped
|
||||
* state group.
|
||||
@@ -156,7 +156,7 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
|
||||
}
|
||||
_currentStateGraph = _currentStateGraph->_parent;
|
||||
}
|
||||
|
||||
|
||||
inline void setStateGraph(StateGraph* rg)
|
||||
{
|
||||
_rootStateGraph = rg;
|
||||
@@ -206,7 +206,7 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
|
||||
|
||||
void setCalculatedNearPlane(value_type value) { _computed_znear = value; }
|
||||
inline value_type getCalculatedNearPlane() const { return _computed_znear; }
|
||||
|
||||
|
||||
void setCalculatedFarPlane(value_type value) { _computed_zfar = value; }
|
||||
inline value_type getCalculatedFarPlane() const { return _computed_zfar; }
|
||||
|
||||
@@ -216,9 +216,9 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
|
||||
bool updateCalculatedNearFar(const osg::Matrix& matrix,const osg::BoundingBox& bb);
|
||||
|
||||
bool updateCalculatedNearFar(const osg::Matrix& matrix,const osg::Drawable& drawable, bool isBillboard=false);
|
||||
|
||||
|
||||
void updateCalculatedNearFar(const osg::Vec3& pos);
|
||||
|
||||
|
||||
/** Add a drawable to current render graph.*/
|
||||
inline void addDrawable(osg::Drawable* drawable,osg::RefMatrix* matrix);
|
||||
|
||||
@@ -233,13 +233,13 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
|
||||
|
||||
|
||||
/** compute near plane based on the polgon intersection of primtives in near plane candidate list of drawables.
|
||||
* Note, you have to set ComputeNearFarMode to COMPUTE_NEAR_FAR_USING_PRIMITIVES to be able to near plane candidate drawables to be recorded by the cull traversal. */
|
||||
* Note, you have to set ComputeNearFarMode to COMPUTE_NEAR_FAR_USING_PRIMITIVES to be able to near plane candidate drawables to be recorded by the cull traversal. */
|
||||
void computeNearPlane();
|
||||
|
||||
/** Re-implement CullStack's popProjectionMatrix() adding clamping of the projection matrix to
|
||||
* the computed near and far.*/
|
||||
virtual void popProjectionMatrix();
|
||||
|
||||
|
||||
|
||||
/** CullVisitor's default clamping of the projection float matrix to computed near and far values.
|
||||
* Note, do not call this method directly, use clampProjectionMatrix(..) instead, unless you want to bypass the callback.*/
|
||||
@@ -265,7 +265,7 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
|
||||
zfar = zf;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -286,10 +286,10 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
|
||||
zfar = zf;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void setState(osg::State* state) { _renderInfo.setState(state); }
|
||||
osg::State* getState() { return _renderInfo.getState(); }
|
||||
@@ -305,7 +305,7 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
|
||||
|
||||
/** Prevent unwanted copy operator.*/
|
||||
CullVisitor& operator = (const CullVisitor&) { return *this; }
|
||||
|
||||
|
||||
inline void handle_cull_callbacks_and_traverse(osg::Node& node)
|
||||
{
|
||||
osg::NodeCallback* callback = node.getCullCallback();
|
||||
@@ -323,7 +323,7 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
|
||||
osg::ref_ptr<StateGraph> _rootStateGraph;
|
||||
StateGraph* _currentStateGraph;
|
||||
|
||||
osg::ref_ptr<RenderStage> _rootRenderStage;
|
||||
osg::ref_ptr<RenderStage> _rootRenderStage;
|
||||
RenderBin* _currentRenderBin;
|
||||
std::vector<RenderBin*> _renderBinStack;
|
||||
|
||||
@@ -331,14 +331,14 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
|
||||
|
||||
value_type _computed_znear;
|
||||
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);
|
||||
|
||||
|
||||
unsigned int _numberOfEncloseOverrideRenderBinDetails;
|
||||
|
||||
osg::RenderInfo _renderInfo;
|
||||
@@ -350,13 +350,13 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
|
||||
_drawable(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void set(const osg::Matrix& matrix, const osg::Drawable* drawable, const osg::Polytope& frustum)
|
||||
{
|
||||
_matrix = matrix;
|
||||
_drawable = drawable;
|
||||
if (!_planes.empty()) _planes.clear();
|
||||
|
||||
|
||||
// create a new list of planes from the active walls of the frustum.
|
||||
osg::Polytope::ClippingMask result_mask = frustum.getResultMask();
|
||||
osg::Polytope::ClippingMask selector_mask = 0x1;
|
||||
@@ -365,15 +365,15 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
|
||||
++itr)
|
||||
{
|
||||
if (result_mask&selector_mask) _planes.push_back(*itr);
|
||||
selector_mask <<= 1;
|
||||
selector_mask <<= 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MatrixPlanesDrawables(const MatrixPlanesDrawables& mpd):
|
||||
_matrix(mpd._matrix),
|
||||
_drawable(mpd._drawable),
|
||||
_planes(mpd._planes) {}
|
||||
|
||||
|
||||
MatrixPlanesDrawables& operator = (const MatrixPlanesDrawables& mpd)
|
||||
{
|
||||
_matrix = mpd._matrix;
|
||||
@@ -381,12 +381,12 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
|
||||
_planes = mpd._planes;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
osg::Matrix _matrix;
|
||||
const osg::Drawable* _drawable;
|
||||
osg::Polytope::PlaneList _planes;
|
||||
};
|
||||
|
||||
|
||||
typedef std::multimap<value_type, MatrixPlanesDrawables> DistanceMatrixDrawableMap;
|
||||
DistanceMatrixDrawableMap _nearPlaneCandidateMap;
|
||||
DistanceMatrixDrawableMap _farPlaneCandidateMap;
|
||||
@@ -436,7 +436,7 @@ inline void CullVisitor::addPositionedTextureAttribute(unsigned int textureUnit,
|
||||
inline RenderLeaf* CullVisitor::createOrReuseRenderLeaf(osg::Drawable* drawable,osg::RefMatrix* projection,osg::RefMatrix* matrix, float depth)
|
||||
{
|
||||
// Skips any already reused renderleaf.
|
||||
while (_currentReuseRenderLeafIndex<_reuseRenderLeafList.size() &&
|
||||
while (_currentReuseRenderLeafIndex<_reuseRenderLeafList.size() &&
|
||||
_reuseRenderLeafList[_currentReuseRenderLeafIndex]->referenceCount()>1)
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"Warning:createOrReuseRenderLeaf() skipping multiply refrenced entry."<< std::endl;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#include <osgUtil/Export>
|
||||
|
||||
namespace osgUtil
|
||||
namespace osgUtil
|
||||
{
|
||||
|
||||
/** DelaunayTriangulator: Utility class that triangulates an irregular network of sample points.
|
||||
@@ -43,7 +43,7 @@ class OSGUTIL_EXPORT DelaunayConstraint: public osg::Geometry {
|
||||
public:
|
||||
DelaunayConstraint() { }
|
||||
|
||||
/** Each primitiveset is a list of vertices which may be closed by joining up to its start
|
||||
/** Each primitiveset is a list of vertices which may be closed by joining up to its start
|
||||
* to make a loop. Constraints should be simple lines, not crossing themselves.
|
||||
* Constraints which cross other constraints can cause difficulties - see the example
|
||||
* for methods of dealing with them. */
|
||||
@@ -56,9 +56,9 @@ public:
|
||||
|
||||
/** Get the filling primitive. One:
|
||||
* triangulate must have bneen called and
|
||||
* two: triangle list is filled when
|
||||
* two: triangle list is filled when
|
||||
* DelaunayTriangulator::removeInternalTriangles is called.
|
||||
* These return the triangles removed from the delaunay triangulation by
|
||||
* These return the triangles removed from the delaunay triangulation by
|
||||
* DelaunayTriangulator::removeInternalTriangles. */
|
||||
inline const osg::DrawElementsUInt *getTriangles() const { return prim_tris_.get(); }
|
||||
|
||||
@@ -81,7 +81,7 @@ public:
|
||||
/** remove from line the vertices that are inside dco
|
||||
*/
|
||||
void removeVerticesInside(const DelaunayConstraint *dco);
|
||||
|
||||
|
||||
/** return winding number as a float of loop around testpoint; may use multiple loops
|
||||
* does not reject points on the edge or very very close to the edge */
|
||||
float windingNumber(const osg::Vec3 &testpoint) const ;
|
||||
@@ -150,7 +150,7 @@ public:
|
||||
|
||||
/** Get the generated primitive (call triangulate() first). */
|
||||
inline osg::DrawElementsUInt *getTriangles() { return prim_tris_.get(); }
|
||||
|
||||
|
||||
/** remove the triangles internal to the constraint loops.
|
||||
* (Line strips cannot remove any internal triangles). */
|
||||
void removeInternalTriangles(DelaunayConstraint *constraint);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -35,25 +35,25 @@ class OSGUTIL_EXPORT DisplayRequirementsVisitor : public osg::NodeVisitor
|
||||
* requiresRGB and requiresDepthBuffer to true and with
|
||||
* alpha and stencil off.*/
|
||||
DisplayRequirementsVisitor();
|
||||
|
||||
|
||||
META_NodeVisitor("osgUtil","DisplayRequirementsVisitor")
|
||||
|
||||
/** Set the DisplaySettings. */
|
||||
inline void setDisplaySettings(osg::DisplaySettings* ds) { _ds = ds; }
|
||||
|
||||
|
||||
/** Get the DisplaySettings */
|
||||
inline const osg::DisplaySettings* getDisplaySettings() const { return _ds.get(); }
|
||||
|
||||
|
||||
virtual void applyStateSet(osg::StateSet& stateset);
|
||||
|
||||
virtual void apply(osg::Node& node);
|
||||
|
||||
virtual void apply(osg::Geode& geode);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
osg::ref_ptr<osg::DisplaySettings> _ds;
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
#ifndef OSGUTIL_DRAWELEMENTTYPESIMPLIFIER
|
||||
@@ -31,7 +31,7 @@ class OSGUTIL_EXPORT DrawElementTypeSimplifier
|
||||
class OSGUTIL_EXPORT DrawElementTypeSimplifierVisitor : public osg::NodeVisitor
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
META_NodeVisitor("osgUtil","DrawElementTypeSimplifierVisitor");
|
||||
|
||||
void apply(osg::Geode& node);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -62,14 +62,14 @@ namespace osgUtil {
|
||||
class OSGUTIL_EXPORT EdgeCollector
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
struct Triangle;
|
||||
struct Edge;
|
||||
struct Edgeloop;
|
||||
struct Point;
|
||||
|
||||
typedef std::list<osg::ref_ptr<osg::UIntArray> > IndexArrayList;
|
||||
|
||||
|
||||
~EdgeCollector();
|
||||
|
||||
void setGeometry(osg::Geometry* geometry);
|
||||
@@ -89,7 +89,7 @@ public:
|
||||
struct OSGUTIL_EXPORT Point : public osg::Referenced
|
||||
{
|
||||
Point(): _protected(false), _index(0) {}
|
||||
|
||||
|
||||
bool _protected;
|
||||
|
||||
unsigned int _index;
|
||||
@@ -100,7 +100,7 @@ public:
|
||||
void clear() { _triangles.clear(); }
|
||||
|
||||
bool operator < ( const Point& rhs) const { return _vertex < rhs._vertex; }
|
||||
|
||||
|
||||
bool isBoundaryPoint() const;
|
||||
};
|
||||
|
||||
@@ -110,99 +110,99 @@ public:
|
||||
|
||||
osg::ref_ptr<Point> _p1;
|
||||
osg::ref_ptr<Point> _p2;
|
||||
|
||||
|
||||
osg::ref_ptr<Point> _op1;
|
||||
osg::ref_ptr<Point> _op2;
|
||||
|
||||
|
||||
TriangleSet _triangles;
|
||||
|
||||
|
||||
|
||||
bool operator < ( const Edge& rhs) const;
|
||||
|
||||
|
||||
bool operator == ( const Edge& rhs) const;
|
||||
|
||||
bool operator != ( const Edge& rhs) const;
|
||||
|
||||
|
||||
void setOrderedPoints(Point* p1, Point* p2);
|
||||
|
||||
|
||||
void addTriangle(Triangle* triangle) { _triangles.insert(triangle); }
|
||||
|
||||
|
||||
bool isBoundaryEdge() const { return _triangles.size()<=1; }
|
||||
|
||||
|
||||
bool isAdjacentToBoundary() const { return isBoundaryEdge() || _p1->isBoundaryPoint() || _p2->isBoundaryPoint(); }
|
||||
|
||||
|
||||
bool endConnected(const Edge& rhs) const { return (_op2 == rhs._op1); }
|
||||
|
||||
|
||||
bool beginConnected(const Edge& rhs) const { return (_op1 == rhs._op2); }
|
||||
};
|
||||
|
||||
struct OSGUTIL_EXPORT Triangle : public osg::Referenced
|
||||
{
|
||||
Triangle() {}
|
||||
|
||||
|
||||
void clear();
|
||||
|
||||
bool operator < (const Triangle& rhs) const;
|
||||
|
||||
void setOrderedPoints(Point* p1, Point* p2, Point* p3);
|
||||
|
||||
|
||||
float distance(const osg::Vec3& vertex) const { return _plane.distance(vertex); }
|
||||
|
||||
|
||||
bool isBoundaryTriangle() const
|
||||
{ return (_e1->isBoundaryEdge() || _e2->isBoundaryEdge() || _e3->isBoundaryEdge()); }
|
||||
|
||||
|
||||
|
||||
osg::ref_ptr<Point> _p1;
|
||||
osg::ref_ptr<Point> _p2;
|
||||
osg::ref_ptr<Point> _p3;
|
||||
|
||||
|
||||
osg::ref_ptr<Point> _op1;
|
||||
osg::ref_ptr<Point> _op2;
|
||||
osg::ref_ptr<Point> _op3;
|
||||
|
||||
|
||||
osg::ref_ptr<Edge> _e1;
|
||||
osg::ref_ptr<Edge> _e2;
|
||||
osg::ref_ptr<Edge> _e3;
|
||||
|
||||
osg::Plane _plane;
|
||||
|
||||
osg::Plane _plane;
|
||||
};
|
||||
|
||||
struct OSGUTIL_EXPORT Edgeloop : public osg::Referenced
|
||||
{
|
||||
typedef std::vector<osg::ref_ptr<Edge> > EdgeList;
|
||||
|
||||
|
||||
bool isClosed() { return (_edgeList.back()->endConnected(*_edgeList.front().get())); }
|
||||
|
||||
|
||||
osg::UIntArray * toIndexArray() const;
|
||||
|
||||
|
||||
EdgeList _edgeList;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
Triangle* addTriangle(unsigned int p1, unsigned int p2, unsigned int p3);
|
||||
Triangle* addTriangle(Point* p1, Point* p2, Point* p3);
|
||||
|
||||
Edge* addEdge(Triangle* triangle, Point* p1, Point* p2);
|
||||
|
||||
|
||||
Point* addPoint(Triangle* triangle, unsigned int p1) { return addPoint(triangle,_originalPointList[p1].get()); }
|
||||
Point* addPoint(Triangle* triangle, Point* point);
|
||||
|
||||
|
||||
void getBoundaryEdgeList(EdgeList & el);
|
||||
bool extractBoundaryEdgeloop(EdgeList & el, Edgeloop & edgeloop);
|
||||
bool extractBoundaryEdgeloopList(EdgeList & el, EdgeloopList & edgeloopList);
|
||||
|
||||
|
||||
void getEdgeloopIndexList(IndexArrayList & ial);
|
||||
|
||||
|
||||
//protected:
|
||||
|
||||
|
||||
osg::Geometry* _geometry;
|
||||
|
||||
|
||||
EdgeSet _edgeSet;
|
||||
TriangleSet _triangleSet;
|
||||
PointSet _pointSet;
|
||||
PointList _originalPointList;
|
||||
|
||||
|
||||
};
|
||||
|
||||
} // end of osgUtil namespace
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -37,8 +37,8 @@
|
||||
# define OSGUTIL_EXPORT __declspec(dllimport)
|
||||
#endif
|
||||
#else
|
||||
#define OSGUTIL_EXPORT
|
||||
#endif
|
||||
#define OSGUTIL_EXPORT
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
namespace osgUtil {
|
||||
|
||||
/** Visitor for traversing scene graph and setting each osg::Drawable's _useDisplayList flag,
|
||||
/** Visitor for traversing scene graph and setting each osg::Drawable's _useDisplayList flag,
|
||||
* with option to immediately compile osg::Drawable OpenGL Display lists and
|
||||
* osg::StateAttribute's.
|
||||
*/
|
||||
@@ -44,38 +44,38 @@ class OSGUTIL_EXPORT GLObjectsVisitor : public osg::NodeVisitor
|
||||
SWITCH_OFF_VERTEX_BUFFER_OBJECTS = 0x80,
|
||||
CHECK_BLACK_LISTED_MODES = 0x100
|
||||
};
|
||||
|
||||
|
||||
typedef unsigned int Mode;
|
||||
|
||||
/** 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
|
||||
* node according to specified mode, such as to compile or release
|
||||
* display list/texture objects etc. Default mode is to compile
|
||||
* GL objects.
|
||||
*/
|
||||
GLObjectsVisitor(Mode mode=COMPILE_DISPLAY_LISTS|COMPILE_STATE_ATTRIBUTES|CHECK_BLACK_LISTED_MODES);
|
||||
|
||||
GLObjectsVisitor(Mode mode=COMPILE_DISPLAY_LISTS|COMPILE_STATE_ATTRIBUTES|CHECK_BLACK_LISTED_MODES);
|
||||
|
||||
META_NodeVisitor("osg","GLObjectsVisitor")
|
||||
|
||||
|
||||
virtual void reset()
|
||||
{
|
||||
_drawablesAppliedSet.clear();
|
||||
_stateSetAppliedSet.clear();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** Set the operational mode of what operations to do on the scene graph.*/
|
||||
void setMode(Mode mode) { _mode = mode; }
|
||||
|
||||
/** Get the operational mode.*/
|
||||
Mode getMode() const { return _mode; }
|
||||
|
||||
|
||||
|
||||
/** Set the State to use during traversal. */
|
||||
void setState(osg::State* state)
|
||||
{
|
||||
_renderInfo.setState(state);
|
||||
}
|
||||
|
||||
|
||||
osg::State* getState()
|
||||
{
|
||||
return _renderInfo.getState();
|
||||
@@ -85,7 +85,7 @@ class OSGUTIL_EXPORT GLObjectsVisitor : public osg::NodeVisitor
|
||||
{
|
||||
_renderInfo = renderInfo;
|
||||
}
|
||||
|
||||
|
||||
osg::RenderInfo& getRenderInfo()
|
||||
{
|
||||
return _renderInfo;
|
||||
@@ -93,8 +93,8 @@ class OSGUTIL_EXPORT GLObjectsVisitor : public osg::NodeVisitor
|
||||
|
||||
/** Simply traverse using standard NodeVisitor traverse method.*/
|
||||
virtual void apply(osg::Node& node);
|
||||
|
||||
/** For each Geode visited set the display list usage according to the
|
||||
|
||||
/** For each Geode visited set the display list usage according to the
|
||||
* _displayListMode.
|
||||
*/
|
||||
virtual void apply(osg::Geode& node);
|
||||
@@ -124,9 +124,9 @@ class OSGUTIL_EXPORT GLObjectsOperation : public osg::GraphicsOperation
|
||||
GLObjectsOperation(osg::Node* subgraph, GLObjectsVisitor::Mode mode = GLObjectsVisitor::COMPILE_DISPLAY_LISTS|GLObjectsVisitor::COMPILE_STATE_ATTRIBUTES|GLObjectsVisitor::CHECK_BLACK_LISTED_MODES);
|
||||
|
||||
virtual void operator () (osg::GraphicsContext* context);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
osg::ref_ptr<osg::Node> _subgraph;
|
||||
GLObjectsVisitor::Mode _mode;
|
||||
};
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
#ifndef OSGUTIL_HALFWAYMAPGENERATOR_
|
||||
@@ -20,9 +20,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.
|
||||
* 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.
|
||||
*/
|
||||
class OSGUTIL_EXPORT HalfWayMapGenerator: public CubeMapGenerator {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
#ifndef OSGUTIL_HIGHLIGHTMAPGENERATOR_
|
||||
@@ -20,17 +20,17 @@
|
||||
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
|
||||
/** 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.
|
||||
*/
|
||||
class OSGUTIL_EXPORT HighlightMapGenerator: public CubeMapGenerator {
|
||||
public:
|
||||
HighlightMapGenerator(
|
||||
const osg::Vec3 &light_direction,
|
||||
const osg::Vec4 &light_color,
|
||||
float specular_exponent,
|
||||
const osg::Vec3 &light_direction,
|
||||
const osg::Vec4 &light_color,
|
||||
float specular_exponent,
|
||||
int texture_size = 64);
|
||||
|
||||
HighlightMapGenerator(const HighlightMapGenerator ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -72,17 +72,17 @@ class OSGUTIL_EXPORT IncrementalCompileOperation : public osg::GraphicsOperation
|
||||
* time to set aside the faster databases will be paged in but with increased chance of frame drops,
|
||||
* the lower the amount of time the set aside the slower databases will paged it but with better
|
||||
* chance of avoid any frame drops. The default values are chosen to achieve the later when running
|
||||
* on a modern mid to high end PC.
|
||||
* on a modern mid to high end PC.
|
||||
* The way to compute the amount of available time use a scheme such as :
|
||||
* availableTime = maximum(1.0/targetFrameRate - timeTakenDuringUpdateCullAndDraw, minimumTimeAvailableForGLCompileAndDeletePerFrame).
|
||||
* availableTime = maximum(1.0/targetFrameRate - timeTakenDuringUpdateCullAndDraw, minimumTimeAvailableForGLCompileAndDeletePerFrame).
|
||||
*/
|
||||
void setTargetFrameRate(double tfr) { _targetFrameRate = tfr; }
|
||||
|
||||
/** Get the target frame rate that the IncrementalCompileOperation should assume.*/
|
||||
double getTargetFrameRate() const { return _targetFrameRate; }
|
||||
|
||||
|
||||
/** Set the minimum amount of time (in seconds) that should be made available for compiling and delete OpenGL objects per frame.
|
||||
* Default value is 0.001 (1 millisecond).
|
||||
* Default value is 0.001 (1 millisecond).
|
||||
* For usage see notes in setTargetFrameRate.*/
|
||||
void setMinimumTimeAvailableForGLCompileAndDeletePerFrame(double ta) { _minimumTimeAvailableForGLCompileAndDeletePerFrame = ta; }
|
||||
|
||||
@@ -175,7 +175,7 @@ class OSGUTIL_EXPORT IncrementalCompileOperation : public osg::GraphicsOperation
|
||||
double allocatedTime;
|
||||
osg::ElapsedTime timer;
|
||||
};
|
||||
|
||||
|
||||
struct CompileOp : public osg::Referenced
|
||||
{
|
||||
/** return an estimate for how many seconds the compile will take.*/
|
||||
@@ -230,7 +230,7 @@ class OSGUTIL_EXPORT IncrementalCompileOperation : public osg::GraphicsOperation
|
||||
|
||||
|
||||
class CompileSet;
|
||||
|
||||
|
||||
struct CompileCompletedCallback : public virtual osg::Referenced
|
||||
{
|
||||
/// return true if the callback assumes responsibility for merging any associated subgraphs with the main scene graph
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -30,16 +30,16 @@ namespace osgUtil {
|
||||
|
||||
|
||||
class OSGUTIL_EXPORT Hit
|
||||
{
|
||||
{
|
||||
/** Deprecated */
|
||||
public:
|
||||
|
||||
Hit();
|
||||
Hit(const Hit& hit);
|
||||
~Hit();
|
||||
|
||||
|
||||
Hit& operator = (const Hit& hit);
|
||||
|
||||
|
||||
typedef std::vector<int> VecIndexList;
|
||||
|
||||
bool operator < (const Hit& hit) const
|
||||
@@ -48,11 +48,11 @@ class OSGUTIL_EXPORT Hit
|
||||
if (hit._originalLineSegment<_originalLineSegment) return false;
|
||||
return _ratio<hit._ratio;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const osg::Vec3& getLocalIntersectPoint() const { return _intersectPoint; }
|
||||
const osg::Vec3& getLocalIntersectNormal() const { return _intersectNormal; }
|
||||
|
||||
|
||||
const osg::Vec3 getWorldIntersectPoint() const { if (_matrix.valid()) return _intersectPoint*(*_matrix); else return _intersectPoint; }
|
||||
const osg::Vec3 getWorldIntersectNormal() const ;
|
||||
|
||||
@@ -69,8 +69,8 @@ class OSGUTIL_EXPORT Hit
|
||||
const osg::RefMatrix* getInverseMatrix() const { return _inverse.get(); }
|
||||
const VecIndexList& getVecIndexList() const { return _vecIndexList; }
|
||||
int getPrimitiveIndex() const { return _primitiveIndex; }
|
||||
|
||||
|
||||
|
||||
|
||||
float _ratio;
|
||||
osg::ref_ptr<osg::LineSegment> _originalLineSegment;
|
||||
osg::ref_ptr<osg::LineSegment> _localLineSegment;
|
||||
@@ -79,7 +79,7 @@ class OSGUTIL_EXPORT Hit
|
||||
osg::ref_ptr<osg::Drawable> _drawable;
|
||||
osg::ref_ptr<osg::RefMatrix> _matrix;
|
||||
osg::ref_ptr<osg::RefMatrix> _inverse;
|
||||
|
||||
|
||||
VecIndexList _vecIndexList;
|
||||
int _primitiveIndex;
|
||||
osg::Vec3 _intersectPoint;
|
||||
@@ -100,7 +100,7 @@ class OSGUTIL_EXPORT IntersectVisitor : public osg::NodeVisitor
|
||||
META_NodeVisitor("osgUtil","IntersectVisitor")
|
||||
|
||||
void reset();
|
||||
|
||||
|
||||
/** Add a line segment to use for intersection testing during scene traversal.
|
||||
* Note, a maximum of 32 line segments can be added to a IntersectVistor,
|
||||
* adding more than this will result in warning being emitted to the console
|
||||
@@ -113,7 +113,7 @@ class OSGUTIL_EXPORT IntersectVisitor : public osg::NodeVisitor
|
||||
HitList& getHitList(const osg::LineSegment* seg) { return _segHitList[seg]; }
|
||||
|
||||
int getNumHits(const osg::LineSegment* seg) { return _segHitList[seg].size(); }
|
||||
|
||||
|
||||
LineSegmentHitListMap& getSegHitList() { return _segHitList; }
|
||||
|
||||
bool hits();
|
||||
@@ -123,7 +123,7 @@ class OSGUTIL_EXPORT IntersectVisitor : public osg::NodeVisitor
|
||||
USE_HIGHEST_LEVEL_OF_DETAIL,
|
||||
USE_SEGMENT_START_POINT_AS_EYE_POINT_FOR_LOD_LEVEL_SELECTION
|
||||
};
|
||||
|
||||
|
||||
void setLODSelectionMode(LODSelectionMode mode) { _lodSelectionMode = mode; }
|
||||
LODSelectionMode getLODSelectionMode() const { return _lodSelectionMode; }
|
||||
|
||||
@@ -190,11 +190,11 @@ class OSGUTIL_EXPORT IntersectVisitor : public osg::NodeVisitor
|
||||
void leaveNode();
|
||||
|
||||
typedef std::vector<osg::ref_ptr<IntersectState> > IntersectStateStack;
|
||||
|
||||
|
||||
IntersectStateStack _intersectStateStack;
|
||||
|
||||
LineSegmentHitListMap _segHitList;
|
||||
|
||||
|
||||
LODSelectionMode _lodSelectionMode;
|
||||
osg::Vec3 _pseudoEyePoint;
|
||||
};
|
||||
@@ -213,7 +213,7 @@ class OSGUTIL_EXPORT PickVisitor : public osgUtil::IntersectVisitor
|
||||
void apply(osg::Camera& camera);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
float _mx;
|
||||
float _my;
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -27,7 +27,7 @@ template <class T>
|
||||
class OperationArrayFunctor : public osg::ArrayVisitor, public T
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
virtual void apply(osg::Array&) {}
|
||||
// virtual void apply(osg::ByteArray& array) { T::process<osg::ByteArray>(array); }
|
||||
// virtual void apply(osg::ShortArray& array) { T::process(array); }
|
||||
@@ -60,26 +60,26 @@ class OperationArrayFunctor : public osg::ArrayVisitor, public T
|
||||
struct AddRangeOperator
|
||||
{
|
||||
template <typename ArrayType>
|
||||
void process(ArrayType & array)
|
||||
{
|
||||
void process(ArrayType & array)
|
||||
{
|
||||
typedef typename ArrayType::ElementDataType ElementDataType;
|
||||
|
||||
|
||||
ElementDataType convertedVector;
|
||||
osgUtil::ConvertVec<osg::Vec3d, ElementDataType>::convert(_vector, convertedVector);
|
||||
|
||||
|
||||
typename ArrayType::iterator it = array.begin();
|
||||
std::advance(it, _begin);
|
||||
|
||||
|
||||
typename ArrayType::iterator end = it;
|
||||
std::advance(end, _count);
|
||||
|
||||
|
||||
for (; it < end; ++it)
|
||||
(*it) += convertedVector;
|
||||
}
|
||||
|
||||
unsigned int _begin;
|
||||
unsigned int _count;
|
||||
|
||||
|
||||
osg::Vec3d _vector;
|
||||
};
|
||||
typedef OperationArrayFunctor<AddRangeOperator> AddRangeFunctor;
|
||||
@@ -87,26 +87,26 @@ typedef OperationArrayFunctor<AddRangeOperator> AddRangeFunctor;
|
||||
struct MultiplyRangeOperator
|
||||
{
|
||||
template <typename ArrayType>
|
||||
void process(ArrayType & array)
|
||||
{
|
||||
void process(ArrayType & array)
|
||||
{
|
||||
typedef typename ArrayType::ElementDataType ElementDataType;
|
||||
|
||||
|
||||
ElementDataType convertedVector;
|
||||
osgUtil::ConvertVec<osg::Vec3d, ElementDataType>::convert(_vector, convertedVector);
|
||||
|
||||
|
||||
typename ArrayType::iterator it = array.begin();
|
||||
std::advance(it, _begin);
|
||||
|
||||
|
||||
typename ArrayType::iterator end = it;
|
||||
std::advance(end, _count);
|
||||
|
||||
|
||||
for (; it < end; ++it)
|
||||
(*it) *= convertedVector;
|
||||
}
|
||||
|
||||
unsigned int _begin;
|
||||
unsigned int _count;
|
||||
|
||||
|
||||
osg::Vec3d _vector;
|
||||
};
|
||||
typedef OperationArrayFunctor<MultiplyRangeOperator> MultiplyRangeFunctor;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -44,7 +44,7 @@ class OSGUTIL_EXPORT BaseOptimizerVisitor : public osg::NodeVisitor
|
||||
|
||||
inline bool isOperationPermissibleForObject(const osg::StateSet* object) const;
|
||||
inline bool isOperationPermissibleForObject(const osg::StateAttribute* object) const;
|
||||
inline bool isOperationPermissibleForObject(const osg::Drawable* object) const;
|
||||
inline bool isOperationPermissibleForObject(const osg::Drawable* object) const;
|
||||
inline bool isOperationPermissibleForObject(const osg::Node* object) const;
|
||||
|
||||
protected:
|
||||
@@ -56,7 +56,7 @@ class OSGUTIL_EXPORT BaseOptimizerVisitor : public osg::NodeVisitor
|
||||
/** Traverses scene graph to improve efficiency. See OptimizationOptions.
|
||||
* For example of usage see examples/osgimpostor or osgviewer.
|
||||
*/
|
||||
|
||||
|
||||
class OSGUTIL_EXPORT Optimizer
|
||||
{
|
||||
|
||||
@@ -117,7 +117,7 @@ class OSGUTIL_EXPORT Optimizer
|
||||
|
||||
/** Reset internal data to initial state - the getPermissibleOptionsMap is cleared.*/
|
||||
void reset();
|
||||
|
||||
|
||||
/** Traverse the node and its subgraph with a series of optimization
|
||||
* visitors, specified by the OptimizationOptions.*/
|
||||
void optimize(osg::Node* node);
|
||||
@@ -127,38 +127,38 @@ class OSGUTIL_EXPORT Optimizer
|
||||
virtual void optimize(osg::Node* node, unsigned int options);
|
||||
|
||||
|
||||
/** Callback for customizing what operations are permitted on objects in the scene graph.*/
|
||||
/** Callback for customizing what operations are permitted on objects in the scene graph.*/
|
||||
struct IsOperationPermissibleForObjectCallback : public osg::Referenced
|
||||
{
|
||||
virtual bool isOperationPermissibleForObjectImplementation(const Optimizer* optimizer, const osg::StateSet* stateset,unsigned int option) const
|
||||
{
|
||||
return optimizer->isOperationPermissibleForObjectImplementation(stateset,option);
|
||||
}
|
||||
|
||||
|
||||
virtual bool isOperationPermissibleForObjectImplementation(const Optimizer* optimizer, const osg::StateAttribute* attribute,unsigned int option) const
|
||||
{
|
||||
return optimizer->isOperationPermissibleForObjectImplementation(attribute,option);
|
||||
}
|
||||
|
||||
|
||||
virtual bool isOperationPermissibleForObjectImplementation(const Optimizer* optimizer, const osg::Drawable* drawable,unsigned int option) const
|
||||
{
|
||||
return optimizer->isOperationPermissibleForObjectImplementation(drawable,option);
|
||||
}
|
||||
|
||||
|
||||
virtual bool isOperationPermissibleForObjectImplementation(const Optimizer* optimizer, const osg::Node* node,unsigned int option) const
|
||||
{
|
||||
return optimizer->isOperationPermissibleForObjectImplementation(node,option);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
/** Set the callback for customizing what operations are permitted on objects in the scene graph.*/
|
||||
|
||||
/** Set the callback for customizing what operations are permitted on objects in the scene graph.*/
|
||||
void setIsOperationPermissibleForObjectCallback(IsOperationPermissibleForObjectCallback* callback) { _isOperationPermissibleForObjectCallback=callback; }
|
||||
|
||||
/** Get the callback for customizing what operations are permitted on objects in the scene graph.*/
|
||||
/** Get the callback for customizing what operations are permitted on objects in the scene graph.*/
|
||||
IsOperationPermissibleForObjectCallback* getIsOperationPermissibleForObjectCallback() { return _isOperationPermissibleForObjectCallback.get(); }
|
||||
|
||||
/** Get the callback for customizing what operations are permitted on objects in the scene graph.*/
|
||||
/** Get the callback for customizing what operations are permitted on objects in the scene graph.*/
|
||||
const IsOperationPermissibleForObjectCallback* getIsOperationPermissibleForObjectCallback() const { return _isOperationPermissibleForObjectCallback.get(); }
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ class OSGUTIL_EXPORT Optimizer
|
||||
{
|
||||
_permissibleOptimizationsMap[object] = options;
|
||||
}
|
||||
|
||||
|
||||
inline unsigned int getPermissibleOptimizationsForObject(const osg::Object* object) const
|
||||
{
|
||||
PermissibleOptimizationsMap::const_iterator itr = _permissibleOptimizationsMap.find(object);
|
||||
@@ -179,39 +179,39 @@ class OSGUTIL_EXPORT Optimizer
|
||||
{
|
||||
if (_isOperationPermissibleForObjectCallback.valid())
|
||||
return _isOperationPermissibleForObjectCallback->isOperationPermissibleForObjectImplementation(this,object,option);
|
||||
else
|
||||
return isOperationPermissibleForObjectImplementation(object,option);
|
||||
else
|
||||
return isOperationPermissibleForObjectImplementation(object,option);
|
||||
}
|
||||
|
||||
inline bool isOperationPermissibleForObject(const osg::StateAttribute* object, unsigned int option) const
|
||||
{
|
||||
if (_isOperationPermissibleForObjectCallback.valid())
|
||||
return _isOperationPermissibleForObjectCallback->isOperationPermissibleForObjectImplementation(this,object,option);
|
||||
else
|
||||
return isOperationPermissibleForObjectImplementation(object,option);
|
||||
else
|
||||
return isOperationPermissibleForObjectImplementation(object,option);
|
||||
}
|
||||
|
||||
inline bool isOperationPermissibleForObject(const osg::Drawable* object, unsigned int option) const
|
||||
{
|
||||
if (_isOperationPermissibleForObjectCallback.valid())
|
||||
return _isOperationPermissibleForObjectCallback->isOperationPermissibleForObjectImplementation(this,object,option);
|
||||
else
|
||||
return isOperationPermissibleForObjectImplementation(object,option);
|
||||
else
|
||||
return isOperationPermissibleForObjectImplementation(object,option);
|
||||
}
|
||||
|
||||
inline bool isOperationPermissibleForObject(const osg::Node* object, unsigned int option) const
|
||||
{
|
||||
if (_isOperationPermissibleForObjectCallback.valid())
|
||||
return _isOperationPermissibleForObjectCallback->isOperationPermissibleForObjectImplementation(this,object,option);
|
||||
else
|
||||
return isOperationPermissibleForObjectImplementation(object,option);
|
||||
else
|
||||
return isOperationPermissibleForObjectImplementation(object,option);
|
||||
}
|
||||
|
||||
bool isOperationPermissibleForObjectImplementation(const osg::StateSet* stateset, unsigned int option) const
|
||||
{
|
||||
return (option & getPermissibleOptimizationsForObject(stateset))!=0;
|
||||
}
|
||||
|
||||
|
||||
bool isOperationPermissibleForObjectImplementation(const osg::StateAttribute* attribute, unsigned int option) const
|
||||
{
|
||||
return (option & getPermissibleOptimizationsForObject(attribute))!=0;
|
||||
@@ -245,21 +245,21 @@ class OSGUTIL_EXPORT Optimizer
|
||||
|
||||
return (option & getPermissibleOptimizationsForObject(node))!=0;
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
osg::ref_ptr<IsOperationPermissibleForObjectCallback> _isOperationPermissibleForObjectCallback;
|
||||
|
||||
typedef std::map<const osg::Object*,unsigned int> PermissibleOptimizationsMap;
|
||||
PermissibleOptimizationsMap _permissibleOptimizationsMap;
|
||||
|
||||
PermissibleOptimizationsMap _permissibleOptimizationsMap;
|
||||
|
||||
public:
|
||||
|
||||
/** 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. Static transformed Subgraphs that have multiple
|
||||
* parental paths above them are not flattened, if you require this then
|
||||
* the subgraphs have to be duplicated - for this use the
|
||||
* the subgraphs have to be duplicated - for this use the
|
||||
* FlattenStaticTransformsDuplicatingSharedSubgraphsVisitor. */
|
||||
class OSGUTIL_EXPORT FlattenStaticTransformsVisitor : public BaseOptimizerVisitor
|
||||
{
|
||||
@@ -284,7 +284,7 @@ class OSGUTIL_EXPORT Optimizer
|
||||
typedef std::set<osg::Billboard*> BillboardSet;
|
||||
typedef std::set<osg::Node* > NodeSet;
|
||||
typedef std::set<osg::Transform*> TransformSet;
|
||||
|
||||
|
||||
TransformStack _transformStack;
|
||||
NodeSet _excludedNodeSet;
|
||||
DrawableSet _drawableSet;
|
||||
@@ -298,7 +298,7 @@ class OSGUTIL_EXPORT Optimizer
|
||||
* but with the difference that any subgraphs that are shared between different transforms
|
||||
* of duplicated and flatten individually. This results in more static transforms
|
||||
* being removed, but also means that more data is generated, and as a result may
|
||||
* not always be the most appropriate flatten visitor to use.*/
|
||||
* not always be the most appropriate flatten visitor to use.*/
|
||||
class OSGUTIL_EXPORT FlattenStaticTransformsDuplicatingSharedSubgraphsVisitor : public BaseOptimizerVisitor
|
||||
{
|
||||
public:
|
||||
@@ -324,7 +324,7 @@ class OSGUTIL_EXPORT Optimizer
|
||||
|
||||
};
|
||||
|
||||
/** Combine Static Transform nodes that sit above one another.*/
|
||||
/** Combine Static Transform nodes that sit above one another.*/
|
||||
class OSGUTIL_EXPORT CombineStaticTransformsVisitor : public BaseOptimizerVisitor
|
||||
{
|
||||
public:
|
||||
@@ -356,7 +356,7 @@ class OSGUTIL_EXPORT Optimizer
|
||||
|
||||
virtual void apply(osg::Geode& geode);
|
||||
virtual void apply(osg::Group& group);
|
||||
|
||||
|
||||
void removeEmptyNodes();
|
||||
|
||||
};
|
||||
@@ -371,12 +371,12 @@ class OSGUTIL_EXPORT Optimizer
|
||||
|
||||
RemoveRedundantNodesVisitor(Optimizer* optimizer=0):
|
||||
BaseOptimizerVisitor(optimizer, REMOVE_REDUNDANT_NODES) {}
|
||||
|
||||
|
||||
virtual void apply(osg::Group& group);
|
||||
virtual void apply(osg::Transform& transform);
|
||||
|
||||
|
||||
bool isOperationPermissible(osg::Node& node);
|
||||
|
||||
|
||||
void removeRedundantNodes();
|
||||
|
||||
};
|
||||
@@ -391,9 +391,9 @@ class OSGUTIL_EXPORT Optimizer
|
||||
|
||||
RemoveLoadedProxyNodesVisitor(Optimizer* optimizer=0):
|
||||
BaseOptimizerVisitor(optimizer, REMOVE_LOADED_PROXY_NODES) {}
|
||||
|
||||
|
||||
virtual void apply(osg::ProxyNode& group);
|
||||
|
||||
|
||||
void removeRedundantNodes();
|
||||
|
||||
};
|
||||
@@ -430,7 +430,7 @@ class OSGUTIL_EXPORT Optimizer
|
||||
void combineLODs();
|
||||
|
||||
};
|
||||
|
||||
|
||||
/** Optimize State in the scene graph by removing duplicate state,
|
||||
* replacing it with shared instances, both for StateAttributes,
|
||||
* and whole StateSets.*/
|
||||
@@ -450,7 +450,7 @@ class OSGUTIL_EXPORT Optimizer
|
||||
_optimize[osg::Object::UNSPECIFIED] = combineUnspecifiedState;
|
||||
}
|
||||
|
||||
/** empty visitor, make it ready for next traversal.*/
|
||||
/** empty visitor, make it ready for next traversal.*/
|
||||
virtual void reset();
|
||||
|
||||
virtual void apply(osg::Node& node);
|
||||
@@ -462,7 +462,7 @@ class OSGUTIL_EXPORT Optimizer
|
||||
protected:
|
||||
|
||||
void addStateSet(osg::StateSet* stateset,osg::Object* obj);
|
||||
|
||||
|
||||
inline bool optimize(osg::Object::DataVariance variance)
|
||||
{
|
||||
return _optimize[variance];
|
||||
@@ -473,7 +473,7 @@ class OSGUTIL_EXPORT Optimizer
|
||||
|
||||
// note, one element for DYNAMIC, STATIC and UNSPECIFIED
|
||||
bool _optimize[3];
|
||||
|
||||
|
||||
StateSetMap _statesets;
|
||||
|
||||
};
|
||||
@@ -509,9 +509,9 @@ class OSGUTIL_EXPORT Optimizer
|
||||
virtual void apply(osg::Geode& geode) { checkGeode(geode); }
|
||||
|
||||
void checkGeode(osg::Geode& geode);
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
class OSGUTIL_EXPORT MakeFastGeometryVisitor : public BaseOptimizerVisitor
|
||||
{
|
||||
public:
|
||||
@@ -523,9 +523,9 @@ class OSGUTIL_EXPORT Optimizer
|
||||
virtual void apply(osg::Geode& geode) { checkGeode(geode); }
|
||||
|
||||
void checkGeode(osg::Geode& geode);
|
||||
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
class OSGUTIL_EXPORT MergeGeometryVisitor : public BaseOptimizerVisitor
|
||||
{
|
||||
public:
|
||||
@@ -539,7 +539,7 @@ class OSGUTIL_EXPORT Optimizer
|
||||
{
|
||||
_targetMaximumNumberOfVertices = num;
|
||||
}
|
||||
|
||||
|
||||
unsigned int getTargetMaximumNumberOfVertices() const
|
||||
{
|
||||
return _targetMaximumNumberOfVertices;
|
||||
@@ -573,15 +573,15 @@ class OSGUTIL_EXPORT Optimizer
|
||||
|
||||
SpatializeGroupsVisitor(Optimizer* optimizer=0):
|
||||
BaseOptimizerVisitor(optimizer, SPATIALIZE_GROUPS) {}
|
||||
|
||||
|
||||
virtual void apply(osg::Group& group);
|
||||
virtual void apply(osg::Geode& geode);
|
||||
|
||||
|
||||
bool divide(unsigned int maxNumTreesPerCell=8);
|
||||
|
||||
|
||||
bool divide(osg::Group* group, unsigned int maxNumTreesPerCell);
|
||||
bool divide(osg::Geode* geode, unsigned int maxNumTreesPerCell);
|
||||
|
||||
|
||||
typedef std::set<osg::Group*> GroupsToDivideList;
|
||||
GroupsToDivideList _groupsToDivideList;
|
||||
|
||||
@@ -596,14 +596,14 @@ class OSGUTIL_EXPORT Optimizer
|
||||
|
||||
CopySharedSubgraphsVisitor(Optimizer* optimizer=0):
|
||||
BaseOptimizerVisitor(optimizer, COPY_SHARED_NODES) {}
|
||||
|
||||
|
||||
virtual void apply(osg::Node& node);
|
||||
|
||||
void copySharedNodes();
|
||||
|
||||
|
||||
typedef std::set<osg::Node*> SharedNodeList;
|
||||
SharedNodeList _sharedNodeList;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -620,7 +620,7 @@ class OSGUTIL_EXPORT Optimizer
|
||||
_changeAutoUnRef(changeAutoUnRef), _valueAutoUnRef(valueAutoUnRef),
|
||||
_changeClientImageStorage(changeClientImageStorage), _valueClientImageStorage(valueClientImageStorage),
|
||||
_changeAnisotropy(changeAnisotropy), _valueAnisotropy(valueAnisotropy) {}
|
||||
|
||||
|
||||
virtual void apply(osg::Geode& node);
|
||||
virtual void apply(osg::Node& node);
|
||||
|
||||
@@ -633,7 +633,7 @@ class OSGUTIL_EXPORT Optimizer
|
||||
float _valueAnisotropy;
|
||||
|
||||
};
|
||||
|
||||
|
||||
/** Flatten MatrixTransform/Billboard pairs.*/
|
||||
class OSGUTIL_EXPORT FlattenBillboardVisitor : public BaseOptimizerVisitor
|
||||
{
|
||||
@@ -648,59 +648,59 @@ class OSGUTIL_EXPORT Optimizer
|
||||
|
||||
virtual void apply(osg::Billboard& billboard);
|
||||
|
||||
void process();
|
||||
void process();
|
||||
|
||||
BillboardNodePathMap _billboards;
|
||||
|
||||
};
|
||||
|
||||
|
||||
/** Texture Atlas Builder creates a set of textures/images which each contain multiple images.
|
||||
* Texture Atlas' are used to make it possible to use much wider batching of data. */
|
||||
class OSGUTIL_EXPORT TextureAtlasBuilder
|
||||
{
|
||||
public:
|
||||
TextureAtlasBuilder();
|
||||
|
||||
|
||||
void reset();
|
||||
|
||||
|
||||
void setMaximumAtlasSize(int width, int height);
|
||||
|
||||
int getMaximumAtlasWidth() const { return _maximumAtlasWidth; }
|
||||
int getMaximumAtlasHeight() const { return _maximumAtlasHeight; }
|
||||
|
||||
|
||||
void setMargin(int margin);
|
||||
int getMargin() const { return _margin; }
|
||||
|
||||
void addSource(const osg::Image* image);
|
||||
void addSource(const osg::Texture2D* texture);
|
||||
|
||||
|
||||
unsigned int getNumSources() const { return _sourceList.size(); }
|
||||
const osg::Image* getSourceImage(unsigned int i) { return _sourceList[i]->_image.get(); }
|
||||
const osg::Texture2D* getSourceTexture(unsigned int i) { return _sourceList[i]->_texture.get(); }
|
||||
|
||||
|
||||
void buildAtlas();
|
||||
osg::Image* getImageAtlas(unsigned int i);
|
||||
osg::Texture2D* getTextureAtlas(unsigned int i);
|
||||
osg::Matrix getTextureMatrix(unsigned int i);
|
||||
|
||||
|
||||
osg::Image* getImageAtlas(const osg::Image* image);
|
||||
osg::Texture2D* getTextureAtlas(const osg::Image* image);
|
||||
osg::Matrix getTextureMatrix(const osg::Image* image);
|
||||
|
||||
|
||||
osg::Image* getImageAtlas(const osg::Texture2D* textue);
|
||||
osg::Texture2D* getTextureAtlas(const osg::Texture2D* texture);
|
||||
osg::Matrix getTextureMatrix(const osg::Texture2D* texture);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
int _maximumAtlasWidth;
|
||||
int _maximumAtlasHeight;
|
||||
int _margin;
|
||||
|
||||
|
||||
|
||||
// forward declare
|
||||
class Atlas;
|
||||
|
||||
|
||||
class Source : public osg::Referenced
|
||||
{
|
||||
public:
|
||||
@@ -712,20 +712,20 @@ class OSGUTIL_EXPORT Optimizer
|
||||
|
||||
Source(const osg::Texture2D* texture):
|
||||
_x(0),_y(0),_atlas(0),_texture(texture) { if (texture) _image = texture->getImage(); }
|
||||
|
||||
|
||||
int _x;
|
||||
int _y;
|
||||
Atlas* _atlas;
|
||||
|
||||
osg::ref_ptr<const osg::Image> _image;
|
||||
osg::ref_ptr<const osg::Texture2D> _texture;
|
||||
|
||||
|
||||
bool suitableForAtlas(int maximumAtlasWidth, int maximumAtlasHeight, int margin);
|
||||
osg::Matrix computeTextureMatrix() const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
virtual ~Source() {}
|
||||
};
|
||||
|
||||
@@ -743,16 +743,16 @@ class OSGUTIL_EXPORT Optimizer
|
||||
_width(0),
|
||||
_height(0),
|
||||
_indexFirstOfRow(0){}
|
||||
|
||||
|
||||
int _maximumAtlasWidth;
|
||||
int _maximumAtlasHeight;
|
||||
int _margin;
|
||||
|
||||
osg::ref_ptr<osg::Texture2D> _texture;
|
||||
osg::ref_ptr<osg::Image> _image;
|
||||
|
||||
|
||||
SourceList _sourceList;
|
||||
|
||||
|
||||
int _x;
|
||||
int _y;
|
||||
int _width;
|
||||
@@ -768,13 +768,13 @@ class OSGUTIL_EXPORT Optimizer
|
||||
bool addSource(Source* source);
|
||||
void clampToNearestPowerOfTwoSize();
|
||||
void copySources();
|
||||
|
||||
|
||||
protected:
|
||||
virtual ~Atlas() {}
|
||||
};
|
||||
|
||||
|
||||
typedef std::vector< osg::ref_ptr<Atlas> > AtlasList;
|
||||
|
||||
|
||||
Source* getSource(const osg::Image* image);
|
||||
Source* getSource(const osg::Texture2D* texture);
|
||||
|
||||
@@ -791,8 +791,8 @@ class OSGUTIL_EXPORT Optimizer
|
||||
void completeRow(unsigned int indexAtlas);
|
||||
};
|
||||
|
||||
|
||||
/** Optimize texture usage in the scene graph by combining textures into texture atlas
|
||||
|
||||
/** Optimize texture usage in the scene graph by combining textures into texture atlas
|
||||
* Use of texture atlas cuts down on the number of seperate states in the scene, reducing
|
||||
* state changes and improving the chances of use larger batches of geomertry.*/
|
||||
class OSGUTIL_EXPORT TextureAtlasVisitor : public BaseOptimizerVisitor
|
||||
@@ -806,7 +806,7 @@ class OSGUTIL_EXPORT Optimizer
|
||||
|
||||
TextureAtlasBuilder& getTextureAtlasBuilder() { return _builder; }
|
||||
|
||||
/** empty visitor, make it ready for next traversal.*/
|
||||
/** empty visitor, make it ready for next traversal.*/
|
||||
virtual void reset();
|
||||
|
||||
virtual void apply(osg::Node& node);
|
||||
@@ -850,7 +850,7 @@ class OSGUTIL_EXPORT Optimizer
|
||||
protected:
|
||||
|
||||
void applyStateSet(osg::StateSet& stateset);
|
||||
|
||||
|
||||
void applyDrawable(osg::Drawable& drawable);
|
||||
|
||||
};
|
||||
@@ -858,22 +858,22 @@ class OSGUTIL_EXPORT Optimizer
|
||||
|
||||
inline bool BaseOptimizerVisitor::isOperationPermissibleForObject(const osg::StateSet* object) const
|
||||
{
|
||||
return _optimizer ? _optimizer->isOperationPermissibleForObject(object,_operationType) : true;
|
||||
return _optimizer ? _optimizer->isOperationPermissibleForObject(object,_operationType) : true;
|
||||
}
|
||||
|
||||
inline bool BaseOptimizerVisitor::isOperationPermissibleForObject(const osg::StateAttribute* object) const
|
||||
{
|
||||
return _optimizer ? _optimizer->isOperationPermissibleForObject(object,_operationType) : true;
|
||||
return _optimizer ? _optimizer->isOperationPermissibleForObject(object,_operationType) : true;
|
||||
}
|
||||
|
||||
inline bool BaseOptimizerVisitor::isOperationPermissibleForObject(const osg::Drawable* object) const
|
||||
{
|
||||
return _optimizer ? _optimizer->isOperationPermissibleForObject(object,_operationType) : true;
|
||||
return _optimizer ? _optimizer->isOperationPermissibleForObject(object,_operationType) : true;
|
||||
}
|
||||
|
||||
inline bool BaseOptimizerVisitor::isOperationPermissibleForObject(const osg::Node* object) const
|
||||
{
|
||||
return _optimizer ? _optimizer->isOperationPermissibleForObject(object,_operationType) : true;
|
||||
return _optimizer ? _optimizer->isOperationPermissibleForObject(object,_operationType) : true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ class OSGUTIL_EXPORT PerlinNoise
|
||||
public:
|
||||
|
||||
PerlinNoise();
|
||||
|
||||
|
||||
void SetNoiseFrequency(int frequency);
|
||||
|
||||
double noise1(double arg);
|
||||
@@ -62,13 +62,13 @@ public:
|
||||
|
||||
osg::Image* create3DNoiseImage(int texSize);
|
||||
osg::Texture3D* create3DNoiseTexture(int texSize );
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
void initNoise(void);
|
||||
|
||||
enum { MAXB = 0x100 };
|
||||
|
||||
|
||||
int p[MAXB + MAXB + 2];
|
||||
double g3[MAXB + MAXB + 2][3];
|
||||
double g2[MAXB + MAXB + 2][2];
|
||||
@@ -77,7 +77,7 @@ protected:
|
||||
int start;
|
||||
int B;
|
||||
int BM;
|
||||
|
||||
|
||||
};
|
||||
|
||||
inline osg::Image* create3DNoiseImage(int texSize)
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace osgUtil {
|
||||
class OSGUTIL_EXPORT PositionalStateContainer : public osg::Object
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
|
||||
PositionalStateContainer();
|
||||
virtual osg::Object* cloneType() const { return new PositionalStateContainer(); }
|
||||
@@ -39,7 +39,7 @@ class OSGUTIL_EXPORT PositionalStateContainer : public osg::Object
|
||||
virtual const char* className() const { return "PositionalStateContainer"; }
|
||||
|
||||
virtual void reset();
|
||||
|
||||
|
||||
typedef std::pair< osg::ref_ptr<const osg::StateAttribute> , osg::ref_ptr<osg::RefMatrix> > AttrMatrixPair;
|
||||
typedef std::vector< AttrMatrixPair > AttrMatrixList;
|
||||
typedef std::map< unsigned int, AttrMatrixList > TexUnitAttrMatrixListMap;
|
||||
@@ -59,14 +59,14 @@ class OSGUTIL_EXPORT PositionalStateContainer : public osg::Object
|
||||
}
|
||||
|
||||
virtual void draw(osg::State& state,RenderLeaf*& previous, const osg::Matrix* postMultMatrix = 0);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
AttrMatrixList _attrList;
|
||||
TexUnitAttrMatrixListMap _texAttrListMap;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
virtual ~PositionalStateContainer();
|
||||
|
||||
};
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -39,7 +39,7 @@ class OSGUTIL_EXPORT PrintVisitor : public osg::NodeVisitor
|
||||
void leave() { _indent -= _step; }
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
PrintVisitor& operator = (const PrintVisitor&) { return *this; }
|
||||
|
||||
std::ostream& _out;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
#ifndef OSGUTIL_REFLECTIONMAPGENERATOR_
|
||||
@@ -18,7 +18,7 @@
|
||||
namespace osgUtil
|
||||
{
|
||||
|
||||
/** This is the most simple cube map generator. It performs a direct association
|
||||
/** 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 {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -25,8 +25,8 @@ namespace osgUtil {
|
||||
class RenderStage;
|
||||
class Statistics;
|
||||
/**
|
||||
* RenderBin base class. Renderbin contains geometries to be rendered as a group,
|
||||
* renderbins are rendered once each. They can improve efficiency or
|
||||
* 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.
|
||||
*/
|
||||
@@ -34,9 +34,9 @@ class OSGUTIL_EXPORT RenderBin : public osg::Object
|
||||
{
|
||||
public:
|
||||
|
||||
typedef std::vector<RenderLeaf*> RenderLeafList;
|
||||
typedef std::vector<RenderLeaf*> RenderLeafList;
|
||||
typedef std::vector<StateGraph*> StateGraphList;
|
||||
typedef std::map< int, osg::ref_ptr<RenderBin> > RenderBinList;
|
||||
typedef std::map< int, osg::ref_ptr<RenderBin> > RenderBinList;
|
||||
|
||||
enum SortMode
|
||||
{
|
||||
@@ -116,7 +116,7 @@ class OSGUTIL_EXPORT RenderBin : public osg::Object
|
||||
virtual void sortBackToFront();
|
||||
virtual void sortTraversalOrder();
|
||||
|
||||
struct SortCallback : public osg::Referenced
|
||||
struct SortCallback : public osg::Referenced
|
||||
{
|
||||
virtual void sortImplementation(RenderBin*) = 0;
|
||||
};
|
||||
@@ -131,7 +131,7 @@ class OSGUTIL_EXPORT RenderBin : public osg::Object
|
||||
|
||||
virtual void drawImplementation(osg::RenderInfo& renderInfo,RenderLeaf*& previous);
|
||||
|
||||
struct DrawCallback : public osg::Referenced
|
||||
struct DrawCallback : public osg::Referenced
|
||||
{
|
||||
virtual void drawImplementation(RenderBin* bin,osg::RenderInfo& renderInfo,RenderLeaf*& previous) = 0;
|
||||
};
|
||||
@@ -156,7 +156,7 @@ class OSGUTIL_EXPORT RenderBin : public osg::Object
|
||||
protected:
|
||||
|
||||
virtual ~RenderBin();
|
||||
|
||||
|
||||
int _binNum;
|
||||
RenderBin* _parent;
|
||||
RenderStage* _stage;
|
||||
@@ -164,7 +164,7 @@ class OSGUTIL_EXPORT RenderBin : public osg::Object
|
||||
StateGraphList _stateGraphList;
|
||||
RenderLeafList _renderLeafList;
|
||||
|
||||
bool _sorted;
|
||||
bool _sorted;
|
||||
SortMode _sortMode;
|
||||
osg::ref_ptr<SortCallback> _sortCallback;
|
||||
|
||||
@@ -178,4 +178,4 @@ class OSGUTIL_EXPORT RenderBin : public osg::Object
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -33,7 +33,7 @@ class StateGraph;
|
||||
class OSGUTIL_EXPORT RenderLeaf : public osg::Referenced
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
|
||||
inline RenderLeaf(osg::Drawable* drawable,osg::RefMatrix* projection,osg::RefMatrix* modelview, float depth=0.0f, unsigned int traversalNumber=0):
|
||||
osg::Referenced(false),
|
||||
@@ -47,7 +47,7 @@ class OSGUTIL_EXPORT RenderLeaf : public osg::Referenced
|
||||
_dynamic = (drawable->getDataVariance()==osg::Object::DYNAMIC);
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline void set(osg::Drawable* drawable,osg::RefMatrix* projection,osg::RefMatrix* modelview, float depth=0.0f, unsigned int traversalNumber=0)
|
||||
{
|
||||
_parent = 0;
|
||||
@@ -58,7 +58,7 @@ class OSGUTIL_EXPORT RenderLeaf : public osg::Referenced
|
||||
_dynamic = (drawable->getDataVariance()==osg::Object::DYNAMIC);
|
||||
_traversalNumber = traversalNumber;
|
||||
}
|
||||
|
||||
|
||||
inline void reset()
|
||||
{
|
||||
_parent = 0;
|
||||
@@ -69,16 +69,16 @@ class OSGUTIL_EXPORT RenderLeaf : public osg::Referenced
|
||||
_dynamic = false;
|
||||
_traversalNumber = 0;
|
||||
}
|
||||
|
||||
|
||||
virtual void render(osg::RenderInfo& renderInfo,RenderLeaf* previous);
|
||||
|
||||
|
||||
/// Allow StateGraph to change the RenderLeaf's _parent.
|
||||
friend class osgUtil::StateGraph;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
StateGraph* _parent;
|
||||
|
||||
#ifdef OSGUTIL_RENDERBACKEND_USE_REF_PTR
|
||||
@@ -87,7 +87,7 @@ class OSGUTIL_EXPORT RenderLeaf : public osg::Referenced
|
||||
#else
|
||||
osg::Drawable* _drawable;
|
||||
const osg::Drawable* getDrawable() const { return _drawable; }
|
||||
#endif
|
||||
#endif
|
||||
osg::ref_ptr<osg::RefMatrix> _projection;
|
||||
osg::ref_ptr<osg::RefMatrix> _modelview;
|
||||
float _depth;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -37,21 +37,21 @@ namespace osgUtil {
|
||||
class OSGUTIL_EXPORT RenderStage : public RenderBin
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
|
||||
RenderStage();
|
||||
RenderStage(SortMode mode);
|
||||
|
||||
|
||||
RenderStage(const RenderStage& rhs,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
|
||||
|
||||
|
||||
virtual osg::Object* cloneType() const { return new RenderStage(); }
|
||||
virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new RenderStage(*this,copyop); } // note only implements a clone of type.
|
||||
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const RenderStage*>(obj)!=0L; }
|
||||
virtual const char* className() const { return "RenderStage"; }
|
||||
|
||||
virtual void reset();
|
||||
|
||||
|
||||
|
||||
|
||||
/** Set the draw buffer used at the start of each frame draw. */
|
||||
void setDrawBuffer(GLenum buffer, bool applyMask = true ) { _drawBuffer = buffer; setDrawBufferApplyMask( applyMask ); }
|
||||
|
||||
@@ -87,10 +87,10 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin
|
||||
|
||||
/** Get the viewport. */
|
||||
osg::Viewport* getViewport() { return _viewport.get(); }
|
||||
|
||||
|
||||
/** Set the initial view matrix.*/
|
||||
void setInitialViewMatrix(const osg::RefMatrix* matrix) { _initialViewMatrix = matrix; }
|
||||
|
||||
|
||||
/** Get the initial view matrix.*/
|
||||
const osg::RefMatrix* getInitialViewMatrix() { return _initialViewMatrix.get(); }
|
||||
|
||||
@@ -107,34 +107,34 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin
|
||||
const osg::ColorMask* getColorMask() const { return _colorMask.get(); }
|
||||
|
||||
|
||||
/** Set the clear color used in glClearColor(..).
|
||||
/** Set the clear color used in glClearColor(..).
|
||||
* glClearColor is only called if mask & GL_COLOR_BUFFER_BIT is true*/
|
||||
void setClearColor(const osg::Vec4& color) { _clearColor=color; }
|
||||
|
||||
|
||||
/** Get the clear color.*/
|
||||
const osg::Vec4& getClearColor() const { return _clearColor; }
|
||||
|
||||
/** 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. */
|
||||
void setClearAccum(const osg::Vec4& color) { _clearAccum=color; }
|
||||
|
||||
|
||||
/** Get the clear accum.*/
|
||||
const osg::Vec4& getClearAccum() const { return _clearAccum; }
|
||||
|
||||
|
||||
/** Set the clear depth used in glClearDepth(..). Defaults to 1.0
|
||||
* 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;
|
||||
* glClearStencil is only called if mask & GL_STENCIL_BUFFER_BIT is true*/
|
||||
void setClearStencil(int stencil) { _clearStencil=stencil; }
|
||||
|
||||
|
||||
/** Get the clear color.*/
|
||||
int getClearStencil() const { return _clearStencil; }
|
||||
|
||||
|
||||
|
||||
void setCamera(osg::Camera* camera) { if (_camera!=camera) { _camera = camera; _cameraRequiresSetUp = true; } }
|
||||
osg::Camera* getCamera() { return _camera; }
|
||||
@@ -142,16 +142,16 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin
|
||||
|
||||
void setCameraRequiresSetUp(bool flag) { _cameraRequiresSetUp = flag; }
|
||||
bool getCameraRequiresSetUp() const { return _cameraRequiresSetUp; }
|
||||
|
||||
|
||||
/** Attempt the set the RenderStage from the Camera settings.*/
|
||||
void runCameraSetUp(osg::RenderInfo& renderInfo);
|
||||
|
||||
|
||||
void setTexture(osg::Texture* texture, unsigned int level = 0, unsigned int face=0) { _texture = texture; _level = level; _face = face; }
|
||||
osg::Texture* getTexture() { return _texture.get(); }
|
||||
|
||||
|
||||
void setImage(osg::Image* image) { _image = image; }
|
||||
osg::Image* getImage() { return _image.get(); }
|
||||
|
||||
|
||||
void setImageReadPixelFormat(GLenum format) { _imageReadPixelFormat = format; }
|
||||
GLenum getImageReadPixelFormat() const { return _imageReadPixelFormat; }
|
||||
|
||||
@@ -205,7 +205,7 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin
|
||||
{
|
||||
getPositionalStateContainer()->addPositionedAttribute(matrix,attr);
|
||||
}
|
||||
|
||||
|
||||
virtual void addPositionedTextureAttribute(unsigned int textureUnit, osg::RefMatrix* matrix,const osg::StateAttribute* attr)
|
||||
{
|
||||
getPositionalStateContainer()->addPositionedTextureAttribute(textureUnit, matrix,attr);
|
||||
@@ -214,13 +214,13 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin
|
||||
void copyTexture(osg::RenderInfo& renderInfo);
|
||||
|
||||
virtual void sort();
|
||||
|
||||
|
||||
virtual void drawPreRenderStages(osg::RenderInfo& renderInfo,RenderLeaf*& previous);
|
||||
|
||||
virtual void draw(osg::RenderInfo& renderInfo,RenderLeaf*& previous);
|
||||
|
||||
virtual void drawInner(osg::RenderInfo& renderInfo,RenderLeaf*& previous, bool& doCopyTexture);
|
||||
|
||||
|
||||
virtual void drawPostRenderStages(osg::RenderInfo& renderInfo,RenderLeaf*& previous);
|
||||
|
||||
virtual void drawImplementation(osg::RenderInfo& renderInfo,RenderLeaf*& previous);
|
||||
@@ -229,12 +229,12 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin
|
||||
void addToDependencyList(RenderStage* rs) { addPreRenderStage(rs); }
|
||||
|
||||
void addPreRenderStage(RenderStage* rs, int order = 0);
|
||||
|
||||
|
||||
void addPostRenderStage(RenderStage* rs, int order = 0);
|
||||
|
||||
/** Extract stats for current draw list. */
|
||||
bool getStats(Statistics& stats) const;
|
||||
|
||||
bool getStats(Statistics& stats) const;
|
||||
|
||||
/** Compute the number of dynamic RenderLeaves.*/
|
||||
virtual unsigned int computeNumberOfDynamicRenderLeaves() const;
|
||||
|
||||
@@ -275,7 +275,7 @@ protected:
|
||||
// viewport x,y,width,height.
|
||||
osg::ref_ptr<osg::Viewport> _viewport;
|
||||
osg::ref_ptr<const osg::RefMatrix> _initialViewMatrix;
|
||||
|
||||
|
||||
GLenum _drawBuffer;
|
||||
bool _drawBufferApplyMask;
|
||||
GLenum _readBuffer;
|
||||
@@ -289,7 +289,7 @@ protected:
|
||||
|
||||
bool _cameraRequiresSetUp;
|
||||
osg::Camera* _camera;
|
||||
|
||||
|
||||
osg::ref_ptr<osg::Texture> _texture;
|
||||
unsigned int _level;
|
||||
unsigned int _face;
|
||||
@@ -297,9 +297,9 @@ protected:
|
||||
osg::ref_ptr<osg::Image> _image;
|
||||
GLenum _imageReadPixelFormat;
|
||||
GLenum _imageReadPixelDataType;
|
||||
|
||||
|
||||
std::map< osg::Camera::BufferComponent, Attachment> _bufferAttachmentMap;
|
||||
|
||||
|
||||
osg::ref_ptr<osg::FrameBufferObject> _fbo;
|
||||
osg::ref_ptr<osg::FrameBufferObject> _resolveFbo;
|
||||
osg::ref_ptr<osg::GraphicsContext> _graphicsContext;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -24,34 +24,34 @@ namespace osgUtil {
|
||||
class OSGUTIL_EXPORT ReversePrimitiveFunctor : public osg::PrimitiveIndexFunctor
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
virtual ~ReversePrimitiveFunctor() {}
|
||||
|
||||
|
||||
osg::PrimitiveSet * getReversedPrimitiveSet() { return _reversedPrimitiveSet.get(); }
|
||||
|
||||
|
||||
virtual void setVertexArray(unsigned int , const osg::Vec2* ) {}
|
||||
virtual void setVertexArray(unsigned int , const osg::Vec3* ) {}
|
||||
virtual void setVertexArray(unsigned int , const osg::Vec4* ) {}
|
||||
virtual void setVertexArray(unsigned int , const osg::Vec2d* ) {}
|
||||
virtual void setVertexArray(unsigned int , const osg::Vec3d* ) {}
|
||||
virtual void setVertexArray(unsigned int , const osg::Vec4d* ) {}
|
||||
|
||||
|
||||
virtual void drawArrays(GLenum mode,GLint first,GLsizei count);
|
||||
virtual void drawElements(GLenum mode,GLsizei count, const GLubyte* indices);
|
||||
virtual void drawElements(GLenum mode,GLsizei count, const GLushort* indices);
|
||||
virtual void drawElements(GLenum mode,GLsizei count, const GLuint* indices);
|
||||
|
||||
|
||||
|
||||
|
||||
/// Mimics the OpenGL \c glBegin() function.
|
||||
virtual void begin(GLenum mode);
|
||||
virtual void vertex(unsigned int /*pos*/);
|
||||
virtual void end();
|
||||
|
||||
|
||||
|
||||
|
||||
osg::ref_ptr<osg::PrimitiveSet> _reversedPrimitiveSet;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
bool _running;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -31,7 +31,7 @@ class OSGUTIL_EXPORT SceneGraphBuilder
|
||||
|
||||
SceneGraphBuilder();
|
||||
|
||||
//
|
||||
//
|
||||
// OpenGL 1.0 style building methods
|
||||
//
|
||||
void PushMatrix();
|
||||
@@ -42,7 +42,7 @@ class OSGUTIL_EXPORT SceneGraphBuilder
|
||||
void Translated(GLdouble x, GLdouble y, GLdouble z);
|
||||
void Scaled(GLdouble x, GLdouble y, GLdouble z);
|
||||
void Rotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
|
||||
|
||||
|
||||
void BlendFunc(GLenum srcFactor, GLenum dstFactor);
|
||||
void CullFace(GLenum mode);
|
||||
void DepthFunc(GLenum mode);
|
||||
@@ -54,10 +54,10 @@ class OSGUTIL_EXPORT SceneGraphBuilder
|
||||
void PolygonOffset(GLfloat factor, GLfloat units);
|
||||
void PolygonStipple(const GLubyte* mask);
|
||||
void ShadeModel(GLenum mode);
|
||||
|
||||
|
||||
void Enable(GLenum mode);
|
||||
void Disable(GLenum mode);
|
||||
|
||||
|
||||
void Color4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||
void Color4fv(GLfloat* c) { Color4f(c[0], c[1], c[2], c[3]); }
|
||||
|
||||
@@ -120,27 +120,27 @@ class OSGUTIL_EXPORT SceneGraphBuilder
|
||||
osg::Node* takeScene();
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
typedef std::vector<osg::Matrixd> Matrices;
|
||||
|
||||
void matrixChanged();
|
||||
void addAttribute(osg::StateAttribute* attribute);
|
||||
void addMode(GLenum mode, bool enabled);
|
||||
void addMode(GLenum mode, bool enabled);
|
||||
void addTextureAttribute(unsigned int unit, osg::StateAttribute* attribute);
|
||||
void addTextureMode(unsigned int unit, GLenum mode, bool enabled);
|
||||
void addTextureMode(unsigned int unit, GLenum mode, bool enabled);
|
||||
void addShape(osg::Shape* shape);
|
||||
void addDrawable(osg::Drawable* drawable);
|
||||
void newGeometry();
|
||||
|
||||
|
||||
void allocateGeometry();
|
||||
void completeGeometry();
|
||||
|
||||
|
||||
void allocateStateSet();
|
||||
|
||||
|
||||
Matrices _matrixStack;
|
||||
osg::ref_ptr<osg::StateSet> _stateset;
|
||||
bool _statesetAssigned;
|
||||
|
||||
|
||||
bool _normalSet;
|
||||
osg::Vec3f _normal;
|
||||
|
||||
@@ -155,7 +155,7 @@ class OSGUTIL_EXPORT SceneGraphBuilder
|
||||
osg::ref_ptr<osg::Vec3Array> _normals;
|
||||
osg::ref_ptr<osg::Vec4Array> _colors;
|
||||
osg::ref_ptr<osg::Vec4Array> _texCoords;
|
||||
|
||||
|
||||
struct QuadricState
|
||||
{
|
||||
QuadricState():
|
||||
@@ -177,7 +177,7 @@ class OSGUTIL_EXPORT SceneGraphBuilder
|
||||
osg::ref_ptr<osg::Geode> _geode;
|
||||
osg::ref_ptr<osg::MatrixTransform> _transform;
|
||||
osg::ref_ptr<osg::Group> _group;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -51,7 +51,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings
|
||||
SKY_LIGHT = 0x2,
|
||||
COMPILE_GLOBJECTS_AT_INIT = 0x4,
|
||||
STANDARD_SETTINGS = HEADLIGHT |
|
||||
COMPILE_GLOBJECTS_AT_INIT
|
||||
COMPILE_GLOBJECTS_AT_INIT
|
||||
};
|
||||
|
||||
/* Set defaults. */
|
||||
@@ -75,7 +75,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings
|
||||
* an osg::Scene but can be any osg::Node type.
|
||||
*/
|
||||
void setSceneData(osg::Node* node);
|
||||
|
||||
|
||||
/** Get the scene data to view. The data will typically be
|
||||
* an osg::Scene but can be any osg::Node type.
|
||||
*/
|
||||
@@ -85,7 +85,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings
|
||||
* an osg::Scene but can be any osg::Node type.
|
||||
*/
|
||||
const osg::Node* getSceneData(unsigned int childNo=0) const { return (_camera->getNumChildren()>childNo) ? _camera->getChild(childNo) : 0; }
|
||||
|
||||
|
||||
/** Get the number of scene data subgraphs added to the SceneView's camera.*/
|
||||
unsigned int getNumSceneData() const { return _camera->getNumChildren(); }
|
||||
|
||||
@@ -101,10 +101,10 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings
|
||||
|
||||
/** Get the const viewport. */
|
||||
const osg::Viewport* getViewport() const { return (_camera->getViewport()!=0) ? _camera->getViewport() : 0; }
|
||||
|
||||
|
||||
/** Set the DisplaySettings. */
|
||||
inline void setDisplaySettings(osg::DisplaySettings* vs) { _displaySettings = vs; }
|
||||
|
||||
|
||||
/** Get the const DisplaySettings */
|
||||
inline const osg::DisplaySettings* getDisplaySettings() const { return _displaySettings.get(); }
|
||||
|
||||
@@ -118,12 +118,12 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings
|
||||
|
||||
/** Get the color used in glClearColor.*/
|
||||
const osg::Vec4& getClearColor() const { return _camera->getClearColor(); }
|
||||
|
||||
|
||||
/** Manually set the redraw interlaced stereo stencil mask request flag to control whether to redraw the stencil buffer on the next frame.*/
|
||||
|
||||
|
||||
/** Manually set the redraw interlaced stereo stencil mask request flag to control whether to redraw the stencil buffer on the next frame.*/
|
||||
void setRedrawInterlacedStereoStencilMask(bool flag) { _redrawInterlacedStereoStencilMask = flag; }
|
||||
|
||||
/** Get the redraw interlaced stereo stencil mask request flag.*/
|
||||
/** Get the redraw interlaced stereo stencil mask request flag.*/
|
||||
bool getRedrawInterlacedStereoStencilMask() const { return _redrawInterlacedStereoStencilMask; }
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings
|
||||
void setLocalStateSet(osg::StateSet* state) { _localStateSet = state; }
|
||||
osg::StateSet* getLocalStateSet() { return _localStateSet.get(); }
|
||||
const osg::StateSet* getLocalStateSet() const { return _localStateSet.get(); }
|
||||
|
||||
|
||||
enum ActiveUniforms
|
||||
{
|
||||
FRAME_NUMBER_UNIFORM = 1,
|
||||
@@ -158,14 +158,14 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings
|
||||
ALL_UNIFORMS = 0x7FFFFFFF
|
||||
};
|
||||
|
||||
/** Set the uniforms that SceneView should set set up on each frame.*/
|
||||
/** Set the uniforms that SceneView should set set up on each frame.*/
|
||||
void setActiveUniforms(int activeUniforms) { _activeUniforms = activeUniforms; }
|
||||
|
||||
/** Get the uniforms that SceneView should set set up on each frame.*/
|
||||
int getActiveUniforms() const { return _activeUniforms; }
|
||||
|
||||
void updateUniforms();
|
||||
|
||||
|
||||
|
||||
typedef Options LightingMode;
|
||||
|
||||
@@ -175,11 +175,11 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings
|
||||
void setLight(osg::Light* light) { _light = light; }
|
||||
osg::Light* getLight() { return _light.get(); }
|
||||
const osg::Light* getLight() const { return _light.get(); }
|
||||
|
||||
|
||||
void setState(osg::State* state) { _renderInfo.setState(state); }
|
||||
osg::State* getState() { return _renderInfo.getState(); }
|
||||
const osg::State* getState() const { return _renderInfo.getState(); }
|
||||
|
||||
|
||||
void setView(osg::View* view) { _camera->setView(view); }
|
||||
osg::View* getView() { return _camera->getView(); }
|
||||
const osg::View* getView() const { return _camera->getView(); }
|
||||
@@ -187,7 +187,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings
|
||||
void setRenderInfo(osg::RenderInfo& renderInfo) { _renderInfo = renderInfo; }
|
||||
osg::RenderInfo& getRenderInfo() { return _renderInfo; }
|
||||
const osg::RenderInfo& getRenderInfo() const { return _renderInfo; }
|
||||
|
||||
|
||||
|
||||
|
||||
/** Set the projection matrix. Can be thought of as setting the lens of a camera. */
|
||||
@@ -221,7 +221,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings
|
||||
/** Get the const projection matrix.*/
|
||||
const osg::Matrixd& getProjectionMatrix() const { return _camera->getProjectionMatrix(); }
|
||||
|
||||
/** Get the orthographic settings of the orthographic projection matrix.
|
||||
/** Get the orthographic 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,
|
||||
@@ -234,7 +234,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings
|
||||
double& zNear, double& zFar) const;
|
||||
|
||||
/** 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 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.*/
|
||||
@@ -244,7 +244,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings
|
||||
|
||||
/** Set the view matrix. Can be thought of as setting the position of the world relative to the camera in camera coordinates. */
|
||||
inline void setViewMatrix(const osg::Matrixf& matrix) { _camera->setViewMatrix(matrix); }
|
||||
|
||||
|
||||
/** Set the view matrix. Can be thought of as setting the position of the world relative to the camera in camera coordinates. */
|
||||
inline void setViewMatrix(const osg::Matrixd& matrix) { _camera->setViewMatrix(matrix); }
|
||||
|
||||
@@ -262,7 +262,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void setInitVisitor(osg::NodeVisitor* av) { _initVisitor = av; }
|
||||
osg::NodeVisitor* getInitVisitor() { return _initVisitor.get(); }
|
||||
const osg::NodeVisitor* getInitVisitor() const { return _initVisitor.get(); }
|
||||
@@ -284,7 +284,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings
|
||||
void setCullVisitorRight(osgUtil::CullVisitor* cv) { _cullVisitorRight = cv; }
|
||||
osgUtil::CullVisitor* getCullVisitorRight() { return _cullVisitorRight.get(); }
|
||||
const osgUtil::CullVisitor* getCullVisitorRight() const { return _cullVisitorRight.get(); }
|
||||
|
||||
|
||||
void setCollectOccludersVisitor(osg::CollectOccludersVisitor* cov) { _collectOccludersVisitor = cov; }
|
||||
osg::CollectOccludersVisitor* getCollectOccludersVisitor() { return _collectOccludersVisitor.get(); }
|
||||
const osg::CollectOccludersVisitor* getCollectOccludersVisitor() const { return _collectOccludersVisitor.get(); }
|
||||
@@ -354,7 +354,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings
|
||||
|
||||
/** Set whether the draw method should call renderer->prioritizeTexture.*/
|
||||
void setPrioritizeTextures(bool pt) { _prioritizeTextures = pt; }
|
||||
|
||||
|
||||
/** Get whether the draw method should call renderer->prioritizeTexture.*/
|
||||
bool getPrioritizeTextures() const { return _prioritizeTextures; }
|
||||
|
||||
@@ -367,7 +367,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings
|
||||
virtual osg::Matrixd computeRightEyeProjection(const osg::Matrixd& projection) const = 0;
|
||||
virtual osg::Matrixd computeRightEyeView(const osg::Matrixd& view) const = 0;
|
||||
};
|
||||
|
||||
|
||||
void setComputeStereoMatricesCallback(ComputeStereoMatricesCallback* callback) { _computeStereoMatricesCallback=callback; }
|
||||
ComputeStereoMatricesCallback* getComputeStereoMatricesCallback() { return _computeStereoMatricesCallback.get(); }
|
||||
const ComputeStereoMatricesCallback* getComputeStereoMatricesCallback() const { return _computeStereoMatricesCallback.get(); }
|
||||
@@ -419,7 +419,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings
|
||||
if (_computeStereoMatricesCallback.valid()) return _computeStereoMatricesCallback->computeLeftEyeView(view);
|
||||
else return computeLeftEyeViewImplementation(view);
|
||||
}
|
||||
|
||||
|
||||
inline osg::Matrixd computeRightEyeProjection(const osg::Matrixd& projection) const
|
||||
{
|
||||
if (_computeStereoMatricesCallback.valid()) return _computeStereoMatricesCallback->computeRightEyeProjection(projection);
|
||||
@@ -462,10 +462,10 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings
|
||||
|
||||
/** Do draw traversal of draw bins generated by cull traversal.*/
|
||||
virtual void draw();
|
||||
|
||||
|
||||
/** Compute the number of dynamic objects that will be held in the rendering backend */
|
||||
unsigned int getDynamicObjectCount() const { return _dynamicObjectCount; }
|
||||
|
||||
|
||||
/** Release all OpenGL objects from the scene graph, such as texture objects, display lists, etc.
|
||||
* These released scene graphs are placed in the respective delete GLObjects cache, and
|
||||
* then need to be deleted in OpenGL by SceneView::flushAllDeleteGLObjects(). */
|
||||
@@ -476,7 +476,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings
|
||||
|
||||
/** Flush deleted OpenGL objects, such as texture objects, display lists, etc., within the specified available time.*/
|
||||
virtual void flushDeletedGLObjects(double& availableTime);
|
||||
|
||||
|
||||
/** Extract stats for current draw list. */
|
||||
bool getStats(Statistics& primStats);
|
||||
|
||||
@@ -490,7 +490,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings
|
||||
|
||||
/** Do cull traversal of attached scene graph using Cull NodeVisitor. Return true if computeNearFar has been done during the cull traversal.*/
|
||||
virtual bool cullStage(const osg::Matrixd& projection,const osg::Matrixd& modelview,osgUtil::CullVisitor* cullVisitor, osgUtil::StateGraph* rendergraph, osgUtil::RenderStage* renderStage, osg::Viewport *viewport);
|
||||
|
||||
|
||||
void computeLeftEyeViewport(const osg::Viewport *viewport);
|
||||
void computeRightEyeViewport(const osg::Viewport *viewport);
|
||||
|
||||
@@ -500,7 +500,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings
|
||||
|
||||
osg::ref_ptr<osg::StateSet> _localStateSet;
|
||||
osg::RenderInfo _renderInfo;
|
||||
|
||||
|
||||
bool _initCalled;
|
||||
osg::ref_ptr<osg::NodeVisitor> _initVisitor;
|
||||
osg::ref_ptr<osg::NodeVisitor> _updateVisitor;
|
||||
@@ -521,37 +521,37 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings
|
||||
osg::ref_ptr<osg::Viewport> _viewportRight;
|
||||
|
||||
osg::ref_ptr<osg::CollectOccludersVisitor> _collectOccludersVisitor;
|
||||
|
||||
|
||||
osg::ref_ptr<osg::FrameStamp> _frameStamp;
|
||||
|
||||
|
||||
osg::observer_ptr<osg::Camera> _camera;
|
||||
osg::ref_ptr<osg::Camera> _cameraWithOwnership;
|
||||
|
||||
|
||||
osg::ref_ptr<osg::StateSet> _globalStateSet;
|
||||
osg::ref_ptr<osg::Light> _light;
|
||||
osg::ref_ptr<osg::DisplaySettings> _displaySettings;
|
||||
|
||||
|
||||
osg::ref_ptr<osg::StateSet> _secondaryStateSet;
|
||||
|
||||
FusionDistanceMode _fusionDistanceMode;
|
||||
float _fusionDistanceValue;
|
||||
|
||||
LightingMode _lightingMode;
|
||||
|
||||
|
||||
bool _prioritizeTextures;
|
||||
|
||||
|
||||
bool _automaticFlush;
|
||||
bool _requiresFlush;
|
||||
|
||||
int _activeUniforms;
|
||||
|
||||
int _activeUniforms;
|
||||
double _previousFrameTime;
|
||||
double _previousSimulationTime;
|
||||
|
||||
|
||||
bool _redrawInterlacedStereoStencilMask;
|
||||
int _interlacedStereoStencilWidth;
|
||||
int _interlacedStereoStencilHeight;
|
||||
|
||||
unsigned int _dynamicObjectCount;
|
||||
unsigned int _dynamicObjectCount;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -50,7 +50,7 @@ class OSGUTIL_EXPORT Simplifier : public osg::NodeVisitor
|
||||
|
||||
void setSmoothing(bool on) { _smoothing = on; }
|
||||
bool getSmoothing() const { return _smoothing; }
|
||||
|
||||
|
||||
class ContinueSimplificationCallback : public osg::Referenced
|
||||
{
|
||||
public:
|
||||
@@ -59,16 +59,16 @@ class OSGUTIL_EXPORT Simplifier : public osg::NodeVisitor
|
||||
{
|
||||
return simplifier.continueSimplificationImplementation(nextError, numOriginalPrimitives, numRemainingPrimitives);
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
virtual ~ContinueSimplificationCallback() {}
|
||||
};
|
||||
|
||||
|
||||
void setContinueSimplificationCallback(ContinueSimplificationCallback* cb) { _continueSimplificationCallback = cb; }
|
||||
ContinueSimplificationCallback* getContinueSimplificationCallback() { return _continueSimplificationCallback.get(); }
|
||||
const ContinueSimplificationCallback* getContinueSimplificationCallback() const { return _continueSimplificationCallback.get(); }
|
||||
|
||||
|
||||
|
||||
|
||||
bool continueSimplification(float nextError, unsigned int numOriginalPrimitives, unsigned int numRemainingPrimitives) const
|
||||
{
|
||||
if (_continueSimplificationCallback.valid()) return _continueSimplificationCallback->continueSimplification(*this, nextError, numOriginalPrimitives, numRemainingPrimitives);
|
||||
@@ -96,7 +96,7 @@ class OSGUTIL_EXPORT Simplifier : public osg::NodeVisitor
|
||||
|
||||
/** simply the geometry.*/
|
||||
void simplify(osg::Geometry& geometry);
|
||||
|
||||
|
||||
typedef std::vector<unsigned int> IndexList; /// a list of point indices
|
||||
|
||||
/** simply the geometry, whilst protecting key points from being modified.*/
|
||||
@@ -104,15 +104,15 @@ class OSGUTIL_EXPORT Simplifier : public osg::NodeVisitor
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
double _sampleRatio;
|
||||
double _maximumError;
|
||||
double _maximumLength;
|
||||
bool _triStrip;
|
||||
bool _smoothing;
|
||||
|
||||
|
||||
osg::ref_ptr<ContinueSimplificationCallback> _continueSimplificationCallback;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -32,7 +32,7 @@ class OSGUTIL_EXPORT SmoothingVisitor : public osg::NodeVisitor
|
||||
/// default to traversing all children.
|
||||
SmoothingVisitor();
|
||||
virtual ~SmoothingVisitor();
|
||||
|
||||
|
||||
/// smooth geoset by creating per vertex normals.
|
||||
static void smooth(osg::Geometry& geoset, double creaseAngle=osg::PI);
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -41,7 +41,7 @@ struct LessDepthSortFunctor
|
||||
class OSGUTIL_EXPORT StateGraph : public osg::Referenced
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
|
||||
typedef std::map< const osg::StateSet*, osg::ref_ptr<StateGraph> > ChildList;
|
||||
typedef std::vector< osg::ref_ptr<RenderLeaf> > LeafList;
|
||||
@@ -57,10 +57,10 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced
|
||||
int _depth;
|
||||
ChildList _children;
|
||||
LeafList _leaves;
|
||||
|
||||
|
||||
mutable float _averageDistance;
|
||||
mutable float _minimumDistance;
|
||||
|
||||
|
||||
osg::ref_ptr<osg::Referenced> _userData;
|
||||
|
||||
bool _dynamic;
|
||||
@@ -88,15 +88,15 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced
|
||||
_dynamic(false)
|
||||
{
|
||||
if (_parent) _depth = _parent->_depth + 1;
|
||||
|
||||
|
||||
if (_parent && _parent->_dynamic) _dynamic = true;
|
||||
else _dynamic = stateset->getDataVariance()==osg::Object::DYNAMIC;
|
||||
}
|
||||
|
||||
|
||||
~StateGraph() {}
|
||||
|
||||
|
||||
StateGraph* cloneType() const { return new StateGraph; }
|
||||
|
||||
|
||||
void setUserData(osg::Referenced* obj) { _userData = obj; }
|
||||
osg::Referenced* getUserData() { return _userData.get(); }
|
||||
const osg::Referenced* getUserData() const { return _userData.get(); }
|
||||
@@ -114,7 +114,7 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced
|
||||
{
|
||||
return _leaves.empty() && _children.empty();
|
||||
}
|
||||
|
||||
|
||||
inline bool leaves_empty() const
|
||||
{
|
||||
return _leaves.empty();
|
||||
@@ -133,11 +133,11 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced
|
||||
_averageDistance += (*itr)->_depth;
|
||||
}
|
||||
_averageDistance /= (float)_leaves.size();
|
||||
|
||||
|
||||
}
|
||||
return _averageDistance;
|
||||
}
|
||||
|
||||
|
||||
inline float getMinimumDistance() const
|
||||
{
|
||||
if (_minimumDistance==FLT_MAX && !_leaves.empty())
|
||||
@@ -151,7 +151,7 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced
|
||||
{
|
||||
if ((*itr)->_depth<_minimumDistance) _minimumDistance=(*itr)->_depth;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return _minimumDistance;
|
||||
}
|
||||
@@ -170,14 +170,14 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced
|
||||
|
||||
/** Recursively prune the StateGraph of empty children.*/
|
||||
void prune();
|
||||
|
||||
|
||||
|
||||
|
||||
inline StateGraph* find_or_insert(const osg::StateSet* stateset)
|
||||
{
|
||||
// search for the appropriate state group, return it if found.
|
||||
ChildList::iterator itr = _children.find(stateset);
|
||||
if (itr!=_children.end()) return itr->second.get();
|
||||
|
||||
|
||||
// create a state group and insert it into the children list
|
||||
// then return the state group.
|
||||
StateGraph* sg = new StateGraph(this,stateset);
|
||||
@@ -209,7 +209,7 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced
|
||||
std::vector<StateGraph*> return_path;
|
||||
|
||||
// need to pop back root render graph.
|
||||
do
|
||||
do
|
||||
{
|
||||
return_path.push_back(sg_new);
|
||||
sg_new = sg_new->_parent;
|
||||
@@ -224,20 +224,20 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// first handle the typical case which is two state groups
|
||||
// are neighbours.
|
||||
if (sg_curr->_parent==sg_new->_parent)
|
||||
{
|
||||
|
||||
|
||||
// state has changed so need to pop old state.
|
||||
if (sg_curr->getStateSet()) state.popStateSet();
|
||||
// and push new state.
|
||||
if (sg_new->getStateSet()) state.pushStateSet(sg_new->getStateSet());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// need to pop back up to the same depth as the new state group.
|
||||
while (sg_curr->_depth>sg_new->_depth)
|
||||
@@ -245,7 +245,7 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced
|
||||
if (sg_curr->getStateSet()) state.popStateSet();
|
||||
sg_curr = sg_curr->_parent;
|
||||
}
|
||||
|
||||
|
||||
// use return path to trace back steps to sg_new.
|
||||
std::vector<StateGraph*> return_path;
|
||||
|
||||
@@ -255,7 +255,7 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced
|
||||
return_path.push_back(sg_new);
|
||||
sg_new = sg_new->_parent;
|
||||
}
|
||||
|
||||
|
||||
// now pop back up both parent paths until they agree.
|
||||
|
||||
// DRT - 10/22/02
|
||||
@@ -269,7 +269,7 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced
|
||||
return_path.push_back(sg_new);
|
||||
sg_new = sg_new->_parent;
|
||||
}
|
||||
|
||||
|
||||
for(std::vector<StateGraph*>::reverse_iterator itr=return_path.rbegin();
|
||||
itr!=return_path.rend();
|
||||
++itr)
|
||||
@@ -288,9 +288,9 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced
|
||||
if (sg_curr->getStateSet()) state.popStateSet();
|
||||
sg_curr = sg_curr->_parent;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
inline static int numToPop(StateGraph* sg_curr)
|
||||
{
|
||||
int numToPop = 0;
|
||||
@@ -300,7 +300,7 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced
|
||||
if (sg_curr->getStateSet()) ++numToPop;
|
||||
sg_curr = sg_curr->_parent;
|
||||
}
|
||||
|
||||
|
||||
return numToPop;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace osgUtil {
|
||||
class OSGUTIL_EXPORT Tessellator : public osg::Referenced
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
Tessellator();
|
||||
~Tessellator();
|
||||
|
||||
@@ -71,7 +71,7 @@ class OSGUTIL_EXPORT Tessellator : public osg::Referenced
|
||||
|
||||
/** Change the contours lists of the geometry into tessellated primitives (the
|
||||
* list of primitives in the original geometry is stored in the Tessellator for
|
||||
* possible re-use.
|
||||
* possible re-use.
|
||||
* The name remains retessellatePolygons although it now handles trifans, strips, quads etc.
|
||||
* as well as Polygons so as to not break old codes relying on this function name. */
|
||||
void retessellatePolygons(osg::Geometry &cxgeom);
|
||||
@@ -79,7 +79,7 @@ class OSGUTIL_EXPORT Tessellator : public osg::Referenced
|
||||
/** Define the normal to the tessellated polygon - this provides a hint how to
|
||||
* tessellate the contours; see gluTessNormal in red book or man pages.
|
||||
* GWM July 2005. Can improve teselation
|
||||
* "For example, if you know that all polygons lie in the x-y plane,
|
||||
* "For example, if you know that all polygons lie in the x-y plane,
|
||||
* call gluTessNormal(tess, 0.0, 0.0, 1.0) before rendering any polygons."
|
||||
*/
|
||||
void setTessellationNormal(const osg::Vec3 norm) { tessNormal=norm;}
|
||||
@@ -89,15 +89,15 @@ class OSGUTIL_EXPORT Tessellator : public osg::Referenced
|
||||
struct Prim : public osg::Referenced
|
||||
{
|
||||
Prim(GLenum mode):_mode(mode) {}
|
||||
|
||||
|
||||
typedef std::vector<osg::Vec3*> VecList;
|
||||
|
||||
GLenum _mode;
|
||||
VecList _vertices;
|
||||
};
|
||||
|
||||
|
||||
virtual void beginTessellation();
|
||||
|
||||
|
||||
void beginContour();
|
||||
|
||||
/** Add a vertex to the current contour, see gluTessVertex for details.
|
||||
@@ -112,11 +112,11 @@ class OSGUTIL_EXPORT Tessellator : public osg::Referenced
|
||||
void endTessellation();
|
||||
|
||||
typedef std::vector< osg::ref_ptr<Prim> > PrimList;
|
||||
|
||||
PrimList& getPrimList() { return _primList; }
|
||||
|
||||
|
||||
PrimList& getPrimList() { return _primList; }
|
||||
|
||||
void reset();
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
/** remove unused parts of the array, eg for when retessellating
|
||||
@@ -125,7 +125,7 @@ class OSGUTIL_EXPORT Tessellator : public osg::Referenced
|
||||
void reduceArray(osg::Array * cold, const unsigned int nnu);
|
||||
|
||||
void collectTessellation(osg::Geometry &cxgeom, unsigned int originalIndex);
|
||||
|
||||
|
||||
typedef std::map<osg::Vec3*,unsigned int> VertexPtrToIndexMap;
|
||||
void addContour(GLenum mode, unsigned int first, unsigned int last, osg::Vec3Array* vertices);
|
||||
void addContour(osg::PrimitiveSet* primitive, osg::Vec3Array* vertices);
|
||||
@@ -137,7 +137,7 @@ class OSGUTIL_EXPORT Tessellator : public osg::Referenced
|
||||
void end();
|
||||
void error(GLenum errorCode);
|
||||
|
||||
|
||||
|
||||
static void CALLBACK beginCallback(GLenum which, void* userData);
|
||||
static void CALLBACK vertexCallback(GLvoid *data, void* userData);
|
||||
static void CALLBACK combineCallback(GLdouble coords[3], void* vertex_data[4],
|
||||
@@ -145,8 +145,8 @@ class OSGUTIL_EXPORT Tessellator : public osg::Referenced
|
||||
void* useData);
|
||||
static void CALLBACK endCallback(void* userData);
|
||||
static void CALLBACK errorCallback(GLenum errorCode, void* userData);
|
||||
|
||||
|
||||
|
||||
|
||||
struct Vec3d
|
||||
{
|
||||
double _v[3];
|
||||
@@ -155,7 +155,7 @@ class OSGUTIL_EXPORT Tessellator : public osg::Referenced
|
||||
|
||||
struct NewVertex
|
||||
{
|
||||
|
||||
|
||||
NewVertex():
|
||||
_vpos(0),
|
||||
_f1(0),
|
||||
@@ -166,7 +166,7 @@ class OSGUTIL_EXPORT Tessellator : public osg::Referenced
|
||||
_v3(0),
|
||||
_f4(0),
|
||||
_v4(0) {}
|
||||
|
||||
|
||||
NewVertex(const NewVertex& nv):
|
||||
_vpos(nv._vpos),
|
||||
_f1(nv._f1),
|
||||
@@ -194,7 +194,7 @@ class OSGUTIL_EXPORT Tessellator : public osg::Referenced
|
||||
_v4(v4) {}
|
||||
|
||||
osg::Vec3 *_vpos; // added gwm Jan 2004 the vertex coords s.t. NewVertex can be used in a std::vector
|
||||
|
||||
|
||||
float _f1;
|
||||
osg::Vec3* _v1;
|
||||
|
||||
@@ -206,11 +206,11 @@ class OSGUTIL_EXPORT Tessellator : public osg::Referenced
|
||||
|
||||
float _f4;
|
||||
osg::Vec3* _v4;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
//change NewVertexList from std::map<osg::Vec3*,NewVertex> NewVertexList;
|
||||
// because this has undefined order of insertion for new vertices.
|
||||
// because this has undefined order of insertion for new vertices.
|
||||
// which occasionally corrupted the texture mapping.
|
||||
typedef std::vector<NewVertex> NewVertexList;
|
||||
typedef std::vector<Vec3d*> Vec3dList;
|
||||
@@ -223,7 +223,7 @@ class OSGUTIL_EXPORT Tessellator : public osg::Referenced
|
||||
GLenum _errorCode;
|
||||
|
||||
/** winding rule, which parts will become solid */
|
||||
WindingType _wtype;
|
||||
WindingType _wtype;
|
||||
|
||||
/** tessellation rule, which parts will become solid */
|
||||
TessellationType _ttype;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -26,10 +26,10 @@ namespace osgUtil {
|
||||
class OSGUTIL_EXPORT TransformAttributeFunctor : public osg::Drawable::AttributeFunctor
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
/** Construct a functor to transform a drawable's vertex and normal attributes by specified matrix.*/
|
||||
TransformAttributeFunctor(const osg::Matrix& m);
|
||||
|
||||
|
||||
virtual ~TransformAttributeFunctor();
|
||||
|
||||
/** Do the work of transforming vertex and normal attributes. */
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
//C++ header
|
||||
//C++ header
|
||||
|
||||
#ifndef OSGUTIL_TRANSFORMCALLBACK
|
||||
#define OSGUTIL_TRANSFORMCALLBACK 1
|
||||
@@ -35,7 +35,7 @@ class OSGUTIL_EXPORT TransformCallback : public osg::NodeCallback
|
||||
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
float _angular_velocity;
|
||||
osg::Vec3 _pivot;
|
||||
osg::Vec3 _axis;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -32,8 +32,8 @@ class OSGUTIL_EXPORT TriStripVisitor : public BaseOptimizerVisitor
|
||||
public:
|
||||
|
||||
/// default to traversing all children.
|
||||
TriStripVisitor(Optimizer* optimizer=0) :
|
||||
BaseOptimizerVisitor( optimizer, Optimizer::TRISTRIP_GEOMETRY),
|
||||
TriStripVisitor(Optimizer* optimizer=0) :
|
||||
BaseOptimizerVisitor( optimizer, Optimizer::TRISTRIP_GEOMETRY),
|
||||
_cacheSize( 16 ),
|
||||
_minStripSize( 2 ),
|
||||
_generateFourPointPrimitivesQuads ( false)
|
||||
@@ -55,29 +55,29 @@ class OSGUTIL_EXPORT TriStripVisitor : public BaseOptimizerVisitor
|
||||
{
|
||||
_cacheSize = size;
|
||||
}
|
||||
|
||||
|
||||
inline unsigned int getCacheSize() const
|
||||
{
|
||||
return _cacheSize;
|
||||
}
|
||||
|
||||
|
||||
inline void setMinStripSize( unsigned int size )
|
||||
{
|
||||
_minStripSize = size;
|
||||
}
|
||||
|
||||
|
||||
inline unsigned int getMinStripSize() const
|
||||
{
|
||||
return _minStripSize;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void setGenerateFourPointPrimitivesQuads(bool flag) { _generateFourPointPrimitivesQuads = flag; }
|
||||
bool getGenerateFourPointPrimitivesQuads() const { return _generateFourPointPrimitivesQuads; }
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
typedef std::set<osg::Geometry*> GeometryList;
|
||||
|
||||
unsigned int _cacheSize;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace osgUtil {
|
||||
/**
|
||||
* Basic UpdateVisitor implementation for animating a scene.
|
||||
* This visitor traverses the scene graph, calling each nodes appCallback if
|
||||
* it exists.
|
||||
* it exists.
|
||||
*/
|
||||
class OSGUTIL_EXPORT UpdateVisitor : public osg::NodeVisitor
|
||||
{
|
||||
@@ -47,12 +47,12 @@ class OSGUTIL_EXPORT UpdateVisitor : public osg::NodeVisitor
|
||||
|
||||
/** During traversal each type of node calls its callbacks and its children traversed. */
|
||||
virtual void apply(osg::Node& node) { handle_callbacks_and_traverse(node); }
|
||||
|
||||
|
||||
virtual void apply(osg::Geode& node) { handle_geode_callbacks(node); }
|
||||
virtual void apply(osg::Billboard& node) { handle_geode_callbacks(node); }
|
||||
|
||||
|
||||
virtual void apply(osg::LightSource& node) { handle_callbacks_and_traverse(node); }
|
||||
|
||||
|
||||
virtual void apply(osg::Group& node) { handle_callbacks_and_traverse(node); }
|
||||
virtual void apply(osg::Transform& node) { handle_callbacks_and_traverse(node); }
|
||||
virtual void apply(osg::Projection& node) { handle_callbacks_and_traverse(node); }
|
||||
@@ -68,7 +68,7 @@ class OSGUTIL_EXPORT UpdateVisitor : public osg::NodeVisitor
|
||||
|
||||
/** Prevent unwanted copy operator.*/
|
||||
UpdateVisitor& operator = (const UpdateVisitor&) { return *this; }
|
||||
|
||||
|
||||
inline void handle_callbacks(osg::StateSet* stateset)
|
||||
{
|
||||
if (stateset && stateset->requiresUpdateTraversal())
|
||||
@@ -76,7 +76,7 @@ class OSGUTIL_EXPORT UpdateVisitor : public osg::NodeVisitor
|
||||
stateset->runUpdateCallbacks(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline void handle_callbacks_and_traverse(osg::Node& node)
|
||||
{
|
||||
handle_callbacks(node.getStateSet());
|
||||
@@ -98,14 +98,14 @@ class OSGUTIL_EXPORT UpdateVisitor : public osg::NodeVisitor
|
||||
{
|
||||
osg::Drawable::UpdateCallback* callback = geode.getDrawable(i)->getUpdateCallback();
|
||||
if (callback) callback->update(this,geode.getDrawable(i));
|
||||
|
||||
|
||||
handle_callbacks(geode.getDrawable(i)->getStateSet());
|
||||
}
|
||||
|
||||
|
||||
// should we traverse just in case a subclass of Geode adds children?? Won't for now as
|
||||
// Geode's arn't designed to have children.
|
||||
// traverse(geode);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user