expose more uniforms to postprocessing

7220-lua-add-a-general-purpose-lexical-parser
glassmancody.info 2 years ago
parent 762eda74f7
commit 564c408663

@ -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);
}

@ -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()

@ -34,6 +34,10 @@ namespace fx
void setFogColor(const osg::Vec4f& color) { mData.get<FogColor>() = color; }
void setAmbientColor(const osg::Vec4f& color) { mData.get<AmbientColor>() = color; }
void setSkyColor(const osg::Vec4f& color) { mData.get<SkyColor>() = color; }
void setSunColor(const osg::Vec4f& color) { mData.get<SunColor>() = 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<ProjectionMatrix, InvProjectionMatrix, ViewMatrix, PrevViewMatrix,
InvViewMatrix, EyePos, EyeVec, FogColor, SunColor, SunPos, Resolution, RcpResolution, FogNear, FogFar, Near,
Far, Fov, GameHour, SunVis, WaterHeight, IsWaterEnabled, SimulationTime, DeltaSimulationTime, WindSpeed,
WeatherTransition, WeatherID, NextWeatherID, IsUnderwater, IsInterior>;
using UniformData
= std140::UBO<ProjectionMatrix, InvProjectionMatrix, ViewMatrix, PrevViewMatrix, InvViewMatrix, EyePos,
EyeVec, FogColor, AmbientColor, SkyColor, SunColor, SunPos, Resolution, RcpResolution, FogNear, FogFar,
Near, Far, Fov, GameHour, SunVis, WaterHeight, IsWaterEnabled, SimulationTime, DeltaSimulationTime,
WindSpeed, WeatherTransition, WeatherID, NextWeatherID, IsUnderwater, IsInterior>;
UniformData mData;
bool mUseUBO;

@ -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`` |
+-------------------+---------------------------------------------------------+

Loading…
Cancel
Save