{
osg::State* state = renderInfo.getState();
- glPushAttrib(GL_TRANSFORM_BIT);
-
state->applyModelViewMatrix(mModelView.get());
- for (unsigned i = 0; i < mClipPlanes.size(); ++i)
- mClipPlanes[i]->apply(*state);
+ for (unsigned i = 0; i < mClipPlanes.size(); ++i) {
+ osg::StateAttribute::GLMode planeNum;
+ planeNum = GL_CLIP_PLANE0 + mClipPlanes[i]->getClipPlaneNum();
+ state->applyMode(planeNum, false);
+ glClipPlane(planeNum, mClipPlanes[i]->getClipPlane().ptr());
+ }
osgUtil::RenderBin::drawImplementation(renderInfo, previous);
-
- glPopAttrib();
}
virtual void reset()
setCullCallback(new CullCallback);
}
+SGClipGroup::SGClipGroup(const SGClipGroup& clip, const osg::CopyOp& copyop) :
+ osg::Group(clip, copyop)
+{
+ for (unsigned i = 0; i < mClipPlanes.size(); ++i) {
+ osg::StateAttribute* sa = copyop(mClipPlanes[i].get());
+ mClipPlanes.push_back(static_cast<osg::ClipPlane*>(sa));
+ }
+}
+
osg::BoundingSphere
SGClipGroup::computeBound() const
{
class SGClipGroup : public osg::Group {
public:
SGClipGroup();
+ SGClipGroup(const SGClipGroup&,
+ const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
+ META_Node(simgear, SGClipGroup);
virtual osg::BoundingSphere computeBound() const;