From: frohlich Date: Mon, 31 Dec 2007 15:49:01 +0000 (+0000) Subject: Modified Files: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=92d8fa119332344f6442a915facff6ea72bf0984;p=simgear.git Modified Files: simgear/scene/model/SGClipGroup.cxx simgear/scene/model/SGClipGroup.hxx Update the clip group. --- diff --git a/simgear/scene/model/SGClipGroup.cxx b/simgear/scene/model/SGClipGroup.cxx index bbddbcb0..38c09117 100644 --- a/simgear/scene/model/SGClipGroup.cxx +++ b/simgear/scene/model/SGClipGroup.cxx @@ -52,15 +52,15 @@ public: { 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() @@ -110,6 +110,15 @@ SGClipGroup::SGClipGroup() 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(sa)); + } +} + osg::BoundingSphere SGClipGroup::computeBound() const { diff --git a/simgear/scene/model/SGClipGroup.hxx b/simgear/scene/model/SGClipGroup.hxx index 7961bfb9..eb0e0ddb 100644 --- a/simgear/scene/model/SGClipGroup.hxx +++ b/simgear/scene/model/SGClipGroup.hxx @@ -33,6 +33,9 @@ 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;