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

Method init

Engine/source/materials/matStateHint.cpp:31–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29const MatStateHint MatStateHint::Default( "Default" );
30
31void MatStateHint::init( const ProcessedMaterial *mat )
32{
33 PROFILE_SCOPE( MatStateHint_init );
34
35 mState.clear();
36
37 // Write the material identifier so that we batch by material
38 // specific data like diffuse color and parallax scale.
39 //
40 // NOTE: This doesn't actually cause more draw calls, but it
41 // can cause some extra unnessasary material setup when materials
42 // are different by their properties are the same.
43 //
44 const Material *material = mat->getMaterial();
45 mState += String::ToString( "Material: '%s', %d\n", material->getName(), material->getId() );
46
47 // Go thru each pass and write its state into
48 // the string in the most compact but uniquely
49 // identifiable way.
50 U32 passes = mat->getNumPasses();
51 for ( U32 i=0; i < passes; i++ )
52 mState += mat->getPass( i )->describeSelf();
53
54 // Finally intern the state string for
55 // fast pointer comparisions.
56 mState = mState.intern();
57}
58
59
60

Callers

nothing calls this directly

Calls 8

getNumPassesMethod · 0.80
internMethod · 0.80
getIdMethod · 0.65
clearMethod · 0.45
getMaterialMethod · 0.45
getNameMethod · 0.45
describeSelfMethod · 0.45
getPassMethod · 0.45

Tested by

no test coverage detected