Added new osg::OccluderNode which subclasses from osg::Group, and will

provide hooks for adding ConvexPlanerOccluders to the scene.
This commit is contained in:
Robert Osfield
2002-06-05 09:39:04 +00:00
parent 4d2dbdafac
commit 5feba17410
9 changed files with 103 additions and 15 deletions

View File

@@ -8,7 +8,6 @@
#include <osg/Node>
#include <osg/NodeVisitor>
#include <osg/Drawable>
#include <osg/ConvexPlanerOccluder>
namespace osg {
@@ -109,17 +108,6 @@ class SG_EXPORT Geode : public Node
/** compile OpenGL Display List for each geoset.*/
void compileDrawables(State& state);
/** Attach a ConvexPlanerOccluder to a Geode.*/
void setOccluder(ConvexPlanerOccluder* occluder) { _occluder = occluder; }
/** Get the ConvexPlanerOccluder* attached to a Geode. */
ConvexPlanerOccluder* getOccluder() { return _occluder.get(); }
/** Get the const ConvexPlanerOccluder* attached to a Geode.*/
const ConvexPlanerOccluder* getOccluder() const { return _occluder.get(); }
protected:
virtual ~Geode();
@@ -127,7 +115,6 @@ class SG_EXPORT Geode : public Node
virtual const bool computeBound() const;
DrawableList _drawables;
ref_ptr<ConvexPlanerOccluder> _occluder;
};

View File

@@ -22,6 +22,7 @@ class LOD;
class Switch;
class Impostor;
class EarthSky;
class OccluderNode;
/** Visitor for type safe operations on osg::Node's.
Based on GOF's Visitor pattern. The NodeVisitor
@@ -179,6 +180,7 @@ class SG_EXPORT NodeVisitor : public Referenced
virtual void apply(LOD& node) { apply((Group&)node); }
virtual void apply(Impostor& node) { apply((LOD&)node); }
virtual void apply(EarthSky& node) { apply((Group&)node); }
virtual void apply(OccluderNode& node) { apply((Group&)node); }
protected:

49
include/osg/OccluderNode Normal file
View File

@@ -0,0 +1,49 @@
//C++ header - Open Scene Graph - Copyright (C) 1998-2001 Robert Osfield
//Distributed under the terms of the GNU Library General Public License (LGPL)
//as published by the Free Software Foundation.
#ifndef OSG_OCCLUDERNODE
#define OSG_OCCLUDERNODE 1
#include <osg/Group>
#include <osg/ConvexPlanerOccluder>
namespace osg {
/** OccluderNode is a Group node which allows OccluderNodeing between children.
Typical uses would be for objects which might need to be rendered
differently at different times, for instance a OccluderNode could be used
to represent the different states of a traffic light.
*/
class SG_EXPORT OccluderNode : public Group
{
public :
OccluderNode();
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
OccluderNode(const OccluderNode&,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
META_Node(OccluderNode);
/** Attach a ConvexPlanerOccluder to an OccluderNode.*/
void setOccluder(ConvexPlanerOccluder* occluder) { _occluder = occluder; }
/** Get the ConvexPlanerOccluder* attached to a OccluderNode. */
ConvexPlanerOccluder* getOccluder() { return _occluder.get(); }
/** Get the const ConvexPlanerOccluder* attached to a OccluderNode.*/
const ConvexPlanerOccluder* getOccluder() const { return _occluder.get(); }
protected :
virtual ~OccluderNode() {}
ref_ptr<ConvexPlanerOccluder> _occluder;
};
}
#endif

View File

@@ -78,6 +78,7 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor
virtual void apply(osg::Switch& node);
virtual void apply(osg::LOD& node);
virtual void apply(osg::EarthSky& node);
virtual void apply(osg::OccluderNode& node);
virtual void apply(osg::Impostor& node);
void setEarthSky(const osg::EarthSky* earthSky) { _earthSky = earthSky; }