Generalised the osg::ClusterCullingCallback so that it coud be attached

to Node as well as Drawables.

Changed the osgTerrain::DataSet so that it moves the ClusterCullingCallback
up to the Node level.

Added support to the .ive plugin for attaching the ClusterCullingCallback to nodes.
This commit is contained in:
Robert Osfield
2004-10-21 09:36:34 +00:00
parent bba69b288b
commit 93c439ba01
5 changed files with 153 additions and 12 deletions

View File

@@ -15,13 +15,14 @@
#define OSG_CLUSTERCULLINGCALLBACK 1
#include <osg/Drawable>
#include <osg/NodeCallback>
namespace osg {
/** Implements cluster culling to cull back facing drawables. Derived from
* Drawable::CullCallback.
*/
class SG_EXPORT ClusterCullingCallback : public Drawable::CullCallback
class SG_EXPORT ClusterCullingCallback : public Drawable::CullCallback, public NodeCallback
{
public:
@@ -35,6 +36,9 @@ class SG_EXPORT ClusterCullingCallback : public Drawable::CullCallback
/** Computes the control point, normal, and deviation from the
* given drawable contents. */
void computeFrom(const osg::Drawable* drawable);
/** Transform the ClusterCullingCallback's positional members to a new coordinate frame.*/
void transform(const osg::Matrixd& matrix);
void set(const osg::Vec3& controlPoint, const osg::Vec3& normal, float deviation, float radius);
@@ -52,6 +56,9 @@ class SG_EXPORT ClusterCullingCallback : public Drawable::CullCallback
virtual bool cull(osg::NodeVisitor*, osg::Drawable*, osg::State*) const;
/** Callback method called by the NodeVisitor when visiting a node.*/
virtual void operator()(Node* node, NodeVisitor* nv);
protected:
virtual ~ClusterCullingCallback() {}