MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / initMatInstances

Method initMatInstances

Engine/source/materials/materialList.cpp:399–433  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

397}
398
399void MaterialList::initMatInstances( const FeatureSet &features,
400 const GFXVertexFormat *vertexFormat )
401{
402 for( U32 i=0; i < mMatInstList.size(); i++ )
403 {
404 BaseMatInstance *matInst = mMatInstList[i];
405 if ( !matInst )
406 continue;
407
408 if ( !matInst->init( features, vertexFormat ) )
409 {
410 Con::errorf( "MaterialList::initMatInstances - failed to initialize material instance for '%s'",
411 matInst->getMaterial()->getName() );
412
413 // Fall back to warning material.
414
415 SAFE_DELETE( matInst );
416 matInst = MATMGR->createMatInstance( "WarningMaterial" );
417 matInst->init( MATMGR->getDefaultFeatures(), vertexFormat );
418 mMatInstList[ i ] = matInst;
419 }
420 else
421 {
422 AdvancedLightManager* lightMgr = dynamic_cast<AdvancedLightManager*>(LIGHTMGR);
423 if (lightMgr)
424 {
425 REFLECTMGR->getReflectionMaterial(matInst);
426
427 // Hunt for the pre-pass manager/target
428 lightMgr->getDeferredRenderBin()->getDeferredMaterial(matInst);
429 }
430 }
431 }
432
433}
434
435void MaterialList::setMaterialInst( BaseMatInstance *matInst, U32 texIndex )
436{

Callers 1

initMaterialListMethod · 0.80

Calls 9

getReflectionMaterialMethod · 0.80
getDeferredMaterialMethod · 0.80
getDeferredRenderBinMethod · 0.80
errorfFunction · 0.50
sizeMethod · 0.45
initMethod · 0.45
getNameMethod · 0.45
getMaterialMethod · 0.45
createMatInstanceMethod · 0.45

Tested by

no test coverage detected