Precipitation Renderer

class PrecipitationRenderer

The class that renders rain and snow.

Public Functions

PrecipitationRenderer()

Constructor.

virtual ~PrecipitationRenderer()

Destructor.

virtual void RestoreDeviceObjects(crossplatform::RenderPlatform *renderPlatform)

Platform-dependent function called when initializing the precipitation renderer.

virtual void InvalidateDeviceObjects()

Platform-dependent function called when uninitializing the precipitation renderer.

virtual void Render(crossplatform::GraphicsDeviceContext &deviceContext, crossplatform::Texture *depth_tex, crossplatform::Texture *cubemapTexture, float max_fade_distance_metres, vec4 viewportTextureRegionXYWH, vec3 sunlight, vec3 moonlight, RainMethod rainMethod, float time, bool write_blend_alpha)

Call this to draw precipitation.

void SetCloudShadowData(const sky::CloudShadowData &cloudShadowData)
void RenderOverlay(crossplatform::GraphicsDeviceContext &deviceContext, int x0, int y0, int dx, int dy)

Show the textures onscreen for debugging.

virtual void RecompileShaders()

Platform-dependent function to reload the shaders - only use this for debug purposes.

void SetCubemapTransform(const float *m)
void SetBlurTexture(crossplatform::Texture*)
void SetRandomTexture3D(crossplatform::Texture *texture)

Provide a random 3D texture. This is set externally so the texture can be shared.

void SetRainDepthTexture(crossplatform::Texture *texture)
void SetRainDepthTransform(const float *m)
void SetRainDepthProjection(const float *p)
void SetRainDepthTextureScale(float s)

Set the scale of the rain depth texture to normalize it to [0,1].

META_BeginProperties META_RangeProperty (float, RainFallSpeedMS, 6.f, 0.f, 100.f,"Speed of falling rain.") META_RangeProperty(float
META_BeginProperties Speed of falling snow META_RangeProperty (float, RainWindEffect, 0.1f, 0.f, 1.f,"Strength of the effect of wind on precipitation direction.") META_RangeProperty(float
META_BeginProperties Speed of falling snow Time scale of wavering in seconds META_RangePropertyWithSetCall (float, Aspect, 0.01f, 1000.f, TextureRepeatChanged,"How much precipitation texture is stretched vertically.") META_PropertyWithSetCall(int
META_BeginProperties Speed of falling snow Time scale of wavering in seconds How many times the texture is repeated around degrees META_RangeProperty (float, Waver, 0.f, 0.f, 10.f,"How much precipitation layers waver as they fall.") META_Property(bool
META_BeginProperties Speed of falling snow Time scale of wavering in seconds How many times the texture is repeated around degrees Whether the projection matrix reverses the z so is near and is far META_RangeProperty (float, Intensity, 0.f, 0.f, 1.f,"How much rain/snow.") META_Property(int
META_BeginProperties Speed of falling snow Time scale of wavering in seconds How many times the texture is repeated around degrees Whether the projection matrix reverses the z so is near and is far The maximum number of particles to render META_RangeProperty (float, RainToSnow, 0.f, 0.f, 1.f,"What proportion of snow relative to rain, from 0 to 1.") META_Property(float
META_BeginProperties Speed of falling snow Time scale of wavering in seconds How many times the texture is repeated around degrees Whether the projection matrix reverses the z so is near and is far The maximum number of particles to render Size of the particle zone META_Property (float, RainDropSizeMm,"Size of a single raindrop.") META_Property(float
META_BeginProperties Speed of falling snow Time scale of wavering in seconds How many times the texture is repeated around degrees Whether the projection matrix reverses the z so is near and is far The maximum number of particles to render Size of the particle zone Size of a single snowflake META_Property (float, MinDistanceMetres,"Minimum distance: particles nearer will not be shown.") META_Property(PrecipitationOptions
inline META_BeginProperties Speed of falling snow Time scale of wavering in seconds How many times the texture is repeated around degrees Whether the projection matrix reverses the z so is near and is far The maximum number of particles to render Size of the particle zone Size of a single snowflake Rendering option flags META_EndProperties bool GetUseSimulationTime () const
virtual void PreRenderUpdate(crossplatform::GraphicsDeviceContext &deviceContext, float dt_seconds)

Once per-frame update. Do this before any rendering each frame.

inline void SetWind(float speed, float heading_degrees)

Set the wind velocity.

inline void SetWind(const vec3 &wind_direction)

Set the wind velocity.

void SetBaseSkyInterface(simul::sky::BaseSkyInterface *s)

Set the sky and atmospherics interface.

void New()

Clear the data()

Public Members

META_BeginProperties SnowFallSpeedMS
META_BeginProperties f
META_BeginProperties Speed of falling snow WaverTimescaleS
META_BeginProperties Speed of falling snow f
META_BeginProperties Speed of falling snow Time scale of wavering in seconds RainTextureRepeat
META_BeginProperties Speed of falling snow Time scale of wavering in seconds TextureRepeatChanged
META_BeginProperties Speed of falling snow Time scale of wavering in seconds How many times the texture is repeated around degrees ReverseDepth
META_BeginProperties Speed of falling snow Time scale of wavering in seconds How many times the texture is repeated around degrees Whether the projection matrix reverses the z order
META_BeginProperties Speed of falling snow Time scale of wavering in seconds How many times the texture is repeated around degrees Whether the projection matrix reverses the z so is near and is far MaxParticles
META_BeginProperties Speed of falling snow Time scale of wavering in seconds How many times the texture is repeated around degrees Whether the projection matrix reverses the z so is near and is far The maximum number of particles to render RadiusMetres
META_BeginProperties Speed of falling snow Time scale of wavering in seconds How many times the texture is repeated around degrees Whether the projection matrix reverses the z so is near and is far The maximum number of particles to render Size of the particle zone SnowFlakeSizeMm
META_BeginProperties Speed of falling snow Time scale of wavering in seconds How many times the texture is repeated around degrees Whether the projection matrix reverses the z so is near and is far The maximum number of particles to render Size of the particle zone Size of a single snowflake Options

Public Static Functions

static void EnsureEffectsAreBuilt(crossplatform::RenderPlatform *r)