Engine → Renderer → environment_asset.h
equirect_image
| Type | Struct |
| Namespace | conjure::renderer |
| Include File Path | engine/include/conjure/renderer/environment_asset.h |
| Source File Path | engine/src/renderer/assets/environment_asset.cpp |
| API ↗ | Rendering, Renderer assets |
Syntax
Variables
| Access | Name | Type | Default | Description |
|---|---|---|---|---|
| public | height | u32 | 0 | |
| public | rgb | std::vector<f32> | {} | |
| public | width | u32 | 0 |
Functions
Public
constant
constant[[nodiscard]] static equirect_image constant(
u32 width,
u32 height,
const math::vec3 &colour);An image of one colour.
decode_hdr
decode_hdr[[nodiscard]] static core::result<equirect_image> decode_hdr(
std::span<const std::byte> encoded,
core::jobs::job_system *jobs = nullptr);Decodes a Radiance .hdr file (stb_image) or a JPEG XL file (libjxl), recognised by its signature. A JPEG XL file of any sample type, float included, is converted from its colour encoding (Display, an ICC profile, ...) to linear light with sRGB primaries, keeping values above 1, its premultiplied alpha divided out, and its first frame is used; jobs (optional) decodes it on the workers. PQ and HLG files are display light in nits and come out with 1.0 at 203 nits, the reference white of ITU-R BT.2408, where a .hdr or float file keeps its 1.0 (HLG through its system gamma for a display of the file's intensity target, 1000 nits unless stated). Every sample is then made one the bake can sum: NaN and negative values become 0 and anything above MAX_ENVIRONMENT_RADIANCE, +inf included, becomes that value; finite HDR radiance below it is kept as decoded, however bright. Fails with renderer_error::DECODE_FAILED when the decoder rejects the data and INVALID_ARGUMENT for empty data, a size above texture_asset::MAX_DIMENSION or a JPEG XL file over one of its decoding limits (texture_asset::decode).
is_valid
is_valid[[nodiscard]] bool is_valid() const noexcept;sample
sample[[nodiscard]] math::vec3 sample(
const math::vec3 &direction) const noexcept;Bilinear lookup in a direction (y up; the image seam is at -Z). Each texel is read as decode_hdr leaves it (NaN and negative values as 0, anything above MAX_ENVIRONMENT_RADIANCE as that value), so an image filled by hand bakes to finite values too.