void CVRCullVisitor::apply(osg::ClipNode& node) { // push the node's state. StateSet* node_state = node.getStateSet(); if(node_state) pushStateSet(node_state); RefMatrix& matrix = *getModelViewMatrix(); const ClipNode::ClipPlaneList& planes = node.getClipPlaneList(); for(ClipNode::ClipPlaneList::const_iterator itr = planes.begin(); itr != planes.end(); ++itr) { if(node.getReferenceFrame() == osg::ClipNode::RELATIVE_RF) { addPositionedAttribute(&matrix,itr->get()); } else { addPositionedAttribute(0,itr->get()); } } handle_cull_callbacks_and_traverse(node); // pop the node's state off the geostate stack. if(node_state) popStateSet(); }
void ShaderGenerator::apply(osg::ClipNode& node) { static const char* s_clip_source = "#version " GLSL_VERSION_STR "\n" "void oe_sg_set_clipvertex(inout vec4 vertexVIEW)\n" "{\n" " gl_ClipVertex = vertexVIEW; \n" "}\n"; if ( !_active ) return; bool ignore; if ( node.getUserValue(SHADERGEN_HINT_IGNORE, ignore) && ignore ) return; VirtualProgram* vp = VirtualProgram::getOrCreate(node.getOrCreateStateSet()); if ( vp->referenceCount() == 1 ) vp->setName( _name ); vp->setFunction( "oe_sg_set_clipvertex", s_clip_source, ShaderComp::LOCATION_VERTEX_VIEW ); apply( static_cast<osg::Group&>(node) ); }
void ShaderGenerator::apply(osg::ClipNode& node) { static const char* s_clip_source = "#version " GLSL_VERSION_STR "\n" "void sg_set_clipvertex(inout vec4 vertexVIEW)\n" "{\n" " gl_ClipVertex = vertexVIEW; \n" "}\n"; if ( !_active ) return; VirtualProgram* vp = VirtualProgram::getOrCreate(node.getOrCreateStateSet()); vp->setFunction( "sg_set_clipvertex", s_clip_source, ShaderComp::LOCATION_VERTEX_VIEW ); apply( static_cast<osg::Group&>(node) ); }