From 4a6c3cde3cf4ef113a1a3787e79bfdc5407f21b4 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 23 Apr 2020 07:25:05 -0400 Subject: [PATCH] CWorldLight: Eliminate variable shadowing While we're at it, we can make use of structured bindings. --- Runtime/World/CWorldLight.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Runtime/World/CWorldLight.cpp b/Runtime/World/CWorldLight.cpp index e55b487af..e47165e9d 100644 --- a/Runtime/World/CWorldLight.cpp +++ b/Runtime/World/CWorldLight.cpp @@ -57,14 +57,12 @@ CLight CWorldLight::GetAsCGraphicsLight() const { CLight::BuildSpot(x10_position, x1c_direction.normalized(), zeus::CColor{x4_color.x(), x4_color.y(), x4_color.z(), 1.f}, x2c_cutoffAngle * .5f); - float c, l, q; - std::tie(c, l, q) = CalculateLightFalloff(x3c_falloff, x28_q); - - light.SetAttenuation(c, l, q); + const auto [constant, linear, quadratic] = CalculateLightFalloff(x3c_falloff, x28_q); + light.SetAttenuation(constant, linear, quadratic); return light; } - float distC, distL, distQ; - std::tie(distC, distL, distQ) = CalculateLightFalloff(x3c_falloff, x28_q); + + const auto [distC, distL, distQ] = CalculateLightFalloff(x3c_falloff, x28_q); return CLight::BuildCustom(x10_position, zeus::CVector3f{0.f, 1.f, 0.f}, zeus::CColor{x4_color.x(), x4_color.y(), x4_color.z(), 1.f}, distC, distL, distQ, 1.f, 0.f, 0.f);