1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-10-19 21:46:36 +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"] = []() { api["getCurrentSunLightDirection"] = []() {
osg::Vec4f sunPos = MWBase::Environment::get().getWorld()->getSunLightPosition(); osg::Vec4f sunPos = MWBase::Environment::get().getWorld()->getSunLightPosition();
// normalize to get the direction towards the sun
sunPos.normalize(); 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["getCurrentSunVisibility"] = []() { return MWBase::Environment::get().getWorld()->getSunVisibility(); };
api["getCurrentSunPercentage"] = []() { return MWBase::Environment::get().getWorld()->getSunPercentage(); }; api["getCurrentSunPercentage"] = []() { return MWBase::Environment::get().getWorld()->getSunPercentage(); };