mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-27 03:35:27 +00:00
Merge branch 'more_uniforms' into 'master'
[Postprocessing] Add sky and ambient colors See merge request OpenMW/openmw!2638
This commit is contained in:
commit
1422053fa9
@ -961,6 +961,7 @@ namespace MWRender
|
|||||||
stateUpdater->setNextWeatherId(world->getNextWeather());
|
stateUpdater->setNextWeatherId(world->getNextWeather());
|
||||||
stateUpdater->setWeatherTransition(world->getWeatherTransition());
|
stateUpdater->setWeatherTransition(world->getWeatherTransition());
|
||||||
stateUpdater->setWindSpeed(world->getWindSpeed());
|
stateUpdater->setWindSpeed(world->getWindSpeed());
|
||||||
|
stateUpdater->setSkyColor(mSky->getSkyColor());
|
||||||
mPostProcessor->setUnderwaterFlag(isUnderwater);
|
mPostProcessor->setUnderwaterFlag(isUnderwater);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1368,6 +1369,7 @@ namespace MWRender
|
|||||||
if (mNightEyeFactor > 0.f)
|
if (mNightEyeFactor > 0.f)
|
||||||
color += osg::Vec4f(0.7, 0.7, 0.7, 0.0) * mNightEyeFactor;
|
color += osg::Vec4f(0.7, 0.7, 0.7, 0.0) * mNightEyeFactor;
|
||||||
|
|
||||||
|
mPostProcessor->getStateUpdater()->setAmbientColor(color);
|
||||||
mStateUpdater->setAmbientColor(color);
|
mStateUpdater->setAmbientColor(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,6 +106,8 @@ namespace MWRender
|
|||||||
|
|
||||||
SceneUtil::RTTNode* getSkyRTT() { return mSkyRTT.get(); }
|
SceneUtil::RTTNode* getSkyRTT() { return mSkyRTT.get(); }
|
||||||
|
|
||||||
|
osg::Vec4f getSkyColor() const { return mSkyColour; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void create();
|
void create();
|
||||||
///< no need to call this, automatically done on first enable()
|
///< 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 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 setSunColor(const osg::Vec4f& color) { mData.get<SunColor>() = color; }
|
||||||
|
|
||||||
void setSunPos(const osg::Vec4f& pos, bool night)
|
void setSunPos(const osg::Vec4f& pos, bool night)
|
||||||
@ -139,6 +143,16 @@ namespace fx
|
|||||||
static constexpr std::string_view sName = "eyeVec";
|
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
|
struct FogColor : std140::Vec4
|
||||||
{
|
{
|
||||||
static constexpr std::string_view sName = "fogColor";
|
static constexpr std::string_view sName = "fogColor";
|
||||||
@ -249,10 +263,11 @@ namespace fx
|
|||||||
static constexpr std::string_view sName = "isInterior";
|
static constexpr std::string_view sName = "isInterior";
|
||||||
};
|
};
|
||||||
|
|
||||||
using UniformData = std140::UBO<ProjectionMatrix, InvProjectionMatrix, ViewMatrix, PrevViewMatrix,
|
using UniformData
|
||||||
InvViewMatrix, EyePos, EyeVec, FogColor, SunColor, SunPos, Resolution, RcpResolution, FogNear, FogFar, Near,
|
= std140::UBO<ProjectionMatrix, InvProjectionMatrix, ViewMatrix, PrevViewMatrix, InvViewMatrix, EyePos,
|
||||||
Far, Fov, GameHour, SunVis, WaterHeight, IsWaterEnabled, SimulationTime, DeltaSimulationTime, WindSpeed,
|
EyeVec, FogColor, AmbientColor, SkyColor, SunColor, SunPos, Resolution, RcpResolution, FogNear, FogFar,
|
||||||
WeatherTransition, WeatherID, NextWeatherID, IsUnderwater, IsInterior>;
|
Near, Far, Fov, GameHour, SunVis, WaterHeight, IsWaterEnabled, SimulationTime, DeltaSimulationTime,
|
||||||
|
WindSpeed, WeatherTransition, WeatherID, NextWeatherID, IsUnderwater, IsInterior>;
|
||||||
|
|
||||||
UniformData mData;
|
UniformData mData;
|
||||||
bool mUseUBO;
|
bool mUseUBO;
|
||||||
|
@ -67,6 +67,10 @@ Builtin Uniforms
|
|||||||
+-------------+------------------------------+--------------------------------------------------+
|
+-------------+------------------------------+--------------------------------------------------+
|
||||||
| vec4 | ``omw.fogColor`` | The RGBA color of fog |
|
| 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.sunColor`` | The RGBA color of sun |
|
||||||
+-------------+------------------------------+--------------------------------------------------+
|
+-------------+------------------------------+--------------------------------------------------+
|
||||||
| vec4 | ``omw.sunPos`` | The normalized sun direction |
|
| 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_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`` |
|
| omw_Position | use in place of ``gl_Position`` |
|
||||||
+-------------------+---------------------------------------------------------+
|
+-------------------+---------------------------------------------------------+
|
||||||
|
Loading…
x
Reference in New Issue
Block a user