Precipitation Renderer

class PrecipitationRenderer

The class that renders rain and snow.

Public Functions



virtual ~PrecipitationRenderer()


virtual void RestoreDeviceObjects(platform::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(platform::crossplatform::GraphicsDeviceContext &deviceContext, platform::crossplatform::Texture *depth_tex, platform::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 RenderOverlay(platform::crossplatform::GraphicsDeviceContext &deviceContext, int x0, int y0, int dx, int dy)

Show the textures onscreen for debugging.

void RecompileShaders()

Recompile the shaders - for debug purposes.

void SetRandomTexture3D(platform::crossplatform::Texture *texture)

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

void SetRainDepthTextureScale(float s)

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

virtual void PreRenderUpdate(platform::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()