本文整理汇总了C++中VirtualProgram::removeShader方法的典型用法代码示例。如果您正苦于以下问题:C++ VirtualProgram::removeShader方法的具体用法?C++ VirtualProgram::removeShader怎么用?C++ VirtualProgram::removeShader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VirtualProgram
的用法示例。
在下文中一共展示了VirtualProgram::removeShader方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
SplatTerrainEffect::onUninstall(TerrainEngineNode* engine)
{
osg::StateSet* stateset = engine->getStateSet();
if ( stateset )
{
if ( _splatTexUniform.valid() )
{
stateset->removeUniform( _scaleOffsetUniform.get() );
stateset->removeUniform( _warpUniform.get() );
stateset->removeUniform( _samplesUniform.get() );
stateset->removeUniform( _intensityUniform.get() );
stateset->removeUniform( _splatTexUniform.get() );
stateset->removeUniform( _coverageTexUniform.get() );
stateset->removeTextureAttribute( _splatTexUnit, osg::StateAttribute::TEXTURE );
}
VirtualProgram* vp = VirtualProgram::get(stateset);
if ( vp )
{
vp->removeShader( "oe_splat_vertex" );
vp->removeShader( "oe_splat_fragment" );
vp->removeShader( SPLAT_FUNC );
vp->removeShader( NOISE_FUNC );
}
}
if ( _splatTexUnit >= 0 )
{
engine->getTextureCompositor()->releaseTextureImageUnit( _splatTexUnit );
_splatTexUnit = -1;
}
}
示例2:
void
DetailTexture::onUninstall(TerrainEngineNode* engine)
{
osg::StateSet* stateset = engine->getStateSet();
if ( stateset )
{
stateset->removeUniform( _startLODUniform.get() );
stateset->removeUniform( _intensityUniform.get() );
stateset->removeUniform( _scaleUniform.get() );
stateset->removeUniform( _attenuationDistanceUniform.get() );
if ( _samplerUniform.valid() )
{
int unit;
_samplerUniform->get(unit);
stateset->removeUniform( _samplerUniform.get() );
stateset->removeTextureAttribute(unit, osg::StateAttribute::TEXTURE);
}
VirtualProgram* vp = VirtualProgram::get(stateset);
if ( vp )
{
vp->removeShader( "oe_detail_vertex" );
vp->removeShader( "oe_detail_fragment" );
}
}
if ( _unit >= 0 )
{
engine->getTextureCompositor()->releaseTextureImageUnit( _unit );
_unit = -1;
}
}
示例3:
void
DepthOffsetAdapter::setGraph(osg::Node* graph)
{
if ( !_supported ) return;
bool graphChanging =
_graph.get() != graph;
bool uninstall =
(_graph.valid() && _graph->getStateSet()) &&
(graphChanging || (_options.enabled() == false));
bool install =
(graph && graphChanging ) ||
(graph && (_options.enabled() == true));
if ( uninstall )
{
OE_TEST << LC << "Removing depth offset shaders" << std::endl;
// uninstall uniforms and shaders.
osg::StateSet* s = _graph->getStateSet();
s->removeUniform( _biasUniform.get() );
s->removeUniform( _rangeUniform.get() );
VirtualProgram* vp = VirtualProgram::get( s );
if ( vp )
{
vp->removeShader( "oe_doff_vertex" );
vp->removeShader( "oe_doff_fragment" );
}
}
if ( install )
{
OE_TEST << LC << "Installing depth offset shaders" << std::endl;
// install uniforms and shaders.
osg::StateSet* s = graph->getOrCreateStateSet();
s->addUniform( _biasUniform.get() );
s->addUniform( _rangeUniform.get() );
VirtualProgram* vp = VirtualProgram::getOrCreate( s );
vp->setFunction( "oe_doff_vertex", s_vertex, ShaderComp::LOCATION_VERTEX_VIEW );
vp->setFunction( "oe_doff_fragment", s_fragment, ShaderComp::LOCATION_FRAGMENT_COLORING );
s->setAttributeAndModes( vp, osg::StateAttribute::ON );
}
if ( graphChanging )
{
_graph = graph;
}
// always set Dirty when setGraph is called sine it may be called anytime
// the subgraph changes (as can be detected by a computeBound)
_dirty = (_options.automatic() == true);
}
示例4:
void
HorizonCullingProgram::remove(osg::StateSet* stateset)
{
if ( stateset )
{
VirtualProgram* vp = VirtualProgram::get(stateset);
if ( vp )
{
vp->removeShader( "oe_horizon_vertex" );
vp->removeShader( "oe_horizon_fragment" );
}
}
}
示例5:
void
PhongLightingEffect::detach(osg::StateSet* stateset)
{
if ( stateset && _supported )
{
if ( _lightingUniform.valid() )
stateset->removeUniform( _lightingUniform.get() );
VirtualProgram* vp = VirtualProgram::get( stateset );
if ( vp )
{
vp->removeShader( "oe_phong_vertex" );
vp->removeShader( "oe_phong_fragment" );
}
}
}
示例6:
void
NormalMap::onUninstall(TerrainEngineNode* engine)
{
if ( engine )
{
osg::StateSet* stateset = engine->getStateSet();
if ( stateset )
{
stateset->removeUniform( _samplerUniform.get() );
stateset->removeUniform( _startLODUniform.get() );
VirtualProgram* vp = VirtualProgram::get(stateset);
if ( vp )
{
vp->removeShader( "oe_lighting_vertex" );
vp->removeShader( "oe_lighting_fragment" );
}
}
}
}
示例7:
void
NormalMapTerrainEffect::onUninstall(TerrainEngineNode* engine)
{
osg::StateSet* stateset = engine->getStateSet();
if ( stateset )
{
VirtualProgram* vp = VirtualProgram::get(stateset);
if ( vp )
{
vp->removeShader( "oe_nmap_vertex" );
vp->removeShader( "oe_nmap_fragment" );
}
}
if ( _normalMapUnit >= 0 )
{
engine->getTextureCompositor()->releaseTextureImageUnit( _normalMapUnit );
_normalMapUnit = -1;
}
}
示例8:
void
DiscardAlphaFragments::uninstall(osg::StateSet* ss) const
{
if ( ss )
{
VirtualProgram* vp = VirtualProgram::get(ss);
if ( vp )
{
vp->removeShader("oe_discardalpha_frag");
}
}
}
示例9:
void
LODBlending::onUninstall(TerrainEngineNode* engine)
{
if ( engine )
{
osg::StateSet* stateset = engine->getStateSet();
if ( stateset )
{
stateset->removeUniform( _delayUniform.get() );
stateset->removeUniform( _durationUniform.get() );
stateset->removeUniform( _vscaleUniform.get() );
VirtualProgram* vp = VirtualProgram::get(stateset);
if ( vp )
{
vp->removeShader( "oe_lodblend_vertex" );
vp->removeShader( "oe_lodblend_fragment" );
}
}
}
}
示例10:
void
DrawInstanced::remove(osg::StateSet* stateset)
{
if ( !stateset )
return;
VirtualProgram* vp = VirtualProgram::get(stateset);
if ( !vp )
return;
vp->removeShader( "oe_di_setInstancePosition" );
stateset->removeUniform("oe_di_postex");
stateset->removeUniform("oe_di_postex_size");
}
示例11:
void
VerticalScale::onUninstall(TerrainEngineNode* engine)
{
if ( engine )
{
osg::StateSet* stateset = engine->getStateSet();
if ( stateset )
{
stateset->removeUniform( _scaleUniform.get() );
VirtualProgram* vp = VirtualProgram::get(stateset);
if ( vp )
{
vp->removeShader( "oe_vertscale_vertex" );
}
}
}
}
示例12:
void
ElevationMorph::onUninstall(TerrainEngineNode* engine)
{
if ( engine )
{
osg::StateSet* stateset = engine->getStateSet();
if ( stateset )
{
stateset->removeUniform( _delayUniform.get() );
stateset->removeUniform( _durationUniform.get() );
VirtualProgram* vp = VirtualProgram::get(stateset);
if ( vp )
{
vp->removeShader( "oe_morph_vertex" );
}
}
}
}
示例13:
void
LogarithmicDepthBuffer::uninstall(osg::Camera* camera)
{
if ( camera )
{
camera->removeCullCallback( _cullCallback.get() );
osg::StateSet* stateset = camera->getStateSet();
if ( stateset )
{
VirtualProgram* vp = VirtualProgram::get( camera->getStateSet() );
if ( vp )
{
vp->removeShader( "oe_logdepth_vert" );
}
stateset->removeUniform( "oe_logdepth_farplane" );
}
}
}
示例14: traverse
void traverse(osg::NodeVisitor& nv)
{
if (nv.getVisitorType() == nv.UPDATE_VISITOR)
{
if ( (nv.getFrameStamp()->getFrameNumber() % 2) == 0 )
{
_toggle = !_toggle;
VirtualProgram* vp = VirtualProgram::getOrCreate(this->getOrCreateStateSet());
if ( _toggle )
{
vp->setFunction(
"make_it_red", fragShader,
osgEarth::ShaderComp::LOCATION_FRAGMENT_COLORING,
new Acceptor() );
}
else
{
vp->removeShader("make_it_red");
}
}
}
osg::Group::traverse(nv);
}
示例15: if
void
TextureCompositorMultiTexture::updateMasterStateSet(osg::StateSet* stateSet,
const TextureLayout& layout ) const
{
int numSlots = layout.getMaxUsedSlot() + 1;
int maxUnits = numSlots;
if ( _useGPU )
{
// Validate against the max number of GPU texture units:
if ( maxUnits > Registry::instance()->getCapabilities().getMaxGPUTextureUnits() )
{
maxUnits = Registry::instance()->getCapabilities().getMaxGPUTextureUnits();
OE_WARN << LC
<< "Warning! You have exceeded the number of texture units available on your GPU ("
<< maxUnits << "). Consider using another compositing mode."
<< std::endl;
}
VirtualProgram* vp = static_cast<VirtualProgram*>( stateSet->getAttribute(osg::StateAttribute::PROGRAM) );
if ( maxUnits > 0 )
{
// see if we have any blended layers:
bool hasBlending = layout.containsSecondarySlots( maxUnits );
vp->setShader(
"osgearth_vert_setupTexturing",
s_createTextureVertexShader(layout, hasBlending) );
vp->setShader(
"osgearth_frag_applyTexturing",
s_createTextureFragShaderFunction(layout, maxUnits, hasBlending, _lodTransitionTime ) );
}
else
{
vp->removeShader( "osgearth_frag_applyTexturing" );
vp->removeShader( "osgearth_vert_setupTexturing" );
}
}
else
{
// Forcably disable shaders
stateSet->setAttributeAndModes( new osg::Program(), osg::StateAttribute::OFF | osg::StateAttribute::PROTECTED );
// Validate against the maximum number of textures available in FFP mode.
if ( maxUnits > Registry::instance()->getCapabilities().getMaxFFPTextureUnits() )
{
maxUnits = Registry::instance()->getCapabilities().getMaxFFPTextureUnits();
OE_WARN << LC <<
"Warning! You have exceeded the number of texture units available in fixed-function pipeline "
"mode on your graphics hardware (" << maxUnits << "). Consider using another "
"compositing mode." << std::endl;
}
// FFP multitexturing requires that we set up a series of TexCombine attributes:
if (maxUnits == 1)
{
osg::TexEnv* texenv = new osg::TexEnv(osg::TexEnv::MODULATE);
stateSet->setTextureAttributeAndModes(0, texenv, osg::StateAttribute::ON);
}
else if (maxUnits >= 2)
{
//Blend together the colors and accumulate the alpha values of textures 0 and 1 on unit 0
{
osg::TexEnvCombine* texenv = new osg::TexEnvCombine;
texenv->setCombine_RGB(osg::TexEnvCombine::INTERPOLATE);
texenv->setCombine_Alpha(osg::TexEnvCombine::ADD);
texenv->setSource0_RGB(osg::TexEnvCombine::TEXTURE0+1);
texenv->setOperand0_RGB(osg::TexEnvCombine::SRC_COLOR);
texenv->setSource0_Alpha(osg::TexEnvCombine::TEXTURE0+1);
texenv->setOperand0_Alpha(osg::TexEnvCombine::SRC_ALPHA);
texenv->setSource1_RGB(osg::TexEnvCombine::TEXTURE0+0);
texenv->setOperand1_RGB(osg::TexEnvCombine::SRC_COLOR);
texenv->setSource1_Alpha(osg::TexEnvCombine::TEXTURE0+0);
texenv->setOperand1_Alpha(osg::TexEnvCombine::SRC_ALPHA);
texenv->setSource2_RGB(osg::TexEnvCombine::TEXTURE0+1);
texenv->setOperand2_RGB(osg::TexEnvCombine::SRC_ALPHA);
stateSet->setTextureAttributeAndModes(0, texenv, osg::StateAttribute::ON);
}
//For textures 2 and beyond, blend them together with the previous
//Add the alpha values of this unit and the previous unit
for (int unit = 1; unit < maxUnits-1; ++unit)
{
osg::TexEnvCombine* texenv = new osg::TexEnvCombine;
texenv->setCombine_RGB(osg::TexEnvCombine::INTERPOLATE);
texenv->setCombine_Alpha(osg::TexEnvCombine::ADD);
texenv->setSource0_RGB(osg::TexEnvCombine::TEXTURE0+unit+1);
texenv->setOperand0_RGB(osg::TexEnvCombine::SRC_COLOR);
texenv->setSource0_Alpha(osg::TexEnvCombine::TEXTURE0+unit+1);
texenv->setOperand0_Alpha(osg::TexEnvCombine::SRC_ALPHA);
//.........这里部分代码省略.........