1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-10-18 02:46:40 +00:00

direction of the sun light != direction to the sun

This commit is contained in:
Sebastian Fieber 2025-07-25 21:00:09 +02:00
parent a560aceb2a
commit 855b236ee8

View file

@ -157,9 +157,11 @@ namespace MWLua
api["getCurrentSunLightDirection"] = []() {
osg::Vec4f sunPos = MWBase::Environment::get().getWorld()->getSunLightPosition();
// normalize to get the direction towards the sun
sunPos.normalize();
return sunPos;
// and invert it to get the direction of the sun light
return -sunPos;
};
api["getCurrentSunVisibility"] = []() { return MWBase::Environment::get().getWorld()->getSunVisibility(); };
api["getCurrentSunPercentage"] = []() { return MWBase::Environment::get().getWorld()->getSunPercentage(); };