raisin::SkyAtmosphereSystem
class · #include <rayrai/SkyAtmosphereSystem.hpp>
Owner of the Hillaire sky-atmosphere LUT pipeline (transmittance, multi-scattering, sky-view, aerial-perspective volume).
Extracted from RayraiWindow as part of the 1.1 decomposition. Holds the GL handles for the four LUT textures and their FBOs; renders them on demand. Static LUTs (transmittance + multi-scattering) only re-render when markStaticLutsDirty() has been called or first allocation.
GL ownership: the destructor releases all owned GL handles via release(). Copy disabled per Rule of 5; this class manages raw GL resources that would be double-freed under shallow copy.
Constructors & destructor
SkyAtmosphereSystem
SkyAtmosphereSystem() = defaultSkyAtmosphereSystem(const SkyAtmosphereSystem &) = deleteSkyAtmosphereSystem(SkyAtmosphereSystem &&) = delete~SkyAtmosphereSystem
~SkyAtmosphereSystem()Public member functions
operator=
SkyAtmosphereSystem &operator=(const SkyAtmosphereSystem &) = deleteSkyAtmosphereSystem &operator=(SkyAtmosphereSystem &&) = deleteensureResources
bool ensureResources()Lazily allocate FBOs + textures for the four LUTs.
Returns true on success; throws if a required framebuffer is incomplete.
release
void release()Release all owned GL handles. Safe to call multiple times.
render
void render(
Shader &transmittanceShader,
Shader &multiScatShader,
Shader &skyViewShader,
Shader *apShader,
unsigned int fullScreenVao,
const glm::vec3 &sunDirectionHillaire,
float cameraHeightKm,
const glm::mat4 &invViewMat,
const glm::mat4 &invProjMat,
bool aerialPerspectiveRequired)Render the sky-atmosphere LUTs. Snapshots and restores the caller's framebuffer + viewport binding so the calling pass is unaffected.
Returns without GL work when no LUT is dirty and the sun direction, camera height (and, for the aerial-perspective volume, camera matrices) match the previous render. Allocates resources on demand.
Parameters
| Parameter | Description |
|---|---|
transmittanceShader | shader to bind for the transmittance LUT pass |
multiScatShader | shader for the multi-scatter LUT pass |
skyViewShader | shader for the sky-view LUT pass |
apShader | shader for the aerial-perspective volume pass; nullable when disabled |
fullScreenVao | VAO with a full-screen triangle (gl_VertexID-driven) |
sunDirectionHillaire | direction TO the sun in world space (Hillaire convention) |
cameraHeightKm | altitude of the camera above ground in km |
invViewMat | inverse of the scene camera's view matrix |
invProjMat | inverse of the scene camera's projection matrix |
aerialPerspectiveRequired | whether the aerial-perspective volume is sampled this frame |
markStaticLutsDirty
void markStaticLutsDirty()Force the static LUTs (transmittance, multi-scattering) to be recomputed on the next render. Call when atmosphere parameters change. The sky-view and aerial-perspective LUTs are invalidated too.
transmittanceLut
unsigned int transmittanceLut() constLUT texture handle accessors. Zero means not yet allocated.
Returns Transmittance LUT (256x64).
multiScatLut
unsigned int multiScatLut() constReturns Multi-scattering LUT (32x32).
skyViewLut
unsigned int skyViewLut() constReturns Sky-view LUT (192x108).
aerialPerspectiveLut
unsigned int aerialPerspectiveLut() constReturns Aerial-perspective volume (32x32x32 RGBA16F).
Static member functions
uploadEarthAtmosphereUniforms static
static void uploadEarthAtmosphereUniforms(Shader &sh)Bind the standard Hillaire Earth atmosphere parameters as uniforms on sh. Exposed so the final consumer (skybox / post) can upload the same parameters with one helper.
Parameters
| Parameter | Description |
|---|---|
sh | Shader to receive the uniforms. |