tinypbrt 1.1.1
pbrt-v4 scene file parser for C11 with a header-only C++20 wrapper
Loading...
Searching...
No Matches
math.h
Go to the documentation of this file.
1#pragma once
2#ifndef _TINYPBRT_MATH_H_
3#define _TINYPBRT_MATH_H_
4
6
7#ifdef __cplusplus
8extern "C" {
9#endif
10
26
37
48
59
70
75 typedef struct tpbrt_vec2_t {
77 struct {
78 union {
80 tpbrt_float_t x, r;
81 };
82
83 union {
85 tpbrt_float_t y, g;
86 };
87 };
88
91 };
93
98 typedef struct tpbrt_vec3_t {
100 struct {
101 union {
103 tpbrt_float_t x, r;
104 };
105
106 union {
108 tpbrt_float_t y, g;
109 };
110
111 union {
113 tpbrt_float_t z, b;
114 };
115 };
116
119 };
120 } tpbrt_vec3_t;
121
126 typedef struct tpbrt_vec4_t {
128 struct {
129 union {
131 tpbrt_float_t x, r;
132 };
133
134 union {
136 tpbrt_float_t y, g;
137 };
138
139 union {
141 tpbrt_float_t z, b;
142 };
143
144 union {
146 tpbrt_float_t w, a;
147 };
148 };
149
152 };
153 } tpbrt_vec4_t;
154
165
176
181 typedef struct tpbrt_mat4_t {
183 struct {
185 tpbrt_mat4_row_t row0;
187 tpbrt_mat4_row_t row1;
189 tpbrt_mat4_row_t row2;
191 tpbrt_mat4_row_t row3;
192 };
193
196
197 struct {
206 };
207
208 // NOLINTBEGIN(readability-magic-numbers)
211 // NOLINTEND(readability-magic-numbers)
212 };
213 } tpbrt_mat4_t;
214
225
226#ifdef __cplusplus
227}
228#endif
229#endif // _TINYPBRT_MATH_H_
float tpbrt_float_t
Float type.
Definition fwd.h:83
int32_t tpbrt_int_t
Int type.
Definition fwd.h:73
size_t tpbrt_size_t
Size type.
Definition fwd.h:93
uint32_t tpbrt_uint_t
Unsigned int type.
Definition fwd.h:78
uint8_t tpbrt_bool_t
Bool type.
Definition fwd.h:68
Array of bool values.
Definition math.h:31
tpbrt_bool_t * data
Array data.
Definition math.h:33
tpbrt_size_t count
Array items count.
Definition math.h:35
Array of float values.
Definition math.h:64
tpbrt_float_t * data
Array data.
Definition math.h:66
tpbrt_size_t count
Array items count.
Definition math.h:68
Array of int values.
Definition math.h:42
tpbrt_int_t * data
Array data.
Definition math.h:44
tpbrt_size_t count
Array items count.
Definition math.h:46
Two 4 by 4 row-major matrices used for animations.
Definition math.h:219
tpbrt_mat4_t start
Starting transform matrix.
Definition math.h:221
tpbrt_mat4_t end
Ending transform matrix.
Definition math.h:223
4 by 4 row-major matrix.
Definition math.h:181
tpbrt_mat4_row_t rows[4]
Array of 4 rows.
Definition math.h:195
tpbrt_float_t m31
Definition math.h:205
tpbrt_float_t m33
Definition math.h:205
tpbrt_float_t m12
Definition math.h:201
tpbrt_float_t m02
Definition math.h:199
tpbrt_float_t m01
Definition math.h:199
tpbrt_float_t m00
First row elements.
Definition math.h:199
tpbrt_float_t m13
Definition math.h:201
tpbrt_float_t m21
Definition math.h:203
tpbrt_float_t m30
Fourth row elements.
Definition math.h:205
tpbrt_float_t m03
Definition math.h:199
TPBRT_ANONYMOUS_UNION
Definition math.h:182
tpbrt_float_t m11
Definition math.h:201
tpbrt_float_t m32
Definition math.h:205
tpbrt_float_t m22
Definition math.h:203
tpbrt_float_t m[16u]
Array of 16 elements.
Definition math.h:210
tpbrt_float_t m20
Third row elements.
Definition math.h:203
tpbrt_float_t m10
Second row elements.
Definition math.h:201
tpbrt_float_t m23
Definition math.h:203
Optional float value.
Definition math.h:20
tpbrt_float_t value
Value set only when has_value is TPBRT_TRUE.
Definition math.h:22
tpbrt_bool_t has_value
Indicates if value is set.
Definition math.h:24
Array of uint values.
Definition math.h:53
tpbrt_size_t count
Array items count.
Definition math.h:57
tpbrt_uint_t * data
Array data.
Definition math.h:55
Array of 2 component vectors.
Definition math.h:159
tpbrt_size_t count
Array items count.
Definition math.h:163
tpbrt_vec2_t * data
Array data.
Definition math.h:161
2 component vector.
Definition math.h:75
tpbrt_float_t v[2]
vector as array of 2 float values.
Definition math.h:90
TPBRT_ANONYMOUS_UNION
Definition math.h:76
Array of 3 component vectors.
Definition math.h:170
tpbrt_size_t count
Array items count.
Definition math.h:174
tpbrt_vec3_t * data
Array data.
Definition math.h:172
3 component vector.
Definition math.h:98
tpbrt_float_t v[3]
vector as array of 3 float values.
Definition math.h:118
TPBRT_ANONYMOUS_UNION
Definition math.h:99
4 component vector.
Definition math.h:126
tpbrt_float_t v[4]
vector as array of 4 float values.
Definition math.h:151
TPBRT_ANONYMOUS_UNION
Definition math.h:127