MCPcopy Create free account
hub / github.com/carbonengine/trinity / GetMeshAreaParameter

Method GetMeshAreaParameter

trinity/Eve/SpaceObjectFactory/EveSOFDNA.cpp:1254–1364  ·  view source on GitHub ↗

-------------------------------------------------------------------------------- Description: Return a shader parameter for a faction override --------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1252// Return a shader parameter for a faction override
1253// --------------------------------------------------------------------------------
1254const Vector4* EveSOFDNA::GetMeshAreaParameter( EveSOFDataArea::AreaType areaType, const BlueSharedString& parameterName, const std::map<BlueSharedString, Vector4>* hullParameters, unsigned int blockededMaterials ) const
1255{
1256 CCP_STATS_ZONE( __FUNCTION__ );
1257
1258 // do we have a dna mesh command for this?
1259 std::vector<std::string> commandArgs;
1260 if( GetDnaCommandArgs( CMD_MATERIAL, commandArgs ) )
1261 {
1262 // indentify material paramater and material index
1263 EveSOFUtilsParameterName param( m_genericData->materialPrefixes, parameterName.c_str() );
1264 if( param.IsMaterialIdxValid() && ( param.GetMaterialIdx() < (int32_t)commandArgs.size() ) )
1265 {
1266 // some materials are not flagged as blocked for overrides
1267 if( !( blockededMaterials & ( 1 << param.GetMaterialIdx() ) ) )
1268 {
1269 // get the material from the lib
1270 const Vector4* res = EveSOFUtils::SearchForParameterData( m_dataMgr, commandArgs[param.GetMaterialIdx()].c_str(), &param );
1271 if( res )
1272 {
1273 return res;
1274 }
1275 }
1276 }
1277 }
1278
1279 // do we have a dna pattern command for this?
1280 if( GetDnaCommandArgs( CMD_PATTERN, commandArgs ) )
1281 {
1282 // indentify material paramater and material index
1283 EveSOFUtilsParameterName param( m_genericData->patternMaterialPrefixes, parameterName.c_str() );
1284 if( param.IsMaterialIdxValid() && ( 1 + param.GetMaterialIdx() < (int32_t)commandArgs.size() ) )
1285 {
1286 // get the material from the lib
1287 const Vector4* res = EveSOFUtils::SearchForParameterData( m_dataMgr, commandArgs[1 + param.GetMaterialIdx()].c_str(), &param );
1288 if( res )
1289 {
1290 return res;
1291 }
1292 }
1293 }
1294
1295 // is this a pattern parameter?
1296 {
1297 EveSOFUtilsParameterName param( m_genericData->patternMaterialPrefixes, parameterName.c_str() );
1298 if( param.IsMaterialIdxValid() )
1299 {
1300 if( param.GetMaterialIdx() == 0 )
1301 {
1302 // get the material from the lib using the racial name
1303 const Vector4* res = EveSOFUtils::SearchForParameterData( m_dataMgr, m_factionData->defaultPatternLayer1MaterialName.c_str(), &param );
1304 if( res )
1305 {
1306 return res;
1307 }
1308 }
1309 else if( UsingSof6() && param.GetMaterialIdx() == 1 )
1310 {
1311 const Vector4* res = EveSOFUtils::SearchForParameterData( m_dataMgr, m_factionData->defaultPatternLayer2MaterialName.c_str(), &param );

Callers 2

FillMeshAreaVectorMethod · 0.80
SetupInstancedMeshesMethod · 0.80

Calls 4

IsMaterialIdxValidMethod · 0.80
GetMaterialIdxMethod · 0.80
sizeMethod · 0.80
endMethod · 0.45

Tested by

no test coverage detected