Change SetSunDirection to take in angle and pitch

This commit is contained in:
nashmuhandes 2024-10-24 11:31:12 +08:00 committed by Nash Muhandes
commit a37c47cf92
2 changed files with 8 additions and 6 deletions

View file

@ -2238,11 +2238,13 @@ 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));
auto a = FAngle::fromDeg(float(ang));
auto p = FAngle::fromDeg(float(pch));
auto cosp = p.Cos();
auto vec = -FVector3{ cosp * a.Cos(), cosp * a.Sin(), -p.Sin() };
if (!vec.isZero() && level.levelMesh)
{

View file

@ -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.