| 41 | } |
| 42 | |
| 43 | BaseMatInstance* InstancingMaterialHook::getInstancingMat( BaseMatInstance *matInst ) |
| 44 | { |
| 45 | PROFILE_SCOPE( InstancingMaterialHook_GetInstancingMat ); |
| 46 | |
| 47 | if ( matInst == NULL ) |
| 48 | return NULL; |
| 49 | |
| 50 | InstancingMaterialHook *hook = matInst->getHook<InstancingMaterialHook>(); |
| 51 | if ( hook == NULL ) |
| 52 | { |
| 53 | hook = new InstancingMaterialHook(); |
| 54 | matInst->addHook( hook ); |
| 55 | |
| 56 | BaseMatInstance *instMat = matInst->getMaterial()->createMatInstance(); |
| 57 | FeatureSet features( matInst->getRequestedFeatures() ); |
| 58 | features.addFeature( MFT_UseInstancing ); |
| 59 | |
| 60 | // Allow for named texture assignments |
| 61 | Material::sAllowTextureTargetAssignment = true; |
| 62 | |
| 63 | if ( !instMat->init( features, matInst->getVertexFormat() ) ) |
| 64 | SAFE_DELETE( instMat ); |
| 65 | |
| 66 | // Turn back off named texture assignments |
| 67 | Material::sAllowTextureTargetAssignment = false; |
| 68 | |
| 69 | hook->mMatInst = instMat; |
| 70 | } |
| 71 | |
| 72 | return hook->mMatInst; |
| 73 | } |
nothing calls this directly
no test coverage detected