]> git.mxchange.org Git - simgear.git/commitdiff
Modified Files:
authorfrohlich <frohlich>
Mon, 31 Dec 2007 15:49:01 +0000 (15:49 +0000)
committerfrohlich <frohlich>
Mon, 31 Dec 2007 15:49:01 +0000 (15:49 +0000)
simgear/scene/model/SGClipGroup.cxx
simgear/scene/model/SGClipGroup.hxx Update the clip group.

simgear/scene/model/SGClipGroup.cxx
simgear/scene/model/SGClipGroup.hxx

index bbddbcb07675fd25f22804380cddaa3660ddcc56..38c09117849712e99482fefc38cf73c6bbca7095 100644 (file)
@@ -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<osg::ClipPlane*>(sa));
+  }
+}
+
 osg::BoundingSphere
 SGClipGroup::computeBound() const
 {
index 7961bfb9d033f92d0b16b6f1d457bf6e9c2d0110..eb0e0ddbb778815372a035f2f0062db570553f3a 100644 (file)
@@ -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;