c

class BaseWeatherRenderer

Include: Clouds/Skylight.h

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

The derived classes of BaseWeatherRenderer create and maintain 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.

Functions

  BaseWeatherRenderer(simul::clouds::Environment env, simul::base::MemoryInterface m)
void CleanUpFramebuffers(int max_age)
void ConnectInterfaces()
simul::clouds::BaseWeatherRenderer * Create(simul::clouds::Environment env, simul::base::MemoryInterface m)
void CreateSubObjects()
void Destroy(simul::clouds::BaseWeatherRenderer baseWeatherRenderer)
simul::sky::float4 const & GetAmbientLightColour(float view_altitude_km)
simul::sky::BaseAtmosphericsRenderer * GetBaseAtmosphericsRenderer()
simul::clouds::CloudRenderer * GetBaseCloudRenderer()
simul::sky::BaseSkyRenderer * GetBaseSkyRenderer()
int GetExportLightningStrikes(simul::clouds::ExportLightningStrike export_strikes, int max_s, float game_time, float real_time)
simul::sky::float4 const & GetHorizonColour(float view_altitude_km)
simul::sky::float4 const & GetLightColour(float view_altitude_km)
simul::clouds::BaseLightningRenderer * GetLightningRenderer()
simul::clouds::PrecipitationRenderer * GetPrecipitationRenderer()
simul::sky::SkyKeyframer * GetSkyKeyframer()
simul::clouds::TransparencyAtmospherics GetTransparencyAtmospherics(simul::crossplatform::ViewStruct viewStruct)
void InvalidateDeviceObjects()
simul::clouds::BaseWeatherRenderer const & operator=(simul::clouds::BaseWeatherRenderer W)
void PreRenderUpdate(simul::crossplatform::DeviceContext deviceContext, float real_time)
void RecompileShaders()
void RemoveView(int view_id)
void Render(simul::crossplatform::DeviceContext deviceContext, simul::crossplatform::ViewStruct viewStruct2, simul::clouds::TrueSkyRenderMode renderMode, float exposure, float gamma, simul::crossplatform::Texture mainDepthTexture, simul::crossplatform::Texture cubemapTexture, simul::crossplatform::Viewport depthViewport, simul::crossplatform::Viewport viewports, vec3 cubemap_ground_colour, int amortization)
void RenderCelestialBackground(simul::crossplatform::DeviceContext deviceContext, simul::crossplatform::ViewStruct viewStruct, simul::clouds::TrueSkyRenderMode renderMode, simul::crossplatform::Texture depthTexture, vec4 viewportTextureRegionXYWH, float exposure)
bool RenderMixedResolution(simul::crossplatform::DeviceContext deviceContext, simul::crossplatform::ViewStruct viewStruct2, simul::crossplatform::Texture depthTexture, simul::clouds::TrueSkyRenderMode renderMode, float exposure, float gamma, simul::crossplatform::Viewport depthViewports, simul::crossplatform::Texture ambientCubemapTexture)
void RestoreDeviceObjects(simul::crossplatform::RenderPlatform renderPlatform)
void SetAllDownscale(float)
void SetBlurTexture(simul::crossplatform::Texture t)
void SetCubemapTransform(float m)
bool RenderLowResolutionElements(simul::crossplatform::DeviceContext deviceContext, float exposure, float godrays_strength, simul::clouds::TrueSkyRenderMode renderMode, simul::crossplatform::NearFarPass nearFarPass, simul::crossplatform::Texture lowResDepthTexture, simul::sky::ScatteringVolume scatteringVolume, vec4 viewportRegionXYWH, simul::crossplatform::AmortizationStruct amortizationStruct, simul::crossplatform::Texture ambientCubemapTexture)

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

The derived classes of BaseWeatherRenderer create and maintain 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.

Functions

BaseWeatherRenderer(simul::clouds::Environment env, simul::base::MemoryInterface m)

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

void CleanUpFramebuffers(int max_age)

Delete framebuffers that have not been used in max_age frames, to free GPU memory.

void ConnectInterfaces()

Connect-up sky, clouds etc.

simul::clouds::BaseWeatherRenderer * Create(simul::clouds::Environment env, simul::base::MemoryInterface m)

Create a base weather renderer: if env is NULL, a new Environment will be created.

void CreateSubObjects()

Create the member sub-objects: CloudRenderer etc.

void Destroy(simul::clouds::BaseWeatherRenderer baseWeatherRenderer)

Destroy a base weather renderer.

simul::sky::float4 const & GetAmbientLightColour(float view_altitude_km)

Get the HDR ambient colour, as seen from the specified altitude view_altitude_km

simul::sky::BaseAtmosphericsRenderer * GetBaseAtmosphericsRenderer()

Get a pointer to the atmospheric renderer.

simul::clouds::CloudRenderer * GetBaseCloudRenderer()

Get a pointer to the cloud renderer.

simul::sky::BaseSkyRenderer * GetBaseSkyRenderer()

Get a pointer to the sky renderer.

int GetExportLightningStrikes(simul::clouds::ExportLightningStrike export_strikes, int max_s, float game_time, float real_time)

Get lightning strikes. This calls GetExportLightningStrikes in CloudKeyframer, but also includes a cloud density query so that lightning can’t come from empty sky.

simul::sky::float4 const & GetHorizonColour(float view_altitude_km)

Set a depth texture, whose alpha values represent the depth co-ordinate. This will be used when clouds are rendered in front of terrain etc. Get the representative HDR colour of the horizon, as seen from the specified altitude view_altitude_km.

simul::sky::float4 const & GetLightColour(float view_altitude_km)

Get the HDR light colour, as seen from the specified altitude view_altitude_km

simul::clouds::BaseLightningRenderer * GetLightningRenderer()

Get a pointer to the lightning renderer.

simul::clouds::PrecipitationRenderer * GetPrecipitationRenderer()

Get a pointer to the rain/snow renderer.

simul::sky::SkyKeyframer * GetSkyKeyframer()

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

simul::clouds::TransparencyAtmospherics GetTransparencyAtmospherics(simul::crossplatform::ViewStruct viewStruct)

This returns a struct containing the textures and values needed to apply atmospherics to transparent objects.

void InvalidateDeviceObjects()

De-initialize all API-dependent objects in the weather renderer and its member renderers.

simul::clouds::BaseWeatherRenderer const & operator=(simul::clouds::BaseWeatherRenderer W)

Copy the properties of one BaseWeatherRenderer to another, including copying the properties of their sky and cloud renderers.

void PreRenderUpdate(simul::crossplatform::DeviceContext deviceContext, float real_time)

Once per-frame update. Do this before any rendering each frame. For most platform implementations, you should set the matrices relevant to the mainview before calling this.

void RecompileShaders()

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

void RemoveView(int view_id)

Ensure that per-view objects are destroyed for the view in question: they will be rebuilt if needed later.

void Render(simul::crossplatform::DeviceContext deviceContext, simul::crossplatform::ViewStruct viewStruct2, simul::clouds::TrueSkyRenderMode renderMode, float exposure, float gamma, simul::crossplatform::Texture mainDepthTexture, simul::crossplatform::Texture cubemapTexture, simul::crossplatform::Viewport depthViewport, simul::crossplatform::Viewport viewports, vec3 cubemap_ground_colour, int amortization)

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

deviceContextis the platform-dependent render context, viewStruct2is the view structure for alternate eye in VR, exposureis a multiplier for the rendered sky brightness, The view_idis 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_cubemapis set, low-definition rendering is used. The mainDepthTextureis a single-sampled or MSAA depth texture. You can use a simul::crossplatform::Texture-derived class to wrapper your depth texture. The depthViewportdetermines what part of the depth texture represents this viewport - normally (0,0,1,1). Optional viewportsspecifies the left and right eye viewports if we’re rendering both at once in VR.

void RenderCelestialBackground(simul::crossplatform::DeviceContext deviceContext, simul::crossplatform::ViewStruct viewStruct, simul::clouds::TrueSkyRenderMode renderMode, simul::crossplatform::Texture depthTexture, vec4 viewportTextureRegionXYWH, float exposure)

Draw the sun, moon and stars - call this while the depth buffer is bound.

bool RenderMixedResolution(simul::crossplatform::DeviceContext deviceContext, simul::crossplatform::ViewStruct viewStruct2, simul::crossplatform::Texture depthTexture, simul::clouds::TrueSkyRenderMode renderMode, float exposure, float gamma, simul::crossplatform::Viewport depthViewports, simul::crossplatform::Texture ambientCubemapTexture)

deviceContextis the platform-dependent render context, exposureis a multiplier for the rendered sky brightness, The view_idis 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_cubemapis set, low-definition rendering is used. The mainDepthTextureis a single-sampled or MSAA depth texture. You can use a simul::crossplatform::Texture-derived class to wrapper your depth texture. The lowResDepthTextureis an API-dependent texture or texture resource pointer, with near far depth in the r and g, and b 0 or 1 for edges. The depthViewportXYWHdetermines what part of the depth texture represents this viewport - normally (0,0,1,1). Returns true if there is a lightpass.

void RestoreDeviceObjects(simul::crossplatform::RenderPlatform renderPlatform)

Initialize the API-dependent objects in the weather renderer and its member renderers. This is usually needed when the 3D view is first set-up.

void SetAllDownscale(float)

Override the downscale for all current views; does not affect the default - see SetDefaultDownscale.

void SetBlurTexture(simul::crossplatform::Texture t)

A blurred texture, to be drawn usually per-frame.

void SetCubemapTransform(float m)

A transform for the cubemap set by SetCubemapTexture().

bool RenderLowResolutionElements(simul::crossplatform::DeviceContext deviceContext, float exposure, float godrays_strength, simul::clouds::TrueSkyRenderMode renderMode, simul::crossplatform::NearFarPass nearFarPass, simul::crossplatform::Texture lowResDepthTexture, simul::sky::ScatteringVolume scatteringVolume, vec4 viewportRegionXYWH, simul::crossplatform::AmortizationStruct amortizationStruct, simul::crossplatform::Texture ambientCubemapTexture)

Renders the 2D clouds and atmospherics. If the passed depth texture is MSAA, near_pass determines whether to use the near or far depth for each depth texel.