Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
exr_io_common.h
Go to the documentation of this file.
1#pragma once
2
20#include "Frame/frame_fwd.h"
21
23
24#include <array>
25#include <string_view>
26#include <string>
27
28namespace ph { class Path; }
29namespace ph { class ByteBuffer; }
30
31namespace ph
32{
33
34#if PH_THIRD_PARTY_HAS_OPENEXR
35
36template<typename T>
37struct TImfPixel final
38{
39 T r;
40 T g;
41 T b;
42 T a;
43};
44
45template<typename T>
46void copy_frame_to_imf_array(
47 const HdrRgbFrame& frame,
48 HdrComponent alphaValue,
49 Imf::Array2D<TImfPixel<T>>& array2D);
50
51template<typename T, std::size_t N>
52void create_imf_header_for_frame(
53 Imf::Header& header,
54 const TFrame<T, N>& frame,
55 const std::array<std::string_view, N>& channelNames);
56
57template<std::size_t N>
58auto find_imf_channels(
59 const Imf::Header& header,
60 const std::array<std::string_view, N>& channelNames)
61-> std::array<const Imf::Channel*, N>;
62
66template<typename T, std::size_t N>
67void map_imf_framebuffer_to_frame(
68 Imf::FrameBuffer& framebuffer,
69 const Imf::Header& header,
70 const TFrame<T, N>& frame,
71 const std::array<std::string_view, N>& channelNames);
72
73//template<typename T, std::size_t N>
74//void adjust_frame_to_imf_display_window(
75// TFrame<T, N>& frame,
76// const Imf::Header& header);
77
78void write_imf_framebuffer_to_filesystem(
79 const Imf::Header& header,
80 const Imf::FrameBuffer& framebuffer,
81 const int numScanlines,
82 const Path& filePath);
83
84void write_imf_framebuffer_to_memory(
85 const Imf::Header& header,
86 const Imf::FrameBuffer& framebuffer,
87 const int numScanlines,
88 ByteBuffer& buffer);
89
90std::string list_all_imf_layers_and_channels(const Imf::Header& header);
91
92#endif
93// end PH_THIRD_PARTY_HAS_OPENEXR
94
95}// end namespace ph
96
The root for all renderer implementations.
Definition EEngineProject.h:6
TFrame< HdrComponent, 3 > HdrRgbFrame
Definition frame_fwd.h:17
float32 HdrComponent
Definition frame_fwd.h:14