From d28ed6b9c8f18c396876ba6b6f19cc6644324053 Mon Sep 17 00:00:00 2001 From: nashmuhandes Date: Sat, 25 Sep 2021 23:55:29 +0800 Subject: [PATCH] Fixed spotlight math to match GZDoom's --- src/lightmap/lightmap.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lightmap/lightmap.cpp b/src/lightmap/lightmap.cpp index 81e0907..3703a06 100644 --- a/src/lightmap/lightmap.cpp +++ b/src/lightmap/lightmap.cpp @@ -223,8 +223,8 @@ Vec3 LightmapBuilder::LightTexelSample(const Vec3 &origin, Surface *surface) float negPitch = -radians(tl->mapThing->pitch); float xyLen = std::cos(negPitch); Vec3 spotDir; - spotDir.x = std::sin(radians(tl->mapThing->angle)) * xyLen; - spotDir.y = std::cos(radians(tl->mapThing->angle)) * xyLen; + spotDir.x = -std::cos(radians(tl->mapThing->angle)) * xyLen; + spotDir.y = -std::sin(radians(tl->mapThing->angle)) * xyLen; spotDir.z = -std::sin(negPitch); float cosDir = Vec3::Dot(dir, spotDir); spotAttenuation = smoothstep(tl->outerAngleCos, tl->innerAngleCos, cosDir);