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

Method _initMaterial

Engine/source/environment/skyBox.cpp:592–620  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

590}
591
592void SkyBox::_initMaterial()
593{
594 if ( mMatInstance )
595 SAFE_DELETE( mMatInstance );
596
597 if ( mMaterial )
598 mMatInstance = mMaterial->createMatInstance();
599 else
600 mMatInstance = MATMGR->createMatInstance( "WarningMaterial" );
601
602 // We want to disable culling and z write.
603 GFXStateBlockDesc desc;
604 desc.setCullMode( GFXCullNone );
605 desc.setBlend( true );
606 desc.setZReadWrite( true, false );
607 desc.zFunc = GFXCmpLessEqual;
608 mMatInstance->addStateBlockDesc( desc );
609
610 // Also disable lighting on the skybox material by default.
611 FeatureSet features = MATMGR->getDefaultFeatures();
612 features.removeFeature( MFT_RTLighting );
613 features.removeFeature( MFT_Visibility );
614 features.removeFeature(MFT_ReflectionProbes);
615 features.addFeature(MFT_isBackground);
616 features.addFeature(MFT_SkyBox);
617
618 // Now initialize the material.
619 mMatInstance->init(features, getGFXVertexFormat<GFXVertexPNT>());
620}
621
622void SkyBox::_updateMaterial()
623{

Callers

nothing calls this directly

Calls 8

setCullModeMethod · 0.80
setBlendMethod · 0.80
setZReadWriteMethod · 0.80
removeFeatureMethod · 0.80
addFeatureMethod · 0.80
createMatInstanceMethod · 0.45
addStateBlockDescMethod · 0.45
initMethod · 0.45

Tested by

no test coverage detected