diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index b9c2c04571..ad55dd5c04 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -961,6 +961,7 @@ namespace MWRender stateUpdater->setNextWeatherId(world->getNextWeather()); stateUpdater->setWeatherTransition(world->getWeatherTransition()); stateUpdater->setWindSpeed(world->getWindSpeed()); + stateUpdater->setSkyColor(mSky->getSkyColor()); mPostProcessor->setUnderwaterFlag(isUnderwater); } @@ -1368,6 +1369,7 @@ namespace MWRender if (mNightEyeFactor > 0.f) color += osg::Vec4f(0.7, 0.7, 0.7, 0.0) * mNightEyeFactor; + mPostProcessor->getStateUpdater()->setAmbientColor(color); mStateUpdater->setAmbientColor(color); } diff --git a/apps/openmw/mwrender/sky.hpp b/apps/openmw/mwrender/sky.hpp index 140bd9365f..75c6a10a50 100644 --- a/apps/openmw/mwrender/sky.hpp +++ b/apps/openmw/mwrender/sky.hpp @@ -106,6 +106,8 @@ namespace MWRender SceneUtil::RTTNode* getSkyRTT() { return mSkyRTT.get(); } + osg::Vec4f getSkyColor() const { return mSkyColour; } + private: void create(); ///< no need to call this, automatically done on first enable() diff --git a/components/fx/stateupdater.hpp b/components/fx/stateupdater.hpp index 529d11cc18..0fb02da093 100644 --- a/components/fx/stateupdater.hpp +++ b/components/fx/stateupdater.hpp @@ -34,6 +34,10 @@ namespace fx void setFogColor(const osg::Vec4f& color) { mData.get() = color; } + void setAmbientColor(const osg::Vec4f& color) { mData.get() = color; } + + void setSkyColor(const osg::Vec4f& color) { mData.get() = color; } + void setSunColor(const osg::Vec4f& color) { mData.get() = color; } void setSunPos(const osg::Vec4f& pos, bool night) @@ -139,6 +143,16 @@ namespace fx static constexpr std::string_view sName = "eyeVec"; }; + struct AmbientColor : std140::Vec4 + { + static constexpr std::string_view sName = "ambientColor"; + }; + + struct SkyColor : std140::Vec4 + { + static constexpr std::string_view sName = "skyColor"; + }; + struct FogColor : std140::Vec4 { static constexpr std::string_view sName = "fogColor"; @@ -249,10 +263,11 @@ namespace fx static constexpr std::string_view sName = "isInterior"; }; - using UniformData = std140::UBO; + using UniformData + = std140::UBO; UniformData mData; bool mUseUBO; diff --git a/docs/source/reference/postprocessing/omwfx.rst b/docs/source/reference/postprocessing/omwfx.rst index 7316c794c3..9aebf3d97c 100644 --- a/docs/source/reference/postprocessing/omwfx.rst +++ b/docs/source/reference/postprocessing/omwfx.rst @@ -67,6 +67,10 @@ Builtin Uniforms +-------------+------------------------------+--------------------------------------------------+ | vec4 | ``omw.fogColor`` | The RGBA color of fog | +-------------+------------------------------+--------------------------------------------------+ +| vec4 | ``omw.ambientColor`` | The RGBA color of scene ambient | ++-------------+------------------------------+--------------------------------------------------+ +| vec4 | ``omw.skyColor`` | The RGBA color of sky | ++-------------+------------------------------+--------------------------------------------------+ | vec4 | ``omw.sunColor`` | The RGBA color of sun | +-------------+------------------------------+--------------------------------------------------+ | vec4 | ``omw.sunPos`` | The normalized sun direction | @@ -210,7 +214,7 @@ GLSL equivalent. Refer to the table below to view these mappings. +===================+=========================================================+ | omw_In | use in place of ``in`` and ``varying`` | +-------------------+---------------------------------------------------------+ -| omw_Out | use in place of ``out`` and ```varying`` | +| omw_Out | use in place of ``out`` and ``varying`` | +-------------------+---------------------------------------------------------+ | omw_Position | use in place of ``gl_Position`` | +-------------------+---------------------------------------------------------+