From e36cc8245d5b3ecfdd81193aa48422ca8850aba8 Mon Sep 17 00:00:00 2001 From: Phil Schumann Date: Fri, 30 Jan 2026 12:54:15 +0100 Subject: [PATCH] Exposes more RenderPath3D setters to Lua (#1526) --- .../ScriptingAPI-Documentation.md | 12 ++ WickedEngine/wiRenderPath3D_BindLua.cpp | 155 +++++++++++++++++- WickedEngine/wiRenderPath3D_BindLua.h | 9 + 3 files changed, 175 insertions(+), 1 deletion(-) diff --git a/Content/Documentation/ScriptingAPI-Documentation.md b/Content/Documentation/ScriptingAPI-Documentation.md index b8f2e188c..fed20733f 100644 --- a/Content/Documentation/ScriptingAPI-Documentation.md +++ b/Content/Documentation/ScriptingAPI-Documentation.md @@ -1877,6 +1877,18 @@ It inherits functions from RenderPath2D, so it can render a 2D overlay. - SetCropBottom(float value) -- Sets cropping from bottom of the screen in logical units - GetLastPostProcessRT() : Texture -- returns the last post process render texture - SetDistortionOverlay(Texture texture) -- Set a normal map texture as full screen distortion mask +- SetChromaticAberrationEnabled(bool value); +- SetChromaticAberrationAmount(float value); +- SetEyeAdaptionRate(float value); +- SetEyeAdaptionKey(float value); +- SetContrast(float value); +- SetSaturation(float value); +- SetBrightness(float value); +- SetLightShaftsFadeSpeed(float value); +- SetMeshBlendEnabled(bool value); +- SetOcclusionCullingEnabled(bool value); +- SetSSGIDepthRejection(float value); + ```lua FSR2_Preset = { diff --git a/WickedEngine/wiRenderPath3D_BindLua.cpp b/WickedEngine/wiRenderPath3D_BindLua.cpp index 0dfdda4fc..e56cfdaf6 100644 --- a/WickedEngine/wiRenderPath3D_BindLua.cpp +++ b/WickedEngine/wiRenderPath3D_BindLua.cpp @@ -77,6 +77,15 @@ namespace wi::lua lunamethod(RenderPath3D_BindLua, SetDistortionOverlay), lunamethod(RenderPath3D_BindLua, SetChromaticAberrationEnabled), lunamethod(RenderPath3D_BindLua, SetChromaticAberrationAmount), + lunamethod(RenderPath3D_BindLua, SetEyeAdaptionRate), + lunamethod(RenderPath3D_BindLua, SetEyeAdaptionKey), + lunamethod(RenderPath3D_BindLua, SetContrast), + lunamethod(RenderPath3D_BindLua, SetSaturation), + lunamethod(RenderPath3D_BindLua, SetBrightness), + lunamethod(RenderPath3D_BindLua, SetLightShaftsFadeSpeed), + lunamethod(RenderPath3D_BindLua, SetMeshBlendEnabled), + lunamethod(RenderPath3D_BindLua, SetOcclusionCullingEnabled), + lunamethod(RenderPath3D_BindLua, SetSSGIDepthRejection), lunamethod(RenderPath2D_BindLua, CopyFrom), { NULL, NULL } @@ -747,7 +756,7 @@ namespace wi::lua { if (component == nullptr) { - wi::lua::SError(L, "SetExposure(float value) component is null!"); + wi::lua::SError(L, "SetChromaticAberrationAmount(float value) component is null!"); return 0; } if (wi::lua::SGetArgCount(L) > 0) @@ -759,6 +768,150 @@ namespace wi::lua return 0; } + int RenderPath3D_BindLua::SetEyeAdaptionRate(lua_State* L) + { + if (component == nullptr) + { + wi::lua::SError(L, "SetEyeAdaptionRate(float value) component is null!"); + return 0; + } + if (wi::lua::SGetArgCount(L) > 0) + { + ((RenderPath3D*)component)->setEyeAdaptionRate(wi::lua::SGetFloat(L, 1)); + } + else + wi::lua::SError(L, "SetEyeAdaptionRate(float value) not enough arguments!"); + return 0; + } + + int RenderPath3D_BindLua::SetEyeAdaptionKey(lua_State* L) + { + if (component == nullptr) + { + wi::lua::SError(L, "SetEyeAdaptionKey(float value) component is null!"); + return 0; + } + if (wi::lua::SGetArgCount(L) > 0) + { + ((RenderPath3D*)component)->setEyeAdaptionKey(wi::lua::SGetFloat(L, 1)); + } + else + wi::lua::SError(L, "SetEyeAdaptionKey(float value) not enough arguments!"); + return 0; + } + + int RenderPath3D_BindLua::SetContrast(lua_State* L) + { + if (component == nullptr) + { + wi::lua::SError(L, "SetContrast(float value) component is null!"); + return 0; + } + if (wi::lua::SGetArgCount(L) > 0) + { + ((RenderPath3D*)component)->setContrast(wi::lua::SGetFloat(L, 1)); + } + else + wi::lua::SError(L, "SetContrast(float value) not enough arguments!"); + return 0; + } + + int RenderPath3D_BindLua::SetSaturation(lua_State* L) + { + if (component == nullptr) + { + wi::lua::SError(L, "SetSaturation(float value) component is null!"); + return 0; + } + if (wi::lua::SGetArgCount(L) > 0) + { + ((RenderPath3D*)component)->setSaturation(wi::lua::SGetFloat(L, 1)); + } + else + wi::lua::SError(L, "SetSaturation(float value) not enough arguments!"); + return 0; + } + + int RenderPath3D_BindLua::SetBrightness(lua_State* L) + { + if (component == nullptr) + { + wi::lua::SError(L, "SetBrightness(float value) component is null!"); + return 0; + } + if (wi::lua::SGetArgCount(L) > 0) + { + ((RenderPath3D*)component)->setBrightness(wi::lua::SGetFloat(L, 1)); + } + else + wi::lua::SError(L, "SetBrightness(float value) not enough arguments!"); + return 0; + } + + int RenderPath3D_BindLua::SetLightShaftsFadeSpeed(lua_State* L) + { + if (component == nullptr) + { + wi::lua::SError(L, "SetLightShaftsFadeSpeed(float value) component is null!"); + return 0; + } + if (wi::lua::SGetArgCount(L) > 0) + { + ((RenderPath3D*)component)->setLightShaftsFadeSpeed(wi::lua::SGetFloat(L, 1)); + } + else + wi::lua::SError(L, "SetLightShaftsFadeSpeed(float value) not enough arguments!"); + return 0; + } + + int RenderPath3D_BindLua::SetMeshBlendEnabled(lua_State* L) + { + if (component == nullptr) + { + wi::lua::SError(L, "SetMeshBlendEnabled(bool value) component is null!"); + return 0; + } + if (wi::lua::SGetArgCount(L) > 0) + { + ((RenderPath3D*)component)->setMeshBlendEnabled(wi::lua::SGetBool(L, 1)); + } + else + wi::lua::SError(L, "SetMeshBlendEnabled(bool value) not enough arguments!"); + return 0; + } + + int RenderPath3D_BindLua::SetOcclusionCullingEnabled(lua_State* L) + { + if (component == nullptr) + { + wi::lua::SError(L, "SetOcclusionCullingEnabled(bool value) component is null!"); + return 0; + } + if (wi::lua::SGetArgCount(L) > 0) + { + ((RenderPath3D*)component)->setOcclusionCullingEnabled(wi::lua::SGetBool(L, 1)); + } + else + wi::lua::SError(L, "SetOcclusionCullingEnabled(bool value) not enough arguments!"); + return 0; + } + + int RenderPath3D_BindLua::SetSSGIDepthRejection(lua_State* L) + { + if (component == nullptr) + { + wi::lua::SError(L, "SetSSGIDepthRejection(float value) component is null!"); + return 0; + } + if (wi::lua::SGetArgCount(L) > 0) + { + ((RenderPath3D*)component)->setSSGIDepthRejection(wi::lua::SGetFloat(L, 1)); + } + else + wi::lua::SError(L, "SetSSGIDepthRejection(float value) not enough arguments!"); + return 0; + } + static const std::string value_bindings = R"( AO_DISABLED = 0 AO_SSAO = 1 diff --git a/WickedEngine/wiRenderPath3D_BindLua.h b/WickedEngine/wiRenderPath3D_BindLua.h index 80bdb9960..f0536bb08 100644 --- a/WickedEngine/wiRenderPath3D_BindLua.h +++ b/WickedEngine/wiRenderPath3D_BindLua.h @@ -82,6 +82,15 @@ namespace wi::lua int SetChromaticAberrationEnabled(lua_State* L); int SetChromaticAberrationAmount(lua_State* L); + int SetEyeAdaptionRate(lua_State* L); + int SetEyeAdaptionKey(lua_State* L); + int SetContrast(lua_State* L); + int SetSaturation(lua_State* L); + int SetBrightness(lua_State* L); + int SetLightShaftsFadeSpeed(lua_State* L); + int SetMeshBlendEnabled(lua_State* L); + int SetOcclusionCullingEnabled(lua_State* L); + int SetSSGIDepthRejection(lua_State* L); static void Bind(); };