From 66cd55bed0e22434f4cd91c3f7f9729fb7e0af32 Mon Sep 17 00:00:00 2001 From: nashmuhandes Date: Thu, 24 Oct 2024 11:31:12 +0800 Subject: [PATCH] Change SetSunDirection to take in angle and pitch --- src/rendering/hwrenderer/doom_levelmesh.cpp | 8 ++++---- wadsrc/static/zscript/doombase.zs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/rendering/hwrenderer/doom_levelmesh.cpp b/src/rendering/hwrenderer/doom_levelmesh.cpp index 03e0ab2dc..aee1bfeb6 100644 --- a/src/rendering/hwrenderer/doom_levelmesh.cpp +++ b/src/rendering/hwrenderer/doom_levelmesh.cpp @@ -2238,11 +2238,11 @@ DEFINE_ACTION_FUNCTION(_Lightmap, Invalidate) DEFINE_ACTION_FUNCTION(_Lightmap, SetSunDirection) { PARAM_PROLOGUE; - PARAM_FLOAT(x); - PARAM_FLOAT(y); - PARAM_FLOAT(z); + PARAM_FLOAT(ang); + PARAM_FLOAT(pch); - auto vec = FVector3(float(x), float(y), float(z)); + double cosp = g_cos(pch); + auto vec = FVector3(float(g_cos(ang) * cosp), float(g_sin(ang) * cosp), float(-g_sin(pch))); if (!vec.isZero() && level.levelMesh) { diff --git a/wadsrc/static/zscript/doombase.zs b/wadsrc/static/zscript/doombase.zs index f1fd4f8de..8f055e1ed 100644 --- a/wadsrc/static/zscript/doombase.zs +++ b/wadsrc/static/zscript/doombase.zs @@ -817,9 +817,9 @@ struct Lightmap // Mark all lightmap surfaces for recalculation. The internal lightmapper will gradually recalculate every single lightmap surface in the level. native static void Invalidate(); - // Set direction of the light towards the sun. + // Set direction of the light towards the sun. Angle and pitch matches ZDRayInfo. // Calling this does NOT recalculate the lightmap. - native static void SetSunDirection(Vector3 dir); + native static void SetSunDirection(double ang, double pch); // Can go above 1.0 (call Invalidate()) // Calling this does NOT recalculate the lightmap.