Precipitation Renderer

class simul::clouds::PrecipitationRenderer

The class that renders rain and snow.

Public Functions



virtual ~PrecipitationRenderer()


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 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 SetRandomTexture3D(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(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()