ParameterGroupDataSharedPtr createStandardBumpmapParameterData( const SamplerSharedPtr & sampler ) { EffectSpecSharedPtr materialSpec = dp::fx::EffectLibrary::instance()->getEffectSpec("standardMaterialEffectBumped"); EffectSpec::iterator groupSpecIt = materialSpec->findParameterGroupSpec( std::string( "standardBumpmapParameters" ) ); DP_ASSERT( groupSpecIt != materialSpec->endParameterGroupSpecs() ); ParameterGroupDataSharedPtr parameterData = ParameterGroupData::create( *groupSpecIt ); DP_VERIFY( parameterData->setParameter( "bumpmapSampler", sampler ) ); DP_VERIFY( parameterData->setParameter<bool>( "bumpmapEnable", !!sampler ) ); return( parameterData ); }
ParameterGroupDataSharedPtr createStandardTextureParameterData( const SamplerSharedPtr & sampler ) { EffectSpecSharedPtr materialSpec = getStandardMaterialSpec(); EffectSpec::iterator groupSpecIt = materialSpec->findParameterGroupSpec( std::string( "standardTextureParameters" ) ); DP_ASSERT( groupSpecIt != materialSpec->endParameterGroupSpecs() ); ParameterGroupDataSharedPtr parameterData = ParameterGroupData::create( *groupSpecIt ); DP_VERIFY( parameterData->setParameter( "sampler", sampler ) ); DP_VERIFY( parameterData->setParameter<bool>( "textureEnable", !!sampler ) ); return( parameterData ); }
EffectSpecSharedPtr EffectLibraryImpl::registerSpec( const EffectSpecSharedPtr& effectSpec, EffectLoader* effectLoader ) { DP_ASSERT( effectSpec ); EffectSpecs::iterator it = m_effectSpecs.find( effectSpec->getName() ); if ( it != m_effectSpecs.end() ) { DP_ASSERT( it->second.effectLoader == effectLoader ); DP_ASSERT( it->second.effectSpec->isEquivalent( effectSpec, false, false ) ); DP_ASSERT( !m_currentFile.empty() && ( it->second.effectFile == m_currentFile.top() ) ); return it->second.effectSpec; } else { m_effectSpecs[ effectSpec->getName()] = EffectSpecInfo( effectSpec, effectLoader, m_currentFile.top() ); // create EffectData for default values of EffectSpec EffectDataPrivateSharedPtr effectData = EffectDataPrivate::create( effectSpec, effectSpec->getName() ); for ( EffectSpec::iterator it = effectSpec->beginParameterGroupSpecs(); it != effectSpec->endParameterGroupSpecs(); ++it ) { effectData->setParameterGroupData( it, getParameterGroupData( (*it)->getName() ) ); } registerEffectData( effectData ); return effectSpec; } }