16 if (handle ==
nullptr)
return;
20 for (
const auto& light : m_objects) {
21 if (light ==
nullptr || !light->GetIsEnable())
continue;
23 const auto& lightObject = light->GetLight();
24 const auto& position = (light->m_type == LightComponent::DIRECTIONAL)
25 ? lightObject->direction
26 :
vec4(*lightObject->position, 1.0f);
28 glUniform4f(handle->Uniforms.LightPosition + index,
29 position.x, position.y, position.z, (light->m_type == LightComponent::DIRECTIONAL) ? 0.0f : 1.0f);
30 glUniform3f(handle->Uniforms.LightColor + index, lightObject->color.x, lightObject->color.y, lightObject->color.z);
31 glUniform1i(handle->Uniforms.LightType + index, light->m_type);
32 if (handle->Uniforms.LightRadius >= 0)
33 glUniform1f(handle->Uniforms.LightRadius + index, lightObject->radius);
35 auto isShadow = light->IsShadow();
36 glUniform1i(handle->Uniforms.LightShadowMode + index, isShadow ? 1 : 0);
37 light->BindShadow(*handle, index, shadow_index);
38 if (isShadow) ++shadow_index;
42 if (index <= 0)
return;
44 glUniform1i(handle->Uniforms.LightSize, (
int)m_objects.size());