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

Function SetLightInstance

engine/render/src/render/light.cpp:120–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118 }
119
120 void SetLightInstance(HRenderContext render_context, HLightInstance instance, dmVMath::Point3 position, dmVMath::Quat rotation)
121 {
122 LightInstance* light_instance = render_context->m_RenderLights.Get(instance);
123 if (!light_instance)
124 {
125 return;
126 }
127
128 dmVMath::Vector3 direction = dmVMath::Rotate(rotation, light_instance->m_LightPrototype->m_Direction);
129 bool needs_commit = !Vector3Equals(dmVMath::Vector3(position), dmVMath::Vector3(light_instance->m_Position)) || !Vector3Equals(direction, light_instance->m_Direction);
130
131 light_instance->m_Position = position;
132 light_instance->m_Direction = direction;
133
134 if (needs_commit)
135 {
136 CommitLightInstance(render_context, light_instance);
137 }
138 }
139
140 ////////////////////////////////
141 // Light buffer

Callers 2

TEST_FFunction · 0.85
CompLightLateUpdateFunction · 0.85

Calls 5

Vector3EqualsFunction · 0.85
CommitLightInstanceFunction · 0.85
RotateFunction · 0.50
Vector3Class · 0.50
GetMethod · 0.45

Tested by 1

TEST_FFunction · 0.68