1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-04 02:41:19 +00:00

Add a way to check if water is enabled in post processing shaders

This commit is contained in:
Andrei Kortunov 2022-07-31 10:33:18 +04:00
parent a62b16df5d
commit 5bfca57835
3 changed files with 9 additions and 0 deletions

View File

@ -1005,6 +1005,8 @@ namespace MWRender
{
mWater->setEnabled(enabled);
mSky->setWaterEnabled(enabled);
mPostProcessor->getStateUpdater()->setIsWaterEnabled(enabled);
}
void RenderingManager::setWaterHeight(float height)

View File

@ -81,6 +81,8 @@ namespace fx
void setWaterHeight(float height) { mData.get<WaterHeight>() = height; }
void setIsWaterEnabled(bool enabled) { mData.get<IsWaterEnabled>() = enabled; }
void setSimulationTime(float time) { mData.get<SimulationTime>() = time; }
void setDeltaSimulationTime(float time) { mData.get<DeltaSimulationTime>() = time; }
@ -145,6 +147,8 @@ namespace fx
struct WaterHeight : std140::Float { static constexpr std::string_view sName = "waterHeight"; };
struct IsWaterEnabled : std140::Bool { static constexpr std::string_view sName = "isWaterEnabled"; };
struct SimulationTime : std140::Float { static constexpr std::string_view sName = "simulationTime"; };
struct DeltaSimulationTime : std140::Float { static constexpr std::string_view sName = "deltaSimulationTime"; };
@ -182,6 +186,7 @@ namespace fx
GameHour,
SunVis,
WaterHeight,
IsWaterEnabled,
SimulationTime,
DeltaSimulationTime,
WindSpeed,

View File

@ -97,6 +97,8 @@ Builtin Uniforms
| | | |
| | | Exterior water level is always zero |
+-------------+------------------------------+--------------------------------------------------+
| bool | ``omw.isWaterEnabled`` | True if water is enabled for current cell |
+-------------+------------------------------+--------------------------------------------------+
| float | ``omw.simulationTime`` | The time in milliseconds since simulation began |
+-------------+------------------------------+--------------------------------------------------+
| float | ``omw.deltaSimulationTime`` | The change in `omw.simulationTime` |