Base GPU Cloud Generator

class BaseGpuCloudGenerator

Base class for generating cloud volumes on the GPU.

Public Functions

BaseGpuCloudGenerator()
virtual ~BaseGpuCloudGenerator()
inline void SetLightingMethod(LightingMethod h)
inline void SetIntegerPseudorandomNoise(bool b)
META_BeginProperties META_Property (bool, Enabled,"Whether this GPU cloud generator should be used to calculate the clouds.") META_EndProperties void ResetChecksums()
void SetCloudPlacementTexture(int id, crossplatform::Texture *t, vec2 pos_km, vec2 ext_km)
virtual void SetTextureCycle(int c)
virtual void RestoreDeviceObjects(crossplatform::RenderPlatform*)
virtual void InvalidateDeviceObjects()
virtual void RecompileShaders()
inline virtual bool CanPerformGPULighting() const

Return true if the derived class can relight clouds using the GPU.

void Update(crossplatform::DeviceContext &deviceContext, int cycled_index, const clouds::GpuCloudsParameters &params, crossplatform::Texture *finalTexture[3], FillState fillStates[3], CloudClass cloudClass)
virtual int GetDensityGridsize(const int *grid)

Get the size, in floats, needed to allocate a texture of the size specified in grid[3]. This depends on what float renderbuffer formats are supported.

virtual crossplatform::Texture *Make3DNoiseTexture(crossplatform::DeviceContext &deviceContext, int noise_size, const float *noise_src_ptr, int generation_number)

Create an API-specific noise texture, and return its pointer/identifier etc. as a void pointer.

virtual void FillDensityGrid(crossplatform::DeviceContext &deviceContext, int index, const GpuCloudsParameters &params, int start_texel, int texels, crossplatform::Texture *finalTexture, CloudClass cloudClass)

Fill a 3D grid with floating point cloud densities, and return an API-specific identifier to the texture that it’s stored in. We pass the start texel and the number of texels to fill, which should both be a whole multiple of grid[0]

void RenderSimulationTextures(crossplatform::GraphicsDeviceContext &context, int x0, int y0, int width, int height)

For onscreen debug.

inline virtual float GetOpticalPathLength(int, const float*, const float*, const float*)
inline void SetWorleyTexture(crossplatform::Texture *t)
struct GpuCloudsParameters

Public Members

int3 density_grid
int3 light_grid
float humidity
float baseLayer
float transition
float upperDensity
float diffusivity
float time
int octaves
float persistence
int noiseSize
mat4 Matrix4x4LightToDensityTexcoords
mat4 Matrix4x4AmbientToDensityTexcoords
mat4 Matrix4x4DensityToLightTransform
vec3 cornerM
vec3 densityVolumeScalesM
vec4 lightspace_extinctions
bool wrap_light_tex[2]
const simul::clouds::VolumeMap *cloudVolumes
const float *noise_src_ptr
int noise_generation_number
float texture_fill_progress
bool wrap_horizontally
unsigned checksum
vec3 directionToLight
float seaLevelTemperatureK
float numWorleyOctaves
float worleyNoiseStrength
float worleyNoiseScale
int mips