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

Method getInstancingMat

Engine/source/ts/instancingMatHook.cpp:43–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43BaseMatInstance* 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}

Callers

nothing calls this directly

Calls 6

addHookMethod · 0.80
addFeatureMethod · 0.80
createMatInstanceMethod · 0.45
getMaterialMethod · 0.45
initMethod · 0.45
getVertexFormatMethod · 0.45

Tested by

no test coverage detected