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.