Merge branch 'add_frame_number' into 'master'

Add frame number to available postprocess uniforms

See merge request OpenMW/openmw!4355
pull/3236/head
AnyOldName3 4 months ago
commit 0f74e0cca8

@ -83,7 +83,7 @@ set(OPENMW_VERSION_MAJOR 0)
set(OPENMW_VERSION_MINOR 49) set(OPENMW_VERSION_MINOR 49)
set(OPENMW_VERSION_RELEASE 0) set(OPENMW_VERSION_RELEASE 0)
set(OPENMW_LUA_API_REVISION 68) set(OPENMW_LUA_API_REVISION 68)
set(OPENMW_POSTPROCESSING_API_REVISION 1) set(OPENMW_POSTPROCESSING_API_REVISION 2)
set(OPENMW_VERSION_COMMITHASH "") set(OPENMW_VERSION_COMMITHASH "")
set(OPENMW_VERSION_TAGHASH "") set(OPENMW_VERSION_TAGHASH "")

@ -323,6 +323,8 @@ namespace MWRender
mStateUpdater->setSimulationTime(static_cast<float>(stamp->getSimulationTime())); mStateUpdater->setSimulationTime(static_cast<float>(stamp->getSimulationTime()));
mStateUpdater->setDeltaSimulationTime(static_cast<float>(stamp->getSimulationTime() - mLastSimulationTime)); mStateUpdater->setDeltaSimulationTime(static_cast<float>(stamp->getSimulationTime() - mLastSimulationTime));
// Use a signed int because 'uint' type is not supported in GLSL 120 without extensions
mStateUpdater->setFrameNumber(static_cast<int>(stamp->getFrameNumber()));
mLastSimulationTime = stamp->getSimulationTime(); mLastSimulationTime = stamp->getSimulationTime();
for (const auto& dispatchNode : mCanvases[frameId]->getPasses()) for (const auto& dispatchNode : mCanvases[frameId]->getPasses())

@ -89,6 +89,8 @@ namespace fx
void setDeltaSimulationTime(float time) { mData.get<DeltaSimulationTime>() = time; } void setDeltaSimulationTime(float time) { mData.get<DeltaSimulationTime>() = time; }
void setFrameNumber(int frame) { mData.get<FrameNumber>() = frame; }
void setWindSpeed(float speed) { mData.get<WindSpeed>() = speed; } void setWindSpeed(float speed) { mData.get<WindSpeed>() = speed; }
void setWeatherTransition(float transition) void setWeatherTransition(float transition)
@ -233,6 +235,11 @@ namespace fx
static constexpr std::string_view sName = "deltaSimulationTime"; static constexpr std::string_view sName = "deltaSimulationTime";
}; };
struct FrameNumber : std140::Int
{
static constexpr std::string_view sName = "frameNumber";
};
struct WindSpeed : std140::Float struct WindSpeed : std140::Float
{ {
static constexpr std::string_view sName = "windSpeed"; static constexpr std::string_view sName = "windSpeed";
@ -267,7 +274,7 @@ namespace fx
= std140::UBO<ProjectionMatrix, InvProjectionMatrix, ViewMatrix, PrevViewMatrix, InvViewMatrix, EyePos, = std140::UBO<ProjectionMatrix, InvProjectionMatrix, ViewMatrix, PrevViewMatrix, InvViewMatrix, EyePos,
EyeVec, FogColor, AmbientColor, SkyColor, SunColor, SunPos, Resolution, RcpResolution, FogNear, FogFar, EyeVec, FogColor, AmbientColor, SkyColor, SunColor, SunPos, Resolution, RcpResolution, FogNear, FogFar,
Near, Far, Fov, GameHour, SunVis, WaterHeight, IsWaterEnabled, SimulationTime, DeltaSimulationTime, Near, Far, Fov, GameHour, SunVis, WaterHeight, IsWaterEnabled, SimulationTime, DeltaSimulationTime,
WindSpeed, WeatherTransition, WeatherID, NextWeatherID, IsUnderwater, IsInterior>; FrameNumber, WindSpeed, WeatherTransition, WeatherID, NextWeatherID, IsUnderwater, IsInterior>;
UniformData mData; UniformData mData;
bool mUseUBO; bool mUseUBO;

@ -107,6 +107,8 @@ Builtin Uniforms
+-------------+------------------------------+--------------------------------------------------+ +-------------+------------------------------+--------------------------------------------------+
| float | ``omw.deltaSimulationTime`` | The change in `omw.simulationTime` | | float | ``omw.deltaSimulationTime`` | The change in `omw.simulationTime` |
+-------------+------------------------------+--------------------------------------------------+ +-------------+------------------------------+--------------------------------------------------+
| int | ``omw.frameNumber`` | The current frame number |
+-------------+------------------------------+--------------------------------------------------+
| float | ``omw.windSpeed`` | The current wind speed | | float | ``omw.windSpeed`` | The current wind speed |
+-------------+------------------------------+--------------------------------------------------+ +-------------+------------------------------+--------------------------------------------------+
| float | ``omw.weatherTransition`` | The transition factor between weathers [0, 1] | | float | ``omw.weatherTransition`` | The transition factor between weathers [0, 1] |

Loading…
Cancel
Save