Modified Files:

simgear/scene/model/SGClipGroup.cxx
	simgear/scene/model/SGClipGroup.hxx Update the clip group.
This commit is contained in:
frohlich 2007-12-31 15:49:01 +00:00
parent 9c51bf3edf
commit 92d8fa1193
2 changed files with 18 additions and 6 deletions

View 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
{

View 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;