dded osg::ClipNode class for managing OpenGL clipping planes, and osgclip demo.

This commit is contained in:
Robert Osfield
2002-05-02 00:14:40 +00:00
parent 3c25b7ab7c
commit ae8076f83b
20 changed files with 610 additions and 35 deletions

View File

@@ -66,6 +66,7 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor
virtual void apply(osg::Geode& node);
virtual void apply(osg::Billboard& node);
virtual void apply(osg::LightSource& node);
virtual void apply(osg::ClipNode& node);
virtual void apply(osg::Group& node);
virtual void apply(osg::Transform& node);
@@ -288,12 +289,13 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor
_currentRenderGraph->addLeaf(createOrReuseRenderLeaf(drawable,_projectionStack.back().get(),matrix,depth));
}
/** Add a light to current render graph.*/
inline void addLight(osg::Light* light,osg::Matrix* matrix)
/** Add an attribute which is positioned related to the modelview matrix.*/
inline void addPositionedAttribute(osg::Matrix* matrix,const osg::StateAttribute* attr)
{
_currentRenderBin->_stage->addLight(light,matrix);
_currentRenderBin->_stage->addPositionedAttribute(matrix,attr);
}
/** create an impostor sprite by setting up a pre-rendering stage
* to generate the impostor texture. */
osg::ImpostorSprite* createImpostorSprite(osg::Impostor& node);

View File

@@ -100,11 +100,11 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin
return _renderStageLighting.get();
}
virtual void addLight(osg::Light* light,osg::Matrix* matrix)
virtual void addPositionedAttribute(osg::Matrix* matrix,const osg::StateAttribute* attr)
{
getRenderStageLighting()->addLight(light,matrix);
getRenderStageLighting()->addPositionedAttribute(matrix,attr);
}
virtual void draw(osg::State& state,RenderLeaf*& previous);
void addToDependencyList(RenderStage* rs);

View File

@@ -30,19 +30,19 @@ class OSGUTIL_EXPORT RenderStageLighting : public osg::Object
virtual void reset();
typedef std::pair< osg::Light*, osg::ref_ptr<osg::Matrix> > LightMatrixPair;
typedef std::vector< LightMatrixPair > LightList;
typedef std::pair< const osg::StateAttribute*, osg::ref_ptr<osg::Matrix> > AttrMatrixPair;
typedef std::vector< AttrMatrixPair > AttrMatrixList;
virtual void addLight(osg::Light* light,osg::Matrix* matrix)
virtual void addPositionedAttribute(osg::Matrix* matrix,const osg::StateAttribute* attr)
{
_lightList.push_back(LightMatrixPair(light,matrix));
_attrList.push_back(AttrMatrixPair(attr,matrix));
}
virtual void draw(osg::State& state,RenderLeaf*& previous);
public:
LightList _lightList;
AttrMatrixList _attrList;
protected: