MCPcopy Create free account
hub / github.com/defold/defold / ReHash

Function ReHash

engine/gamesys/src/gamesys/components/comp_model.cpp:643–673  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

641 }
642
643 static void ReHash(ModelWorld* world, ModelComponent* component)
644 {
645 // material, textures and render constants
646 HashState32 state;
647 bool reverse = false;
648 dmHashInit32(&state, reverse);
649
650 // The unused slots should be 0
651 // Note: In the future, we want the textures so be set on a per-material basis
652 dmHashUpdateBuffer32(&state, component->m_Textures, DM_ARRAY_SIZE(component->m_Textures));
653
654 if (component->m_Material)
655 {
656 HashMaterial(&state, component->m_Material);
657 }
658
659 if (component->m_RenderConstants)
660 {
661 dmGameSystem::HashRenderConstants(component->m_RenderConstants, &state);
662 }
663
664 for (int i = 0; i < component->m_RenderItems.Size(); ++i)
665 {
666 HashState32 state_clone;
667 dmHashClone32(&state_clone, &state, false);
668 HashRenderItem(&state_clone, world, component, component->m_RenderItems[i]);
669 component->m_RenderItems[i].m_InstanceRenderHash = dmHashFinal32(&state_clone);
670 }
671
672 component->m_ReHash = 0;
673 }
674
675 static bool CreateGOBones(ModelWorld* world, ModelComponent* component)
676 {

Callers 1

CompModelUpdateFunction · 0.70

Calls 8

dmHashInit32Function · 0.85
dmHashUpdateBuffer32Function · 0.85
HashMaterialFunction · 0.85
HashRenderConstantsFunction · 0.85
dmHashClone32Function · 0.85
HashRenderItemFunction · 0.85
dmHashFinal32Function · 0.85
SizeMethod · 0.45

Tested by

no test coverage detected