Toast Engine
Loading...
Searching...
No Matches
hdr_image.hpp File Reference

Decoding for high-dynamic-range images, used for imported environment maps. More...

#include <cstdint>
#include <span>
#include <string_view>
#include <vector>
Include dependency graph for hdr_image.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  assets::HdrImage
 A decoded floating-point image, always four channels. More...

Functions

auto assets::decodeHdr (std::span< const uint8_t > bytes) -> HdrImage
 Decodes a Radiance .hdr image held in memory.

Detailed Description

Decoding for high-dynamic-range images, used for imported environment maps.

Author
dario
Date
07/08/2026

Function Documentation

◆ decodeHdr()

auto assets::decodeHdr ( std::span< const uint8_t > bytes) -> HdrImage
nodiscard

Decodes a Radiance .hdr image held in memory.

Radiance is the format essentially every free environment library ships, and it decodes to linear radiance directly - no transfer function to undo and no exposure baked in, which is exactly what an environment map has to be. It is read here rather than converted to KTX2 at import: toktx only ingests PNG, so a KTX2 route would need the library driven directly, and a format this simple does not earn that

Parameters
bytesWhole file contents
Returns
a decoded image, or one where valid() is false if bytes is not a readable HDR