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

Function CompLightDestroy

engine/gamesys/src/gamesys/components/comp_light.cpp:107–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105 }
106
107 static dmGameObject::CreateResult CompLightDestroy(const dmGameObject::ComponentDestroyParams& params)
108 {
109 LightWorld* world = (LightWorld*) params.m_World;
110 LightContext* context = (LightContext*)params.m_Context;
111 LightComponent* light = (LightComponent*) *params.m_UserData;
112
113 for (uint32_t i = 0; i < world->m_Components.Size(); ++i)
114 {
115 if (world->m_Components[i] == light)
116 {
117 world->m_Components.EraseSwap(i);
118
119 dmRender::DeleteLightInstance(context->m_RenderContext, light->m_LightInstance);
120
121 delete light;
122 return dmGameObject::CREATE_RESULT_OK;
123 }
124 }
125 return dmGameObject::CREATE_RESULT_OK;
126 }
127
128 static dmGameObject::CreateResult CompLightAddToUpdate(const dmGameObject::ComponentAddToUpdateParams& params)
129 {

Callers

nothing calls this directly

Calls 2

DeleteLightInstanceFunction · 0.85
SizeMethod · 0.45

Tested by

no test coverage detected