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

Method _initMaterial

Engine/source/T3D/decal/decalData.cpp:313–339  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

311}
312
313void DecalData::_initMaterial()
314{
315 SAFE_DELETE( matInst );
316
317 _setMaterial(getMaterial());
318
319 if (mMaterialAsset.notNull() && mMaterialAsset->getStatus() == MaterialAsset::Ok)
320 {
321 matInst = getMaterialResource()->createMatInstance();
322 }
323 else
324 matInst = MATMGR->createMatInstance( "WarningMaterial" );
325
326 GFXStateBlockDesc desc;
327 desc.setZReadWrite( true, false );
328 //desc.zFunc = GFXCmpLess;
329 matInst->addStateBlockDesc( desc );
330
331 matInst->init( MATMGR->getDefaultFeatures(), getGFXVertexFormat<DecalVertex>() );
332 if( !matInst->isValid() )
333 {
334 Con::errorf( "DecalData::_initMaterial - failed to create material instance for '%s'", mMaterialAssetId );
335 SAFE_DELETE( matInst );
336 matInst = MATMGR->createMatInstance( "WarningMaterial" );
337 matInst->init( MATMGR->getDefaultFeatures(), getGFXVertexFormat< DecalVertex >() );
338 }
339}
340
341void DecalData::_updateMaterial()
342{

Callers

nothing calls this directly

Calls 8

notNullMethod · 0.80
setZReadWriteMethod · 0.80
errorfFunction · 0.50
getStatusMethod · 0.45
createMatInstanceMethod · 0.45
addStateBlockDescMethod · 0.45
initMethod · 0.45
isValidMethod · 0.45

Tested by

no test coverage detected