mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-13 06:15:36 -04:00
add getCurrentSunLightDirection
This commit is contained in:
parent
6be96da6a4
commit
d20a56517b
@ -487,6 +487,7 @@ namespace MWBase
|
|||||||
// Allow NPCs to use torches?
|
// Allow NPCs to use torches?
|
||||||
virtual bool useTorches() const = 0;
|
virtual bool useTorches() const = 0;
|
||||||
|
|
||||||
|
virtual const osg::Vec4f& getSunLightPosition() const = 0;
|
||||||
virtual float getSunVisibility() const = 0;
|
virtual float getSunVisibility() const = 0;
|
||||||
virtual float getSunPercentage() const = 0;
|
virtual float getSunPercentage() const = 0;
|
||||||
|
|
||||||
|
@ -117,12 +117,8 @@ namespace MWLua
|
|||||||
weatherT["recordId"] = sol::readonly_property([](const MWWorld::Weather& w) { return w.mId.serializeText(); });
|
weatherT["recordId"] = sol::readonly_property([](const MWWorld::Weather& w) { return w.mId.serializeText(); });
|
||||||
|
|
||||||
api["getCurrent"] = []() { return MWBase::Environment::get().getWorld()->getCurrentWeather(); };
|
api["getCurrent"] = []() { return MWBase::Environment::get().getWorld()->getCurrentWeather(); };
|
||||||
api["getNext"] = []() -> sol::optional<const MWWorld::Weather&> {
|
api["getNext"]
|
||||||
auto next = MWBase::Environment::get().getWorld()->getNextWeather();
|
= []() -> const MWWorld::Weather* { return MWBase::Environment::get().getWorld()->getNextWeather(); };
|
||||||
if (next != nullptr)
|
|
||||||
return *next;
|
|
||||||
return sol::nullopt;
|
|
||||||
};
|
|
||||||
api["getTransition"] = []() { return MWBase::Environment::get().getWorld()->getWeatherTransition(); };
|
api["getTransition"] = []() { return MWBase::Environment::get().getWorld()->getWeatherTransition(); };
|
||||||
|
|
||||||
api["changeWeather"] = [](std::string_view regionId, const MWWorld::Weather& weather) {
|
api["changeWeather"] = [](std::string_view regionId, const MWWorld::Weather& weather) {
|
||||||
@ -151,6 +147,12 @@ namespace MWLua
|
|||||||
// Provide access to the store.
|
// Provide access to the store.
|
||||||
api["records"] = WeatherStore{};
|
api["records"] = WeatherStore{};
|
||||||
|
|
||||||
|
api["getCurrentSunLightDirection"] = []() {
|
||||||
|
osg::Vec4f sunPos = MWBase::Environment::get().getWorld()->getSunLightPosition();
|
||||||
|
sunPos.normalize();
|
||||||
|
|
||||||
|
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(); };
|
||||||
api["getCurrentWindSpeed"] = []() { return MWBase::Environment::get().getWorld()->getWindSpeed(); };
|
api["getCurrentWindSpeed"] = []() { return MWBase::Environment::get().getWorld()->getWindSpeed(); };
|
||||||
|
@ -139,6 +139,7 @@ namespace MWRender
|
|||||||
int skyGetSecundaPhase() const;
|
int skyGetSecundaPhase() const;
|
||||||
void skySetMoonColour(bool red);
|
void skySetMoonColour(bool red);
|
||||||
|
|
||||||
|
const osg::Vec4f& getSunLightPosition() const { return mSunLight->getPosition(); }
|
||||||
void setSunDirection(const osg::Vec3f& direction);
|
void setSunDirection(const osg::Vec3f& direction);
|
||||||
void setSunColour(const osg::Vec4f& diffuse, const osg::Vec4f& specular, float sunVis);
|
void setSunColour(const osg::Vec4f& diffuse, const osg::Vec4f& specular, float sunVis);
|
||||||
void setNight(bool isNight) { mNight = isNight; }
|
void setNight(bool isNight) { mNight = isNight; }
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#include "worldimp.hpp"
|
#include "worldimp.hpp"
|
||||||
|
|
||||||
#include <charconv>
|
#include <charconv>
|
||||||
#include <functional>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <osg/ComputeBoundsVisitor>
|
#include <osg/ComputeBoundsVisitor>
|
||||||
@ -3154,6 +3153,11 @@ namespace MWWorld
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const osg::Vec4f& World::getSunLightPosition() const
|
||||||
|
{
|
||||||
|
return mRendering->getSunLightPosition();
|
||||||
|
}
|
||||||
|
|
||||||
float World::getSunVisibility() const
|
float World::getSunVisibility() const
|
||||||
{
|
{
|
||||||
return mWeatherManager->getSunVisibility();
|
return mWeatherManager->getSunVisibility();
|
||||||
|
@ -579,6 +579,7 @@ namespace MWWorld
|
|||||||
// Allow NPCs to use torches?
|
// Allow NPCs to use torches?
|
||||||
bool useTorches() const override;
|
bool useTorches() const override;
|
||||||
|
|
||||||
|
const osg::Vec4f& getSunLightPosition() const override;
|
||||||
float getSunVisibility() const override;
|
float getSunVisibility() const override;
|
||||||
float getSunPercentage() const override;
|
float getSunPercentage() const override;
|
||||||
|
|
||||||
|
@ -1235,6 +1235,11 @@
|
|||||||
-- @param #string regionId
|
-- @param #string regionId
|
||||||
-- @param #WeatherData The weather to change to
|
-- @param #WeatherData The weather to change to
|
||||||
|
|
||||||
|
---
|
||||||
|
-- Get the current direction of the light of the sun.
|
||||||
|
-- @function [parent=#Weather] getCurrentSunLightDirection
|
||||||
|
-- @return openmw.util#Vector4
|
||||||
|
|
||||||
---
|
---
|
||||||
-- Get the current sun visibility taking weather transition into account.
|
-- Get the current sun visibility taking weather transition into account.
|
||||||
-- @function [parent=#Weather] getCurrentSunVisibility
|
-- @function [parent=#Weather] getCurrentSunVisibility
|
||||||
|
Loading…
x
Reference in New Issue
Block a user