void ParameterGroupData::initSpec( const dp::fx::ParameterGroupSpecSharedPtr & spec ) { setName( spec->getName() ); m_parameterGroupSpec = spec; m_data.resize( m_parameterGroupSpec->getDataSize() ); DP_ASSERT( ( reinterpret_cast<size_t>(m_data.data()) & 0x7 ) == 0 ); DP_ASSERT( !m_propertyLists ); // create the PropertyList, if it's not yet there SpecToPropertyListChainMap::iterator it = gSpecToPropertyMap.find( m_parameterGroupSpec.operator->() ); // Big Hack !! if ( it == gSpecToPropertyMap.end() ) { dp::util::PropertyListImpl * pli = new dp::util::PropertyListImpl( false ); // create a non-static, local PropertyList for ( ParameterGroupSpec::iterator it = m_parameterGroupSpec->beginParameterSpecs() ; it != m_parameterGroupSpec->endParameterSpecs() ; ++it ) { addParameterProperty( pli, it ); } DP_ASSERT( !m_propertyLists ); m_propertyLists = new dp::util::PropertyListChain( false ); m_propertyLists->addPropertyList( pli ); gSpecToPropertyMap[m_parameterGroupSpec.operator->()] = std::make_pair( 1, m_propertyLists ); // Big Hack !! } else { it->second.first++; m_propertyLists = it->second.second; } }
ParameterGroupData::ParameterGroupData( const dp::fx::ParameterGroupSpecSharedPtr& parameterGroupSpec) { m_objectCode = OC_PARAMETER_GROUP_DATA; //init ( parameterGroupSpec ); initSpec( parameterGroupSpec ); initData( dp::fx::EffectLibrary::instance()->getParameterGroupData( parameterGroupSpec->getName() ) ); }
std::string UniformGeneratorGLSLStandard::generateUniforms( const dp::fx::ParameterGroupSpecSharedPtr& spec ) { std::ostringstream oss; oss << "// ParameterGroup: " << spec->getName() << "\n"; for ( ParameterGroupSpec::iterator it = spec->beginParameterSpecs(); it != spec->endParameterSpecs(); ++it ) { oss << "uniform " << getGLSLTypename( it->first ) << " " << it->first.getName(); if ( it->first.getArraySize() ) { oss << "[" << it->first.getArraySize() << "]"; } oss << ";\n"; } oss << "\n"; return( oss.str() ); }