Photon Engine 2.0.0-beta
A physically based renderer.
|
Helpers for data I/O. More...
Namespaces | |
namespace | detail |
Functions | |
PH_DEFINE_INTERNAL_LOG_GROUP (IOUtils, DataIO) | |
std::string | load_text (const Path &filePath) |
Read the whole file as a formatted string. | |
bool | has_LDR_support (std::string_view filenameExt) |
Checks whether the provided picture format supports LDR by filename extension. | |
bool | has_HDR_support (std::string_view filenameExt) |
Checks whether the provided picture format supports HDR by filename extension. | |
bool | load_picture_meta (const Path &picturePath, PictureMeta *out_meta, math::Vector2S *out_sizePx=nullptr, std::size_t *out_numChannels=nullptr) |
Load general information that describes the picture. For most formats, this parses the image header without loading actual pixel data. | |
void | save (const LdrRgbFrame &frame, const Path &filePath, const PictureMeta *meta=nullptr) |
Saves a LDR frame to the specified file. Similar to save(4) , except file name and format are deduced from path. | |
void | save (const HdrRgbFrame &frame, const Path &filePath, const PictureMeta *meta=nullptr) |
Saves a HDR frame to the specified file. Similar to save(4) , except file name and format are deduced from path. | |
void | save (const LdrRgbFrame &frame, const Path &fileDirectory, const std::string &name, EPictureFile format, const PictureMeta *meta=nullptr) |
Saves a LDR frame to the specified file. Notice that if the specified format is HDR, values will be promoted to higher precision types which can have extra storage cost. | |
void | save (const HdrRgbFrame &frame, const Path &fileDirectory, const std::string &name, EPictureFile format, const PictureMeta *meta=nullptr) |
Saves a HDR frame to the specified file. Notice that if the specified format is LDR, values outside [0, 1] will be clamped (this may result in significant data loss depending on the values stored). | |
void | save_png (const LdrRgbFrame &frame, const Path &filePath, const PictureMeta *meta=nullptr) |
Saves a frame in PNG format. | |
void | save_jpg (const LdrRgbFrame &frame, const Path &filePath, const PictureMeta *meta=nullptr) |
Saves a frame in JPG format. | |
void | save_bmp (const LdrRgbFrame &frame, const Path &filePath, const PictureMeta *meta=nullptr) |
Saves a frame in BMP format. | |
void | save_tga (const LdrRgbFrame &frame, const Path &filePath, const PictureMeta *meta=nullptr) |
Saves a frame in TGA format. | |
void | save_hdr (const HdrRgbFrame &frame, const Path &filePath, const PictureMeta *meta=nullptr) |
Saves a frame in HDR format. | |
void | save_exr (const HdrRgbFrame &frame, const Path &filePath, const PictureMeta *meta=nullptr) |
Saves a frame in EXR format. | |
void | save_exr_high_precision (const HdrRgbFrame &frame, const Path &filePath, const PictureMeta *meta=nullptr) |
Saves a frame in EXR format with high precision encoding. | |
void | save_pfm (const HdrRgbFrame &frame, const Path &filePath, const PictureMeta *meta=nullptr) |
Saves a frame in PFM format. | |
void | save_exr (const HdrRgbFrame &frame, ByteBuffer &buffer, const PictureMeta *meta=nullptr) |
Saves a frame in EXR format to memory. | |
RegularPicture | load_picture (const Path &picturePath, std::size_t layerIdx=0) |
Loads common picture types from file. Format is deduced from filename extension. Tries to load the specified layer into a regular picture. | |
RegularPicture | load_LDR_picture (const Path &picturePath, std::size_t layerIdx) |
RegularPicture | load_HDR_picture (const Path &picturePath, std::size_t layerIdx) |
Helpers for data I/O.
bool ph::io_utils::has_HDR_support | ( | std::string_view | filenameExt | ) |
Checks whether the provided picture format supports HDR by filename extension.
Note that the check is from the engine's perspective–a format may not support HDR here while it actually does from its original spec.
filenameExt | Filename extension (the leading dot should be included). |
bool ph::io_utils::has_LDR_support | ( | std::string_view | filenameExt | ) |
Checks whether the provided picture format supports LDR by filename extension.
Note that the check is from the engine's perspective–a format may not support LDR here while it actually does from its original spec.
filenameExt | Filename extension (the leading dot should be included). |
RegularPicture ph::io_utils::load_HDR_picture | ( | const Path & | picturePath, |
std::size_t | layerIdx ) |
RegularPicture ph::io_utils::load_LDR_picture | ( | const Path & | picturePath, |
std::size_t | layerIdx ) |
RegularPicture ph::io_utils::load_picture | ( | const Path & | picturePath, |
std::size_t | layerIdx = 0 ) |
Loads common picture types from file. Format is deduced from filename extension. Tries to load the specified layer into a regular picture.
layerIdx | Index of the layer to load. For most picture type, left the layer index as default should be good. |
FileIOError | If any error occurred. |
bool ph::io_utils::load_picture_meta | ( | const Path & | picturePath, |
PictureMeta * | out_meta, | ||
math::Vector2S * | out_sizePx = nullptr, | ||
std::size_t * | out_numChannels = nullptr ) |
Load general information that describes the picture. For most formats, this parses the image header without loading actual pixel data.
out_meta | Stores the loaded picture meta. Can be set to nullptr if only the selected information is required (use the more specific output variable instead). |
std::string ph::io_utils::load_text | ( | const Path & | filePath | ) |
Read the whole file as a formatted string.
ph::io_utils::PH_DEFINE_INTERNAL_LOG_GROUP | ( | IOUtils | , |
DataIO | ) |
void ph::io_utils::save | ( | const HdrRgbFrame & | frame, |
const Path & | fileDirectory, | ||
const std::string & | name, | ||
EPictureFile | format, | ||
const PictureMeta * | meta = nullptr ) |
Saves a HDR frame to the specified file. Notice that if the specified format is LDR, values outside [0, 1] will be clamped (this may result in significant data loss depending on the values stored).
meta | General information for storing the frame as a picture. The information given may or may not be considered (depending on the file format). |
void ph::io_utils::save | ( | const HdrRgbFrame & | frame, |
const Path & | filePath, | ||
const PictureMeta * | meta ) |
Saves a HDR frame to the specified file. Similar to save(4)
, except file name and format are deduced from path.
void ph::io_utils::save | ( | const LdrRgbFrame & | frame, |
const Path & | fileDirectory, | ||
const std::string & | name, | ||
EPictureFile | format, | ||
const PictureMeta * | meta = nullptr ) |
Saves a LDR frame to the specified file. Notice that if the specified format is HDR, values will be promoted to higher precision types which can have extra storage cost.
meta | General information for storing the frame as a picture. The information given may or may not be considered (depending on the file format). |
void ph::io_utils::save | ( | const LdrRgbFrame & | frame, |
const Path & | filePath, | ||
const PictureMeta * | meta ) |
Saves a LDR frame to the specified file. Similar to save(4)
, except file name and format are deduced from path.
void ph::io_utils::save_bmp | ( | const LdrRgbFrame & | frame, |
const Path & | filePath, | ||
const PictureMeta * | meta ) |
Saves a frame in BMP format.
void ph::io_utils::save_exr | ( | const HdrRgbFrame & | frame, |
ByteBuffer & | buffer, | ||
const PictureMeta * | meta ) |
Saves a frame in EXR format to memory.
void ph::io_utils::save_exr | ( | const HdrRgbFrame & | frame, |
const Path & | filePath, | ||
const PictureMeta * | meta ) |
Saves a frame in EXR format.
void ph::io_utils::save_exr_high_precision | ( | const HdrRgbFrame & | frame, |
const Path & | filePath, | ||
const PictureMeta * | meta ) |
Saves a frame in EXR format with high precision encoding.
void ph::io_utils::save_hdr | ( | const HdrRgbFrame & | frame, |
const Path & | filePath, | ||
const PictureMeta * | meta ) |
Saves a frame in HDR format.
void ph::io_utils::save_jpg | ( | const LdrRgbFrame & | frame, |
const Path & | filePath, | ||
const PictureMeta * | meta ) |
Saves a frame in JPG format.
void ph::io_utils::save_pfm | ( | const HdrRgbFrame & | frame, |
const Path & | filePath, | ||
const PictureMeta * | meta ) |
Saves a frame in PFM format.
void ph::io_utils::save_png | ( | const LdrRgbFrame & | frame, |
const Path & | filePath, | ||
const PictureMeta * | meta ) |
Saves a frame in PNG format.
void ph::io_utils::save_tga | ( | const LdrRgbFrame & | frame, |
const Path & | filePath, | ||
const PictureMeta * | meta ) |
Saves a frame in TGA format.