Base Weather Renderer

class BaseWeatherRenderer

The main base class for all weather renderers, such as SimulGLWeatherRenderer, SimulWeatherRenderer (DX11) etc.

BaseWeatherRenderer creates and maintains the renderers for weather elements such as clouds, sky, rain and so on. So to use these sub-renderers it is usual to create an instance of one of the weather renderers, and allow this instance to manage the others.

Public Functions

BaseWeatherRenderer(Environment *env, simul::base::MemoryInterface *m = NULL)

Default constructor: if env is NULL, a new Environment will be created.

virtual void RestoreDeviceObjects(crossplatform::RenderPlatform *renderPlatform)

Platform-dependent function called when initializing the weather renderer.

virtual void InvalidateDeviceObjects()

Platform-dependent function called when uninitializing the weather renderer.

virtual void RecompileShaders()

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

virtual void Render(crossplatform::GraphicsDeviceContext &deviceContext, const crossplatform::ViewStruct &viewStruct2, TrueSkyRenderMode renderMode, float exposure, float gamma, crossplatform::Texture *mainDepthTexture, crossplatform::Texture *cubemapTexture, const crossplatform::Viewport *depthViewport, const crossplatform::Viewport *viewports = nullptr, vec3 cubemap_ground_colour = vec3(0, 0, 0), int amortization = 0)

Render the sky including atmospherics, into the current rendertarget, using a supplied depth texture.

deviceContext is the platform-dependent render context, viewStruct2 is the view structure for alternate eye in VR, exposure is a multiplier for the rendered sky brightness, The view_id is an integer that distinguishes between multiple simultaneous viewports onscreen. By convention, viewport 0 is the main view, and viewport 1 is the cubemap for reflections and lighting. If is_cubemap is set, low-definition rendering is used. The mainDepthTexture is a single-sampled or MSAA depth texture. You can use a simul::crossplatform::Texture-derived class to wrapper your depth texture. The depthViewport determines what part of the depth texture represents this viewport - normally (0,0,1,1). Optional viewports specifies the left and right eye viewports if we’re rendering both at once in VR.

simul::sky::BaseSkyRenderer *GetBaseSkyRenderer()

Get a pointer to the sky renderer.

simul::clouds::CloudRenderer *GetCloudRenderer()

Get a pointer to the cloud renderer.

simul::sky::SkyKeyframer *GetSkyKeyframer()

Convenience function to get the next sky keyframe that can be modified without any recalculation.