feat: post-effects array parameters & add gfx.posteffects.set_array & make shadows opacity depending on clouds opacity

This commit is contained in:
MihailRis
2025-06-14 20:06:05 +03:00
parent 02a91e0b72
commit 436a89b066
14 changed files with 223 additions and 78 deletions
@@ -57,6 +57,22 @@ static int l_set_params(lua::State* L) {
return 0;
}
static int l_set_array(lua::State* L) {
size_t index = static_cast<size_t>(lua::tointeger(L, 1));
auto key = lua::require_string(L, 2);
auto data = lua::require_lstring(L, 3);
auto effect = post_processing->getEffect(index);
if (effect == nullptr) {
return 0;
}
std::vector<ubyte> buffer(
reinterpret_cast<const ubyte*>(data.begin()),
reinterpret_cast<const ubyte*>(data.end())
);
effect->setArray(key, std::move(buffer));
return 0;
}
const luaL_Reg posteffectslib[] = {
{"index", lua::wrap<l_index>},
{"set_effect", lua::wrap<l_set_effect>},
@@ -64,5 +80,6 @@ const luaL_Reg posteffectslib[] = {
{"set_intensity", lua::wrap<l_set_intensity>},
{"is_active", lua::wrap<l_is_active>},
{"set_params", lua::wrap<l_set_params>},
{"set_array", lua::wrap<l_set_array>},
{NULL, NULL}
};