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
CloudTextures() = defaultCloudTextures(const CloudTextures &) = delete~CloudTextures
~CloudTextures()Public member functions
operator=
CloudTextures &operator=(const CloudTextures &) = deleteensureLoaded
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
| Parameter | Description |
|---|---|
cacheDir | Disk cache root; empty disables caching. |
volumetricRequired | True for the 3D/weather set, false for the flat texture. |
Returns True if the requested set is uploaded.
ready
bool ready(bool volumetricRequired) constTrue when the textures for the requested cloud path are already uploaded, so ensureLoaded() would return immediately. Lets callers skip resolving cacheDir.
Parameters
| Parameter | Description |
|---|---|
volumetricRequired | Which texture set to check. |
Returns True if that set is uploaded.
baseTex
unsigned int baseTex() constReturns 3D base-noise texture, or 0.
detailTex
unsigned int detailTex() constReturns 3D detail-noise texture, or 0.
weatherTex
unsigned int weatherTex() constReturns 2D weather-map texture, or 0.
flatCloudTex
unsigned int flatCloudTex() constReturns 2D flat-cloud texture, or 0.
loaded
bool loaded() constReturns True once either texture set has been uploaded.