Changeset 13041 for OpenSceneGraph/trunk/src/osgPlugins/geo/ClipRegion.cpp
- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgPlugins/geo/ClipRegion.cpp
r4852 r13041 32 32 33 33 void GeoClipRegion::addClipNode(osg::Node *gd) { 34 34 35 35 osg::StateSet *state=gd->getOrCreateStateSet(); 36 36 // add clip node(s) to set stencil bit marking the clip area. 37 // stencil op so that the stencil buffer get set at the clip pixels 37 // stencil op so that the stencil buffer get set at the clip pixels 38 38 osg::Stencil* stencil = new osg::Stencil; 39 39 stencil->setFunction(osg::Stencil::ALWAYS,1,~0u); 40 40 stencil->setOperation(osg::Stencil::KEEP, osg::Stencil::KEEP, osg::Stencil::REPLACE); 41 41 state->setAttributeAndModes(stencil,osg::StateAttribute::ON); 42 42 43 43 // switch off the writing to the color bit planes. (Dont show the clip area) 44 44 osg::ColorMask* colorMask = new osg::ColorMask; 45 45 colorMask->setMask(false,false,false,false); 46 46 47 47 state->setRenderBinDetails(stencilbin,"RenderBin"); 48 48 state->setMode(GL_CULL_FACE,osg::StateAttribute::OFF); … … 57 57 58 58 bool GeoClipRegion::addChild( osg::Node *child ) 59 { 60 // bin the last - draw 'real' scenery last, using Z buffer to clip against any clip region... 59 { 60 // bin the last - draw 'real' scenery last, using Z buffer to clip against any clip region... 61 61 62 osg::StateSet* statesetBin2 = child->getOrCreateStateSet(); 62 osg::StateSet* statesetBin2 = child->getOrCreateStateSet(); 63 63 statesetBin2->setRenderBinDetails(stencilbin+3,"RenderBin"); 64 64 /* osg::Stencil* stencil = new osg::Stencil; … … 119 119 osg::StateSet *state=ndclip->getOrCreateStateSet(); 120 120 // last bin - draw clip area and blend it with the clipped, visible geometry. 121 121 122 122 // set up depth so all writing to depth goes to maximum depth. 123 123 osg::Depth* depth = new osg::Depth;
