-
Notifications
You must be signed in to change notification settings - Fork 12
/
Types.h
126 lines (105 loc) · 3.17 KB
/
Types.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#pragma once
#include <cstdint>
#if !defined(DISABLE_OCL)
#include <string>
#include <vector>
#endif
#include "Bitmask.h"
/**
@file Types.h
*/
namespace Ray {
/// Templated color struct
template <typename T, int N> struct color_t {
T v[N];
};
/// 8-bit color types
using color_rgba8_t = color_t<uint8_t, 4>;
using color_rgb8_t = color_t<uint8_t, 3>;
using color_rg8_t = color_t<uint8_t, 2>;
using color_r8_t = color_t<uint8_t, 1>;
/// Floating-point color types
using color_rgba_t = color_t<float, 4>;
using color_rgb_t = color_t<float, 3>;
using color_rg_t = color_t<float, 2>;
using color_r_t = color_t<float, 1>;
/// Color data struct, references array of pixels
template <typename T, int N> struct color_data_t {
const color_t<T, N> *ptr; ///< Pixels array
int pitch; ///< Data pitch (distance between lines) expressed in pixels
};
using color_data_rgba8_t = color_data_t<uint8_t, 4>;
using color_data_rgb8_t = color_data_t<uint8_t, 3>;
using color_data_rg8_t = color_data_t<uint8_t, 2>;
using color_data_r8_t = color_data_t<uint8_t, 1>;
using color_data_rgba_t = color_data_t<float, 4>;
using color_data_rgb_t = color_data_t<float, 3>;
using color_data_rg_t = color_data_t<float, 2>;
using color_data_r_t = color_data_t<float, 1>;
enum class eAUXBuffer : uint32_t { SHL1 = 0, BaseColor = 1, DepthNormals = 2 };
struct shl1_data_t {
float coeff_r[4], coeff_g[4], coeff_b[4];
};
static_assert(sizeof(shl1_data_t) == 48, "!");
/// Rectangle struct
struct rect_t {
int x, y, w, h;
};
/// Camera type
enum class eCamType : uint8_t { Persp, Ortho, Geo };
/// Type of reconstruction filter
enum class ePixelFilter : uint8_t { Box, Gaussian, BlackmanHarris, _Count };
enum class eLensUnits : uint8_t { FOV, FLength };
/// View transform (affects tonemapping)
enum class eViewTransform : uint8_t {
Standard,
AgX,
AgX_Punchy,
Filmic_VeryLowContrast,
Filmic_LowContrast,
Filmic_MediumLowContrast,
Filmic_MediumContrast,
Filmic_MediumHighContrast,
Filmic_HighContrast,
Filmic_VeryHighContrast,
_Count
};
enum class ePassFlags : uint8_t {
SkipDirectLight,
SkipIndirectLight,
LightingOnly,
NoBackground,
OutputSH
};
struct pass_settings_t {
uint8_t max_diff_depth, max_spec_depth, max_refr_depth, max_transp_depth, max_total_depth;
uint8_t min_total_depth, min_transp_depth;
Bitmask<ePassFlags> flags;
float clamp_direct = 0.0f, clamp_indirect = 0.0f;
int min_samples = 128;
float variance_threshold = 0.0f;
float regularize_alpha = 0.03f;
};
static_assert(sizeof(pass_settings_t) == 28, "!");
struct camera_t {
eCamType type;
ePixelFilter filter;
eViewTransform view_transform;
eLensUnits ltype;
float filter_width;
float fov, exposure, gamma, sensor_height;
float focus_distance, focal_length, fstop, lens_rotation, lens_ratio;
int lens_blades;
float clip_start, clip_end;
float origin[3], fwd[3], side[3], up[3], shift[2];
uint32_t mi_index, uv_index;
pass_settings_t pass_settings;
};
struct gpu_device_t {
char name[256];
};
struct unet_filter_properties_t {
int pass_count = 0;
int alias_dependencies[16][4] = {};
};
} // namespace Ray