mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-08-04 07:46:40 -04:00
colors should use Misc::Color
This commit is contained in:
parent
b8fec360c3
commit
cbb96e0fc2
@ -1,7 +1,10 @@
|
|||||||
#include "weatherbindings.hpp"
|
#include "weatherbindings.hpp"
|
||||||
|
|
||||||
|
#include <osg/Vec4f>
|
||||||
|
|
||||||
#include <components/esm3/loadregn.hpp>
|
#include <components/esm3/loadregn.hpp>
|
||||||
#include <components/lua/util.hpp>
|
#include <components/lua/util.hpp>
|
||||||
|
#include <components/misc/color.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
@ -25,6 +28,11 @@ namespace
|
|||||||
}
|
}
|
||||||
size_t size() const { return MWBase::Environment::get().getWorld()->getAllWeather().size(); }
|
size_t size() const { return MWBase::Environment::get().getWorld()->getAllWeather().size(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Misc::Color color(const osg::Vec4f& color)
|
||||||
|
{
|
||||||
|
return Misc::Color(color.r(), color.g(), color.b(), color.a());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace MWLua
|
namespace MWLua
|
||||||
@ -66,39 +74,39 @@ namespace MWLua
|
|||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
weatherT["sunDiscSunsetColor"]
|
weatherT["sunDiscSunsetColor"]
|
||||||
= sol::readonly_property([](const MWWorld::Weather& w) { return w.mSunDiscSunsetColor; });
|
= sol::readonly_property([](const MWWorld::Weather& w) { return color(w.mSunDiscSunsetColor); });
|
||||||
weatherT["ambientLoopSoundID"]
|
weatherT["ambientLoopSoundID"]
|
||||||
= sol::readonly_property([](const MWWorld::Weather& w) { return w.mAmbientLoopSoundID.serializeText(); });
|
= sol::readonly_property([](const MWWorld::Weather& w) { return w.mAmbientLoopSoundID.serializeText(); });
|
||||||
weatherT["ambientColor"] = sol::readonly_property([lua](const MWWorld::Weather& w) {
|
weatherT["ambientColor"] = sol::readonly_property([lua](const MWWorld::Weather& w) {
|
||||||
sol::table result(lua, sol::create);
|
sol::table result(lua, sol::create);
|
||||||
result["sunrise"] = w.mAmbientColor.getSunriseValue();
|
result["sunrise"] = color(w.mAmbientColor.getSunriseValue());
|
||||||
result["day"] = w.mAmbientColor.getDayValue();
|
result["day"] = color(w.mAmbientColor.getDayValue());
|
||||||
result["sunset"] = w.mAmbientColor.getSunsetValue();
|
result["sunset"] = color(w.mAmbientColor.getSunsetValue());
|
||||||
result["night"] = w.mAmbientColor.getNightValue();
|
result["night"] = color(w.mAmbientColor.getNightValue());
|
||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
weatherT["fogColor"] = sol::readonly_property([lua](const MWWorld::Weather& w) {
|
weatherT["fogColor"] = sol::readonly_property([lua](const MWWorld::Weather& w) {
|
||||||
sol::table result(lua, sol::create);
|
sol::table result(lua, sol::create);
|
||||||
result["sunrise"] = w.mFogColor.getSunriseValue();
|
result["sunrise"] = color(w.mFogColor.getSunriseValue());
|
||||||
result["day"] = w.mFogColor.getDayValue();
|
result["day"] = color(w.mFogColor.getDayValue());
|
||||||
result["sunset"] = w.mFogColor.getSunsetValue();
|
result["sunset"] = color(w.mFogColor.getSunsetValue());
|
||||||
result["night"] = w.mFogColor.getNightValue();
|
result["night"] = color(w.mFogColor.getNightValue());
|
||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
weatherT["skyColor"] = sol::readonly_property([lua](const MWWorld::Weather& w) {
|
weatherT["skyColor"] = sol::readonly_property([lua](const MWWorld::Weather& w) {
|
||||||
sol::table result(lua, sol::create);
|
sol::table result(lua, sol::create);
|
||||||
result["sunrise"] = w.mSkyColor.getSunriseValue();
|
result["sunrise"] = color(w.mSkyColor.getSunriseValue());
|
||||||
result["day"] = w.mSkyColor.getDayValue();
|
result["day"] = color(w.mSkyColor.getDayValue());
|
||||||
result["sunset"] = w.mSkyColor.getSunsetValue();
|
result["sunset"] = color(w.mSkyColor.getSunsetValue());
|
||||||
result["night"] = w.mSkyColor.getNightValue();
|
result["night"] = color(w.mSkyColor.getNightValue());
|
||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
weatherT["sunColor"] = sol::readonly_property([lua](const MWWorld::Weather& w) {
|
weatherT["sunColor"] = sol::readonly_property([lua](const MWWorld::Weather& w) {
|
||||||
sol::table result(lua, sol::create);
|
sol::table result(lua, sol::create);
|
||||||
result["sunrise"] = w.mSunColor.getSunriseValue();
|
result["sunrise"] = color(w.mSunColor.getSunriseValue());
|
||||||
result["day"] = w.mSunColor.getDayValue();
|
result["day"] = color(w.mSunColor.getDayValue());
|
||||||
result["sunset"] = w.mSunColor.getSunsetValue();
|
result["sunset"] = color(w.mSunColor.getSunsetValue());
|
||||||
result["night"] = w.mSunColor.getNightValue();
|
result["night"] = color(w.mSunColor.getNightValue());
|
||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
weatherT["landFogDepth"] = sol::readonly_property([lua](const MWWorld::Weather& w) {
|
weatherT["landFogDepth"] = sol::readonly_property([lua](const MWWorld::Weather& w) {
|
||||||
@ -128,7 +136,8 @@ namespace MWLua
|
|||||||
MWBase::Environment::get().getESMStore()->get<ESM::Region>().find(region);
|
MWBase::Environment::get().getESMStore()->get<ESM::Region>().find(region);
|
||||||
MWBase::Environment::get().getWorld()->changeWeather(region, weather.mId);
|
MWBase::Environment::get().getWorld()->changeWeather(region, weather.mId);
|
||||||
};
|
};
|
||||||
|
{
|
||||||
|
}
|
||||||
sol::usertype<WeatherStore> storeT = lua.new_usertype<WeatherStore>("WeatherWorldStore");
|
sol::usertype<WeatherStore> storeT = lua.new_usertype<WeatherStore>("WeatherWorldStore");
|
||||||
storeT[sol::meta_function::to_string]
|
storeT[sol::meta_function::to_string]
|
||||||
= [](const WeatherStore& store) { return "{" + std::to_string(store.size()) + " Weather records}"; };
|
= [](const WeatherStore& store) { return "{" + std::to_string(store.size()) + " Weather records}"; };
|
||||||
|
@ -1289,9 +1289,9 @@
|
|||||||
-- @field #number distantLandFogOffset
|
-- @field #number distantLandFogOffset
|
||||||
-- @field openmw.util#Vector4 sunDiscSunsetColor
|
-- @field openmw.util#Vector4 sunDiscSunsetColor
|
||||||
-- @field #table landFogDepth A table with the keys "sunrise", "day", "sunset" and "night"
|
-- @field #table landFogDepth A table with the keys "sunrise", "day", "sunset" and "night"
|
||||||
-- @field #table skyColor A table with the keys "sunrise", "day", "sunset" and "night"
|
-- @field #table skyColor A table with the keys "sunrise", "day", "sunset" and "night". Each is a openmw.util#Color.
|
||||||
-- @field #table ambientColor A table with the keys "sunrise", "day", "sunset" and "night"
|
-- @field #table ambientColor A table with the keys "sunrise", "day", "sunset" and "night". Each is a openmw.util#Color.
|
||||||
-- @field #table fogColor A table with the keys "sunrise", "day", "sunset" and "night"
|
-- @field #table fogColor A table with the keys "sunrise", "day", "sunset" and "night". Each is a openmw.util#Color.
|
||||||
-- @field #table sunColor A table with the keys "sunrise", "day", "sunset" and "night"
|
-- @field #table sunColor A table with the keys "sunrise", "day", "sunset" and "night". Each is a openmw.util#Color.
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user