Skip to content

raisin::CloudTextures ​

class · #include <rayrai/CloudTextures.hpp>

CloudTextures owns the GPU textures used by the cloud rendering pipeline:

  • baseTex: 3D RGBA8 Worley/Perlin noise (128^3) for the volumetric path
  • detailTex: 3D RGBA8 Worley noise (32^3) for the volumetric path
  • weatherTex: 2D RGBA8 weather map (256x256, coverage / height / cumulus shape)
  • flatCloudTex: 2D RGBA8 cloud texture (1024x512) for the texture-based path

Textures are generated on the CPU the first time ensureLoaded() is called. Generated bytes are cached to disk at cacheDir + "/cloud_textures_v1/*.raw" so subsequent runs load instantly. Pass an empty cacheDir to skip disk caching (always regenerate). All methods except the getters need a current GL context.

Constructors & destructor ​

CloudTextures ​

cpp
CloudTextures() = default
cpp
CloudTextures(const CloudTextures &) = delete

~CloudTextures ​

cpp
~CloudTextures()

Public member functions ​

operator= ​

cpp
CloudTextures &operator=(const CloudTextures &) = delete

ensureLoaded ​

cpp
bool ensureLoaded(const std::string &cacheDir, bool volumetricRequired=true)

Generate (or load from cache) and upload the textures required by the active cloud path. Fast/Balanced only need the flat 2D texture; High/Ultra volumetric clouds need the 3D noise/weather textures.

Parameters

ParameterDescription
cacheDirDisk cache root; empty disables caching.
volumetricRequiredTrue for the 3D/weather set, false for the flat texture.

Returns True if the requested set is uploaded.

ready ​

cpp
bool ready(bool volumetricRequired) const

True when the textures for the requested cloud path are already uploaded, so ensureLoaded() would return immediately. Lets callers skip resolving cacheDir.

Parameters

ParameterDescription
volumetricRequiredWhich texture set to check.

Returns True if that set is uploaded.

baseTex ​

cpp
unsigned int baseTex() const

Returns 3D base-noise texture, or 0.

detailTex ​

cpp
unsigned int detailTex() const

Returns 3D detail-noise texture, or 0.

weatherTex ​

cpp
unsigned int weatherTex() const

Returns 2D weather-map texture, or 0.

flatCloudTex ​

cpp
unsigned int flatCloudTex() const

Returns 2D flat-cloud texture, or 0.

loaded ​

cpp
bool loaded() const

Returns True once either texture set has been uploaded.

RaiSim — physics for robotics and AI.