| 397 | } |
| 398 | |
| 399 | void 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 | |
| 435 | void MaterialList::setMaterialInst( BaseMatInstance *matInst, U32 texIndex ) |
| 436 | { |
no test coverage detected