SH4ZAM! 0.7.0
Fast math library for the Sega Dreamcast's SH4 CPU
Loading...
Searching...
No Matches
shz_xmtrx.hpp
Go to the documentation of this file.
1/*! \file
2 * \brief C++ Active Matrix API
3 * \ingroup xmtrx
4 *
5 * This file provides an API built around manipulating and performing
6 * calculations using the SH4's "current" 4x4 matrix, which is held within
7 * a secondary back-bank of 16 single-precision floating-point registers.
8 *
9 * \todo
10 * - shz_rotate_quat()
11 *
12 * \author 2025, 2026 Falco Girgis
13 * \copyright MIT License
14 */
15
16#ifndef SHZ_XMTRX_HPP
17#define SHZ_XMTRX_HPP
18
19#include <array>
20
21#include "shz_xmtrx.h"
22#include "shz_vector.hpp"
23#include "shz_quat.hpp"
24
25namespace shz {
26
27/*! Static structure around the 4x4 XMTRX FP register back-bank.
28
29 This structure provides the C++ bindings to the XMTRX API as a series
30 of static member functions wrapping the C API.
31
32 \sa xmtrx
33*/
34struct xmtrx {
35
36 //! FP back-bank registers comprising XMTRX.
37 enum reg {
38 XF0 = SHZ_XMTRX_XF0, //!< FP register XF0
39 XF1 = SHZ_XMTRX_XF1, //!< FP register XF1
40 XF2 = SHZ_XMTRX_XF2, //!< FP register XF2
41 XF3 = SHZ_XMTRX_XF3, //!< FP register XF3
42 XF4 = SHZ_XMTRX_XF4, //!< FP register XF4
43 XF5 = SHZ_XMTRX_XF5, //!< FP register XF5
44 XF6 = SHZ_XMTRX_XF6, //!< FP register XF6
45 XF7 = SHZ_XMTRX_XF7, //!< FP register XF7
46 XF8 = SHZ_XMTRX_XF8, //!< FP register XF8
47 XF9 = SHZ_XMTRX_XF9, //!< FP register XF9
48 XF10 = SHZ_XMTRX_XF10, //!< FP register XF10
49 XF11 = SHZ_XMTRX_XF11, //!< FP register XF11
50 XF12 = SHZ_XMTRX_XF12, //!< FP register XF12
51 XF13 = SHZ_XMTRX_XF13, //!< FP register XF13
52 XF14 = SHZ_XMTRX_XF14, //!< FP register XF14
53 XF15 = SHZ_XMTRX_XF15 //!< FP register XF15
54 };
55
56 //! Non-POSIX style reg_t alias.
57 using reg_t = reg;
58
59/*! \name Accessors
60 \brief Setting and retrieving individual XMTRX register values.
61 @{
62*/
63
64 //! C++ wrapper around shz_xmtrx_read().
65 SHZ_FORCE_INLINE static float read(reg xf) noexcept {
66 return shz_xmtrx_read(static_cast<shz_xmtrx_reg>(xf));
67 }
68
69 //! C++ wrapper around shz_xmtrx_write().
70 SHZ_FORCE_INLINE static void write(reg xf, float value) noexcept {
71 shz_xmtrx_write(static_cast<shz_xmtrx_reg>(xf), value);
72 }
73
74 //! C++ wrapper around shz_xmtrx_read_row().
75 SHZ_FORCE_INLINE static vec4 read_row(unsigned int index) noexcept {
76 return shz_xmtrx_read_row(index);
77 }
78
79 //! C++ wrapper around shz_xmtrx_read_col().
80 SHZ_FORCE_INLINE static vec4 read_col(unsigned int index) noexcept {
81 return shz_xmtrx_read_col(index);
82 }
83
84 //! C++ wrapper around shz_xmtrx_write_row().
85 SHZ_FORCE_INLINE static void write_row(unsigned int index, const vec4& vector) noexcept {
86 shz_xmtrx_write_row(index, vector);
87 }
88
89 //! C++ wrapper around shz_xmtrx_write_col().
90 SHZ_FORCE_INLINE static void write_col(unsigned int index, const vec4& vector) noexcept {
91 shz_xmtrx_write_col(index, vector);
92 }
93
94 //! C++ wrapper around shz_xmtrx_swap_rows().
95 SHZ_FORCE_INLINE static void swap_rows(unsigned int index1, unsigned int index2) noexcept {
96 shz_xmtrx_swap_rows(index1, index2);
97 }
98
99 //! C++ wrapper around shz_xmtrx_swap_cols().
100 SHZ_FORCE_INLINE static void swap_cols(unsigned int index1, unsigned int index2) noexcept {
101 shz_xmtrx_swap_cols(index1, index2);
102 }
103
104//! @}
105
106/*! \name Loading
107 \brief Routines for loading XMTRX contents from memory.
108 @{
109*/
110
111 //! C++ wrapper around shz_xmtrx_load_4x4().
112 SHZ_FORCE_INLINE static void load(const shz_mat4x4_t& mat4) noexcept {
114 }
115
116 //! C++ wrapper around shz_xmtrx_load_unaligned_4x4().
117 SHZ_FORCE_INLINE static void load(const float cArray[16]) noexcept {
119 }
120
121 //! C++ wrapper around shz_xmtrx_load_unaligned_4x4().
122 SHZ_FORCE_INLINE static void load(const std::array<float, 16>& array) noexcept {
123 load(array.data());
124 }
125
126 //! C++ wrapper around shz_xmtrx_load_transpose_4x4().
127 SHZ_FORCE_INLINE static void load_transpose(const shz_mat4x4_t& mat4) noexcept {
129 }
130
131 //! C++ wrapper around shz_xmtrx_load_transpose_unaligned_4x4().
132 SHZ_FORCE_INLINE static void load_transpose(const float cArray[16]) noexcept {
134 }
135
136 //! C++ wrapper around shz_xmtrx_load_transpose_unaligned_4x4().
137 SHZ_FORCE_INLINE static void load_transpose(const std::array<float, 16>& array) noexcept {
138 load_transpose(array.data());
139 }
140
141 //! C++ wrapper around shz_xmtrx_load_wxyz_4x4().
142 SHZ_FORCE_INLINE static void load_wxyz(const shz_mat4x4_t& mat4) noexcept {
144 }
145
146 //! C++ wrapper around shz_xmtrx_load_cols_4x4().
147 SHZ_FORCE_INLINE static void load_cols(const shz_vec4_t& c1,
148 const shz_vec4_t& c2,
149 const shz_vec4_t& c3,
150 const shz_vec4_t& c4) noexcept {
151 shz_xmtrx_load_cols_4x4(&c1, &c2, &c3, &c4);
152 }
153
154 //! C++ wrapper around shz_xmtrx_load_rows_4x4().
155 SHZ_FORCE_INLINE static void load_rows(const shz_vec4_t& r1,
156 const shz_vec4_t& r2,
157 const shz_vec4_t& r3,
158 const shz_vec4_t& r4) noexcept {
159 shz_xmtrx_load_rows_4x4(&r1, &r2, &r3, &r4);
160 }
161
162 //! C++ wrapper around shz_xmtrx_load_3x4().
163 SHZ_FORCE_INLINE static void load(const shz_mat3x4_t& mat) noexcept {
165 }
166
167//! @}
168
169/*! \name Storing
170 \brief Routines for saving XMTRX contents to memory.
171 @{
172*/
173
174 //! C++ wrapper around shz_xmtrx_store_4x4().
175 SHZ_FORCE_INLINE static void store(shz_mat4x4_t* mat) noexcept {
177 }
178
179 //! C++ wrapper around shz_xmtrx_store_unaligned_4x4().
180 SHZ_FORCE_INLINE static void store(float cArray[16]) noexcept {
182 }
183
184 //! C++ wrapper around shz_xmtrx_store_unaligned_4x4().
185 SHZ_FORCE_INLINE static void store(std::array<float, 16>* array) noexcept {
187 }
188
189 //! C++ wrapper around shz_xmtrx_store_transpose_4x4().
190 SHZ_FORCE_INLINE static void store_transpose(shz_mat4x4_t* mat) noexcept {
192 }
193
194 //! C++ wrapper around shz_xmtrx_store_transpose_unaligned_4x4().
195 SHZ_FORCE_INLINE static void store_transpose(float cArray[16]) noexcept {
197 }
198
199 //! C++ wrapper around shz_xmtrx_store_transpose_unaligned_4x4().
200 SHZ_FORCE_INLINE static void store_transpose(std::array<float, 16>* array) noexcept {
201 store_transpose(array->data());
202 }
203
204 //! C++ wrapper around shz_xmtrx_store_3x4().
205 SHZ_FORCE_INLINE static void store(shz_mat3x4_t* mat) noexcept {
207 }
208
209//! @}
210
211/*! \name Initialization
212 \brief Routines used to initialize the entirety of XMTRX.
213 @{
214*/
215
216 //! C++ wrapper around shz_xmtrx_init_identity().
217 SHZ_FORCE_INLINE static void init_identity() noexcept {
219 }
220
221 //! C++ wrapper around shz_xmtrx_init_identity_safe().
222 SHZ_FORCE_INLINE static void init_identity_safe() noexcept {
224 }
225
226 //! C++ wrapper around shz_xmtrx_init_zero().
227 SHZ_FORCE_INLINE static void init_zero() noexcept {
229 }
230
231 //! C++ wrapper around shz_xmtrx_init_one().
232 SHZ_FORCE_INLINE static void init_one() noexcept {
234 }
235
236 //! C++ wrapper around shz_xmtrx_init_fill().
237 SHZ_FORCE_INLINE static void init_fill(float value) noexcept {
239 }
240
241 //! C++ wrapper around shz_xmtrx_init_translation().
242 SHZ_FORCE_INLINE static void init_translation(float x, float y, float z) noexcept {
244 }
245
246 //! C++ wrapper around shz_xmtrx_init_translation().
247 SHZ_FORCE_INLINE static void init_translation(const vec3& v) noexcept {
248 init_translation(v.x, v.y, v.z);
249 }
250
251 //! C++ wrapper around shz_xmtrx_init_scale().
252 SHZ_FORCE_INLINE static void init_scale(float x, float y, float z) noexcept {
254 }
255
256 //! C++ wrapper around shz_xmtrx_init_scale().
257 SHZ_FORCE_INLINE static void init_scale(const vec3& v) noexcept {
258 init_scale(v.x, v.y, v.z);
259 }
260
261 //! C++ wrapper around shz_xmtrx_init_rotation_x().
262 SHZ_FORCE_INLINE static void init_rotation_x(float x) noexcept {
264 }
265
266 //! C++ wrapper around shz_xmtrx_init_rotation_y().
267 SHZ_FORCE_INLINE static void init_rotation_y(float y) noexcept {
269 }
270
271 //! C++ wrapper around shz_xmtrx_init_rotation_z().
272 SHZ_FORCE_INLINE static void init_rotation_z(float z) noexcept {
274 }
275
276 //! C++ wrapper around shz_xmtrx_init_rotation_xyz().
277 SHZ_FORCE_INLINE static void init_rotation_xyz(float x, float y, float z) noexcept {
279 }
280
281 //! C++ wrapper around shz_xmtrx_init_rotation_zyx().
282 SHZ_FORCE_INLINE static void init_rotation_zyx(float z, float y, float x) noexcept {
284 }
285
286 //! C++ wrapper around shz_xmtrx_init_rotation_zxy().
287 SHZ_FORCE_INLINE static void init_rotation_zxy(float z, float x, float y) noexcept {
289 }
290
291 //! C++ wrapper around shz_xmtrx_init_rotation_yxz().
292 SHZ_FORCE_INLINE static void init_rotation_yxz(float y, float x, float z) noexcept {
294 }
295
296 //! C++ wrapper around shz_xmtrx_init_rotation().
297 SHZ_FORCE_INLINE static void init_rotation(float angle, float x, float y, float z) noexcept {
299 }
300
301 //! C++ wrapper around shz_xmtrx_init_rotation().
302 SHZ_FORCE_INLINE static void init_rotation(float angle, const vec3& axis) noexcept {
303 init_rotation(angle, axis.x, axis.y, axis.z);
304 }
305
306 //! C++ wrapper around shz_xmtrx_init_diagonal().
307 SHZ_FORCE_INLINE static void init_diagonal(float x, float y, float z, float w) noexcept {
309 }
310
311 //! C++ wrapper around shz_xmtrx_init_diagonal().
312 SHZ_FORCE_INLINE static void init_diagonal(const vec4& v) noexcept {
313 init_diagonal(v.x, v.y, v.z, v.w);
314 }
315
316 //! C++ wrapper around shz_xmtrx_init_upper_triangular().
317 SHZ_FORCE_INLINE static void init_upper_triangular(float col1, const vec2& col2, const vec3& col3, const vec4& col4) noexcept {
318 shz_xmtrx_init_upper_triangular(col1, col2, col3, col4);
319 }
320
321 //! C++ wrapper around shz_xmtrx_init_lower_diagonal().
322 SHZ_FORCE_INLINE static void init_lower_triangular(const vec4& col1, const vec3& col2, const vec2& col3, float col4) noexcept {
323 shz_xmtrx_init_lower_triangular(col1, col2, col3, col4);
324 }
325
326 //! C++ wrapper around shz_xmtrx_init_symmetric_skew().
327 SHZ_FORCE_INLINE static void init_symmetric_skew(float x, float y, float z) noexcept {
329 }
330
331 //! C++ wrapper around shz_xmtrx_init_outer_product().
332 SHZ_FORCE_INLINE static void init_outer_product(const vec4& a, const vec4& b) noexcept {
333 shz_xmtrx_init_outer_product(a, b);
334 }
335
336 //! C++ wrapper around shz_xmtrx_init_screen().
337 SHZ_FORCE_INLINE static void init_screen(float width, float height) noexcept {
338 shz_xmtrx_init_screen(width, height);
339 }
340
341 //! C++ wrapper around shz_xmtrx_init_lookat().
342 SHZ_FORCE_INLINE static void init_lookat(const vec3& eye, const vec3& center, const vec3& up) noexcept {
343 shz_xmtrx_init_lookat(eye, center, up);
344 }
345
346 //! C++ wrapper around shz_xmtrx_init_ortho().
347 SHZ_FORCE_INLINE static void init_ortho(float left, float right, float bottom, float top, float znear, float zfar) noexcept {
348 shz_xmtrx_init_ortho(left, right, bottom, top, znear, zfar);
349 }
350
351 //! C++ wrapper around shz_xmtrx_init_frustum().
352 SHZ_FORCE_INLINE static void init_frustum(float left, float right, float bottom, float top, float znear, float zfar) noexcept {
353 shz_xmtrx_init_frustum(left, right, bottom, top, znear, zfar);
354 }
355
356 //! C++ wrapper around shz_xmtrx_init_perspective().
357 SHZ_FORCE_INLINE static void init_perspective(float fov, float aspect, float znear) noexcept {
358 shz_xmtrx_init_perspective(fov, aspect, znear);
359 }
360
361 //! C++ wrapper around shz_xmtrx_init_rotation_quat().
362 SHZ_FORCE_INLINE static void init_rotation_quat(const quat& q) noexcept {
364 }
365
366 //! C++ wrapper around shz_xmtrx_init_permutation_wxyz().
367 SHZ_FORCE_INLINE static void init_permutation_wxyz() noexcept {
369 }
370
371 //! C++ wrapper around shz_xmtrx_init_permutation_yzwx().
372 SHZ_FORCE_INLINE static void init_permutation_yzwx() noexcept {
374 }
375
376 //! C++ wrapper around shz_xmtrx_init_permutation_wzyx().
377 SHZ_FORCE_INLINE static void init_permutation_wzyx() noexcept {
379 }
380
381//! @}
382
383/*! \name Apply Operation
384 \brief Updates only relevant values of XMTRX based on the given transform.
385 @{
386*/
387
388 //! C++ wrapper around shz_xmtrx_apply_4x4().
389 SHZ_FORCE_INLINE static void apply(const shz_mat4x4_t& mat4) noexcept {
391 }
392
393 //! C++ wrapper around shz_xmtrx_apply_unaligned_4x4().
394 SHZ_FORCE_INLINE static void apply(const float cArray[16]) noexcept {
396 }
397
398 //! C++ wrapper around shz_xmtrx_apply_unaligned_4x4().
399 SHZ_FORCE_INLINE static void apply(const std::array<float, 16>& array) noexcept {
401 }
402
403 //! C++ wrapper around shz_xmtrx_apply_transpose_4x4().
404 SHZ_FORCE_INLINE static void apply_transpose(const shz_mat4x4_t& mat4) noexcept {
406 }
407
408 //! C++ wrapper around shz_xmtrx_apply_transpose_unaligned_4x4().
409 SHZ_FORCE_INLINE static void apply_transpose(const float cArray[16]) noexcept {
411 }
412
413 //! C++ wrapper around shz_xmtrx_apply_transpose_unaligned_4x4().
414 SHZ_FORCE_INLINE static void apply_transpose(const std::array<float, 16>& array) noexcept {
416 }
417
418 //! C++ wrapper around shz_xmtrx_apply_reverse_4x4().
419 SHZ_FORCE_INLINE static void apply_reverse(const shz_mat4x4_t& mat4) noexcept {
421 }
422
423 //! C++ wrapper around shz_xmtrx_apply_reverse_unaligned_4x4().
424 SHZ_FORCE_INLINE static void apply_reverse(const float cArray[16]) noexcept {
426 }
427
428 //! C++ wrapper around shz_xmtrx_apply_reverse_unaligned_4x4().
429 SHZ_FORCE_INLINE static void apply_reverse(const std::array<float, 16>& array) noexcept {
431 }
432
433 //! C++ wrapper around shz_xmtrx_apply_reverse_transpose_4x4().
434 SHZ_FORCE_INLINE static void apply_reverse_transpose(const shz_mat4x4_t& mat4) noexcept {
436 }
437
438 //! C++ wrapper around shz_xmtrx_apply_reverse_transpose_unaligned_4x4().
439 SHZ_FORCE_INLINE static void apply_reverse_transpose(const float cArray[16]) noexcept {
441 }
442
443 //! C++ wrapper around shz_xmtrx_apply_reverse_transpose_unaligned_4x4().
444 SHZ_FORCE_INLINE static void apply_reverse_transpose(const std::array<float, 16>& array) noexcept {
446 }
447
448 //! C++ wrapper around shz_xmtrx_apply_3x4().
449 SHZ_FORCE_INLINE static void apply(const shz_mat3x4_t& mat) noexcept {
451 }
452
453 //! C++ wrapper around shz_xmtrx_apply_translation().
454 SHZ_FORCE_INLINE static void apply_translation(float x, float y, float z) noexcept {
456 }
457
458 //! C++ wrapper around shz_xmtrx_apply_translation().
459 SHZ_FORCE_INLINE static void apply_translation(const vec3& v) noexcept {
460 apply_translation(v.x, v.y, v.z);
461 }
462
463 //! C++ wrapper around shz_xmtrx_apply_scale().
464 SHZ_FORCE_INLINE static void apply_scale(float x, float y, float z) noexcept {
466 }
467
468 //! C++ wrapper around shz_xmtrx_apply_scale().
469 SHZ_FORCE_INLINE static void apply_scale(const vec3& v) noexcept {
470 apply_scale(v.x, v.y, v.z);
471 }
472
473 //! C++ wrapper around shz_xmtrx_apply_rotation_x().
474 SHZ_FORCE_INLINE static void apply_rotation_x(float x) noexcept {
476 }
477
478 //! C++ wrapper around shz_xmtrx_apply_rotation_y().
479 SHZ_FORCE_INLINE static void apply_rotation_y(float y) noexcept {
481 }
482
483 //! C++ wrapper around shz_xmtrx_apply_rotation_z().
484 SHZ_FORCE_INLINE static void apply_rotation_z(float z) noexcept {
486 }
487
488 //! C++ wrapper around shz_xmtrx_init_rotation_xyz().
489 SHZ_FORCE_INLINE static void apply_rotation_xyz(float x, float y, float z) noexcept {
491 }
492
493 //! C++ wrapper around shz_xmtrx_apply_rotation_zyx().
494 SHZ_FORCE_INLINE static void apply_rotation_zyx(float z, float y, float x) noexcept {
496 }
497
498 //! C++ wrapper around shz_xmtrx_apply_rotation_zxy().
499 SHZ_FORCE_INLINE static void apply_rotation_zxy(float z, float x, float y) noexcept {
501 }
502
503 //! C++ wrapper around shz_xmtrx_apply_rotation_yxz().
504 SHZ_FORCE_INLINE static void apply_rotation_yxz(float y, float x, float z) noexcept {
506 }
507
508 // C++ wrapper around shz_xmtrx_apply_rotation().
509 SHZ_FORCE_INLINE static void apply_rotation(float angle, float x, float y, float z) noexcept {
511 }
512
513 // C++ wrapper around shz_xmtrx_apply_rotation().
514 SHZ_FORCE_INLINE static void apply_rotation(float angle, const vec3& axis) noexcept {
515 apply_rotation(angle, axis.x, axis.y, axis.z);
516 }
517
518 //! C++ wrapper around shz_xmtrx_apply_rotation_quat().
519 SHZ_FORCE_INLINE static void apply_rotation_quat(const quat& q) noexcept {
521 }
522
523 //! C++ wrapper around shz_xmtrx_apply_lookat().
524 SHZ_FORCE_INLINE static void apply_lookat(const vec3& eye, const vec3& center, const vec3& up) noexcept {
525 shz_xmtrx_apply_lookat(eye, center, up);
526 }
527
528 //! C++ wrapper around shz_xmtrx_apply_ortho().
529 SHZ_FORCE_INLINE static void apply_ortho(float left, float right, float bottom, float top, float znear, float zfar) noexcept {
530 shz_xmtrx_apply_ortho(left, right, bottom, top, znear, zfar);
531 }
532
533 //! C++ wrapper around shz_xmtrx_apply_frustum().
534 SHZ_FORCE_INLINE static void apply_frustum(float left, float right, float bottom, float top, float znear, float zfar) noexcept {
535 shz_xmtrx_apply_frustum(left, right, bottom, top, znear, zfar);
536 }
537
538 //! C++ wrapper around shz_xmtrx_apply_perspective().
539 SHZ_FORCE_INLINE static void apply_perspective(float fov, float aspect, float znear) noexcept {
540 shz_xmtrx_apply_perspective(fov, aspect, znear);
541 }
542
543 //! C++ wrapper around shz_xmtrx_apply_symmetric_skew().
544 SHZ_FORCE_INLINE static void apply_symmetric_skew(float x, float y, float z) noexcept {
546 }
547
548 //! C++ wrapper around shz_xmtrx_apply_screen().
549 SHZ_FORCE_INLINE static void apply_screen(float width, float height) noexcept {
550 shz_xmtrx_apply_screen(width, height);
551 }
552
553 //! C++ wrapper around shz_xmtrx_apply_permutation_wxyz().
554 SHZ_FORCE_INLINE static void apply_permutation_wxyz() noexcept {
556 }
557
558 //! C++ wrapper around shz_xmtrx_apply_permutation_yzwx().
559 SHZ_FORCE_INLINE static void apply_permutation_yzwx() noexcept {
561 }
562
563 //! C++ wrapper around shz_xmtrx_apply_permutation_wzyx().
564 SHZ_FORCE_INLINE static void apply_permutation_wzyx() noexcept {
566 }
567
568 //! C++ wrapper around shz_xmtrx_apply_self().
569 SHZ_FORCE_INLINE static void apply_self() noexcept {
571 }
572
573//! @}
574
575/*! \name OpenGL Operations
576 \brief OpenGL-style matrix transformation operations.
577 @{
578*/
579
580 //! C++ wrapper around shz_xmtrx_translate().
581 SHZ_FORCE_INLINE static void translate(float x, float y, float z) noexcept {
583 }
584
585 //! C++ wrapper around shz_xmtrx_translate().
586 SHZ_FORCE_INLINE static void translate(vec3 v) noexcept {
587 translate(v.x, v.y, v.z);
588 }
589
590 //! C++ wrapper around shz_xmtrx_scale().
591 SHZ_FORCE_INLINE static void scale(float x, float y, float z) noexcept {
593 }
594
595 //! C++ wrapper around shz_xmtrx_scale().
596 SHZ_FORCE_INLINE static void scale(vec3 v) noexcept {
597 scale(v.x, v.y, v.z);
598 }
599
600 //! C++ wrapper around shz_xmtrx_rotate_x().
601 SHZ_FORCE_INLINE static void rotate_x(float radians) noexcept {
603 }
604
605 //! C++ wrapper around shz_xmtrx_rotate_x().
606 SHZ_FORCE_INLINE static void rotate_y(float radians) noexcept {
608 }
609
610 //! C++ wrapper around shz_xmtrx_rotate_x().
611 SHZ_FORCE_INLINE static void rotate_z(float radians) noexcept {
613 }
614
615 //! C++ wrapper around shz_xmtrx_rotate_xyz().
616 SHZ_FORCE_INLINE static void rotate_xyz(float x, float y, float z) noexcept {
618 }
619
620 //! C++ wrapper around shz_xmtrx_rotate_zyx().
621 SHZ_FORCE_INLINE static void rotate_zyx(float z, float y, float x) noexcept {
623 }
624
625 //! C++ wrapper around shz_xmtrx_rotate_zxy().
626 SHZ_FORCE_INLINE static void rotate_zxy(float z, float x, float y) noexcept {
628 }
629
630 //! C++ wrapper around shz_xmtrx_rotate_yxz().
631 SHZ_FORCE_INLINE static void rotate_yxz(float y, float x, float z) noexcept {
633 }
634
635 //! C++ wrapper around shz_xmtrx_rotate().
636 SHZ_FORCE_INLINE static void rotate(float radians, float x, float y, float z) noexcept {
637 shz_xmtrx_rotate(radians, x, y, z);
638 }
639
640 //! C++ wrapper around shz_xmtrx_rotate().
641 SHZ_FORCE_INLINE static void rotate(float radians, const vec3& axis) noexcept {
642 rotate(radians, axis.x, axis.y, axis.z);
643 }
644
645//! @}
646
647/*! \name Compound Operations
648 \brief Multiple operations combined into one pipelined transaction.
649 @{
650*/
651
652 //! C++ wrapper around shz_xmtrx_load_apply_4x4().
653 SHZ_FORCE_INLINE static void load_apply(const shz_mat4x4_t& mat1, const shz_mat4x4_t& mat2) noexcept {
655 }
656
657 //! C++ wrapper around shz_xmtrx_load_apply_unaligned_4x4().
658 SHZ_FORCE_INLINE static void load_apply(const float matrix1[16], const float matrix2[16]) noexcept {
660 }
661
662 //! C++ wrapper around shz_xmtrx_apply_store_4x4().
663 SHZ_FORCE_INLINE static void apply_store(shz_mat4x4_t* out, const shz_mat4x4_t& in) noexcept {
665 }
666
667 //! C++ wrapper around shz_xmtrx_apply_store_unaligned_4x4().
668 SHZ_FORCE_INLINE static void apply_store(float out[16], const float in[16]) noexcept {
670 }
671
672 //! C++ wrapper around shz_xmtrx_load_apply_store_4x4().
673 SHZ_FORCE_INLINE static void load_apply_store(shz_mat4x4_t* dst, const shz_mat4x4_t& mat1, const shz_mat4x4_t& mat2) noexcept {
675 }
676
677 //! C++ wrapper around shz_xmtrx_load_apply_store_unaligned_4x4().
678 SHZ_FORCE_INLINE static void load_apply_store(float out[16], const float matrix1[16], const float matrix2[16]) noexcept {
680 }
681
682 //! C++ wrapper around shz_xmtrx_load_apply_store_3x4().
683 SHZ_FORCE_INLINE static void load_apply_store(shz_mat3x4_t* dst, const shz_mat3x4_t& mat1, const shz_mat3x4_t& mat2) noexcept {
685 }
686
687 //! C++ wrapper around shz_xmtrx_load_apply_store_3x3().
688 SHZ_FORCE_INLINE static void load_apply_store(shz_mat3x3_t* dst, const shz_mat3x3_t& mat1, const shz_mat3x3_t& mat2) noexcept {
690 }
691
692//! @}
693
694/*! \name Transformations
695 \brief Transforming vectors and points against XMTRX.
696 @{
697*/
698
699 //! C++ wrapper around shz_xmtrx_transform_vec4().
700 SHZ_FORCE_INLINE static vec4 transform(const vec4& in) noexcept {
701 return shz_xmtrx_transform_vec4(in);
702 }
703
704 //! C++ wrapper around shz_xmtrx_transform_vec3().
705 SHZ_FORCE_INLINE static vec3 transform(const vec3& in) noexcept {
706 return shz_xmtrx_transform_vec3(in);
707 }
708
709 //! C++ wrapper around shz_xmtrx_transform_vec2().
710 SHZ_FORCE_INLINE static vec2 transform(const vec2& in) noexcept {
711 return shz_xmtrx_transform_vec2(in);
712 }
713
714 //! C++ wrapper around shz_xmtrx_transform_point3().
715 SHZ_FORCE_INLINE static vec3 transform_point(const vec3& pt) noexcept {
716 return shz_xmtrx_transform_point3(pt);
717 }
718
719 //! C++ wrapper around shz_xmtrx_transform_point2().
720 SHZ_FORCE_INLINE static vec2 transform_point(const vec2& pt) noexcept {
721 return shz_xmtrx_transform_point2(pt);
722 }
723
724//! @}
725
726/*! \name Setters
727 \brief Sets the values of related XMTRX components.
728 @{
729*/
730
731 //! C++ wrapper around shz_xmtrx_set_translation().
732 SHZ_FORCE_INLINE static void set_translation(float x, float y, float z) noexcept {
734 }
735
736 //! C++ wrapper around shz_xmtrx_set_translation().
737 SHZ_FORCE_INLINE void set_translation(const vec3& v) noexcept {
738 set_translation(v.x, v.y, v.z);
739 }
740
741//! @}
742
743/*! \name Getters
744 \brief Gets the values of related XMTRX components.
745 @{
746*/
747
748 //! C++ wrapper around shz_xmtrx_set_translation().
749 SHZ_FORCE_INLINE static vec3 get_translation() noexcept {
751 }
752
753//! @}
754
755/*! \name Miscellaneous
756 \brief Random operations and conversions on XMTRX.
757 @{
758*/
759
760 //! C++ wrapper around shz_xmtrx_add_4x4().
761 SHZ_FORCE_INLINE static void add(const shz_mat4x4_t& mat) noexcept {
763 }
764
765 //! C++ wrapper around shz_xmtrx_sub_4x4().
766 SHZ_FORCE_INLINE static void sub(const shz_mat4x4_t& mat) noexcept {
768 }
769
770 //! C++ wrapper around shz_xmtrx_add_diagonal().
771 SHZ_FORCE_INLINE static void add_diagonal(float x, float y, float z, float w) noexcept {
773 }
774
775 //! C++ wrapper around shz_xmtrx_add_diagonal().
776 SHZ_FORCE_INLINE static void add_diagonal(const vec4& v) noexcept {
777 add_diagonal(v.x, v.y, v.z, v.w);
778 }
779
780 //! C++ wrapper around shz_xmtrx_add_symmetric_skew().
781 SHZ_FORCE_INLINE static void add_symmetric_skew(float x, float y, float z) noexcept {
783 }
784
785 //! C++ wrapper around shz_xmtrx_add_symmetric_skew().
786 SHZ_FORCE_INLINE static void add_symmetric_skew(const vec3& v) noexcept {
787 add_symmetric_skew(v.x, v.y, v.z);
788 }
789
790 //! C++ wrapper around shz_xmtrx_transpose().
791 SHZ_FORCE_INLINE static void transpose() noexcept {
793 }
794
795 //! C++ wrapper around shz_xmtrx_negate().
796 SHZ_FORCE_INLINE static void negate() noexcept {
798 }
799
800 //! C++ wrapper around shz_xmtrx_abs().
801 SHZ_FORCE_INLINE static void abs() noexcept {
803 }
804
805 //! C++ wrapper around shz_xmtrx_to_quat().
806 SHZ_FORCE_INLINE static quat to_quat() noexcept {
807 return shz_xmtrx_to_quat();
808 }
809
810 //! C++ wrapper around shz_xmtrx_determinant().
811 SHZ_FORCE_INLINE static float determinant() noexcept {
813 }
814
815 //! C++ wrapper around shz_xmtrx_invert().
816 SHZ_FORCE_INLINE static void invert() noexcept {
818 }
819
820//! @}
821
822};
823}
824
825#endif
Namespace enclosing the SH4ZAM C++ API.
Definition shz_cdefs.hpp:21
void shz_xmtrx_rotate_z(float radians) SHZ_NOEXCEPT
Multiplies and accumulates XMTRX by a 3D rotation matrix about the Z axis.
float shz_xmtrx_determinant(void) SHZ_NOEXCEPT
Returns the determinant of XMTRX.
void shz_xmtrx_load_transpose_4x4(const shz_mat4x4_t *matrix) SHZ_NOEXCEPT
Loads XMTRX with the transpose of the given 4x4 matrix.
void shz_xmtrx_load_apply_store_4x4(shz_mat4x4_t *out, const shz_mat4x4_t *matrix1, const shz_mat4x4_t *matrix2) SHZ_NOEXCEPT
Loads XMTRX with the 4x4 result of applying matrix2 onto matrix1, storing the result.
void shz_xmtrx_init_ortho(float left, float right, float bottom, float top, float znear, float zfar) SHZ_NOEXCEPT
Initializes XMTRX to an orthographic projection matrix, equivalent to glOrtho().
void shz_xmtrx_init_identity(void) SHZ_NOEXCEPT
Quickly initializes XMTRX to be a 4D identity matrix.
shz_quat_t shz_xmtrx_to_quat(void) SHZ_NOEXCEPT
Constructs a quaternion from the 3D rotation matrix within XMTRX.
void shz_xmtrx_apply_rotation_zxy(float zAngle, float xAngle, float yAngle) SHZ_NOEXCEPT
Multiplies and accumulates XMTRX by a 3D Z-X-Y rotation matrix, with the corresponding angles given i...
void shz_xmtrx_rotate_xyz(float xRadians, float yRadians, float zRadians) SHZ_NOEXCEPT
Multiplies and accumulates XMTRX by 3D rotation matrices about the X then Y then Z axes.
void shz_xmtrx_load_apply_store_3x4(shz_mat3x4_t *out, const shz_mat3x4_t *matrix1, const shz_mat3x4_t *matrix2) SHZ_NOEXCEPT
Loads XMTRX with the 3x4 result of applying matrix2 onto matrix1, storing the result.
void shz_xmtrx_load_rows_4x4(const shz_vec4_t *r1, const shz_vec4_t *r2, const shz_vec4_t *r3, const shz_vec4_t *r4) SHZ_NOEXCEPT
Sets XMTRX equal to the 4x4 matrix created from the 4 given 4D row vectors.
void shz_xmtrx_init_fill(float value) SHZ_NOEXCEPT
Initializes XMTRX to contain the given value for each element.
void shz_xmtrx_apply_rotation_zyx(float zAngle, float yAngle, float xAngle) SHZ_NOEXCEPT
Multiplies and accumulates XMTRX by a 3D Z-Y-X rotation matrix, with the corresponding angles given i...
void shz_xmtrx_rotate_y(float radians) SHZ_NOEXCEPT
Multiplies and accumulates XMTRX by a 3D rotation matrix about the Y axis.
void shz_xmtrx_load_transpose_unaligned_4x4(const float matrix[16]) SHZ_NOEXCEPT
Loads XMTRX with the transpose of the 4x4 matrix created from the given unaligned array of 16 floats.
void shz_xmtrx_apply_rotation_y(float y) SHZ_NOEXCEPT
Transforms the values of the inner 3x3 matrix by a rotation matrix of y radians about the Y axis.
void shz_xmtrx_init_translation(float x, float y, float z) SHZ_NOEXCEPT
Initializes XMTRX to be a 3D translation matrix to the given coordinates.
void shz_xmtrx_rotate_zxy(float zRadians, float xRadians, float yRadians) SHZ_NOEXCEPT
Multiplies and accumulates XMTRX by 3D rotation matrices about the Z then X then Y axes.
void shz_xmtrx_apply_store_unaligned_4x4(float out[16], const float in[16]) SHZ_NOEXCEPT
Multiplies XMTRX by the unaligned matrix, in, storing the result within the unaligned matrix,...
void shz_xmtrx_apply_permutation_wzyx(void) SHZ_NOEXCEPT
Multiplies and accumulates a permutation matrix, which reorders the components of transformed vectors...
void shz_xmtrx_rotate_x(float radians) SHZ_NOEXCEPT
Multiplies and accumulates XMTRX by a 3D rotation matrix about the X axis.
void shz_xmtrx_init_rotation(float angle, float xAxis, float yAxis, float zAxis) SHZ_NOEXCEPT
Initializes XMTRX to a 3D rotation matrix of angle radians about the given axis.
void shz_xmtrx_apply_reverse_4x4(const shz_mat4x4_t *matrix) SHZ_NOEXCEPT
Multiplies and accumulates XMTRX onto matrix, storing the result as XMTRX.
float shz_xmtrx_read(shz_xmtrx_reg_t xf) SHZ_NOEXCEPT
Returns the floating-point value held within the given XMTRX register.
void shz_xmtrx_load_wxyz_4x4(const shz_mat4x4_t *matrix) SHZ_NOEXCEPT
Loads the given 4x4 matrix as XMTRX, with the 4th column for translation being loaded as the first co...
void shz_xmtrx_apply_screen(float width, float height) SHZ_NOEXCEPT
Multiplies and accumulates the viewport matrix created with the given components.
void shz_xmtrx_store_4x4(shz_mat4x4_t *matrix) SHZ_NOEXCEPT
Stores the current values held within XMTRX into the given 4x4 matrix.
void shz_xmtrx_load_4x4(const shz_mat4x4_t *matrix) SHZ_NOEXCEPT
Loads the given 4x4 matrix as XMTRX.
void shz_xmtrx_apply_transpose_unaligned_4x4(const float matrix[16]) SHZ_NOEXCEPT
Multiplies and accumulates the transpose of the given 16-entry float array as a 4x4 matrix onto XMTRX...
void shz_xmtrx_set_translation(float x, float y, float z) SHZ_NOEXCEPT
Sets only the translational components of XMTRX to the given values.
@ SHZ_XMTRX_XF8
FP register xf8.
Definition shz_xmtrx.h:77
@ SHZ_XMTRX_XF9
FP register xf9.
Definition shz_xmtrx.h:78
@ SHZ_XMTRX_XF12
FP register xf12.
Definition shz_xmtrx.h:81
@ SHZ_XMTRX_XF11
FP register xf11.
Definition shz_xmtrx.h:80
@ SHZ_XMTRX_XF14
FP register xf14.
Definition shz_xmtrx.h:83
@ SHZ_XMTRX_XF3
FP register xf3.
Definition shz_xmtrx.h:72
@ SHZ_XMTRX_XF6
FP register xf6.
Definition shz_xmtrx.h:75
@ SHZ_XMTRX_XF4
FP register xf4.
Definition shz_xmtrx.h:73
@ SHZ_XMTRX_XF13
FP register xf13.
Definition shz_xmtrx.h:82
@ SHZ_XMTRX_XF10
FP register xf10.
Definition shz_xmtrx.h:79
@ SHZ_XMTRX_XF2
FP register xf2.
Definition shz_xmtrx.h:71
@ SHZ_XMTRX_XF0
FP register xf0.
Definition shz_xmtrx.h:69
@ SHZ_XMTRX_XF5
FP register xf5.
Definition shz_xmtrx.h:74
@ SHZ_XMTRX_XF7
FP register xf7.
Definition shz_xmtrx.h:76
@ SHZ_XMTRX_XF15
FP register xf15.
Definition shz_xmtrx.h:84
@ SHZ_XMTRX_XF1
FP register xf1.
Definition shz_xmtrx.h:70
void shz_xmtrx_add_4x4(const shz_mat4x4_t *mat) SHZ_NOEXCEPT
Adds each element within mat to each element within XMTRX, storing the result in XMTRX.
void shz_xmtrx_init_permutation_wxyz(void) SHZ_NOEXCEPT
Initializes XMTRX to a permutation matrix, which reorders the components of transformed vectors to be...
void shz_xmtrx_invert(void) SHZ_NOEXCEPT
Inverts XMTRX in-place.
void shz_xmtrx_load_apply_4x4(const shz_mat4x4_t *matrix1, const shz_mat4x4_t *matrix2) SHZ_NOEXCEPT
Loads XMTRX with the result of applying matrix2 onto matrix1.
void shz_xmtrx_translate(float x, float y, float z) SHZ_NOEXCEPT
Multiplies and accumulates XMTRX by a 3D translation matrix with the given components (glTranslatef()...
shz_vec4_t shz_xmtrx_read_row(unsigned int index) SHZ_NOEXCEPT
Returns the values at the the given row index, as a 4D vector.
void shz_xmtrx_rotate_zyx(float zRadians, float yRadians, float xRadians) SHZ_NOEXCEPT
Multiplies and accumulates XMTRX by 3D rotation matrices about the Z then Y then X axes.
void shz_xmtrx_apply_permutation_yzwx(void) SHZ_NOEXCEPT
Multiplies and accumulates a permutation matrix, which reorders the components of transformed vectors...
void shz_xmtrx_init_rotation_z(float z) SHZ_NOEXCEPT
Initializes XMTRX to be a 3D rotation matrix by z radians about the Z axis.
void shz_xmtrx_rotate_yxz(float yRadians, float xRadians, float zRadians) SHZ_NOEXCEPT
Multiplies and accumulates XMTRX by 3D rotation matrices about the Y then X then Z axes.
void shz_xmtrx_apply_ortho(float left, float right, float bottom, float top, float znear, float zfar) SHZ_NOEXCEPT
Applies a 2D orthographic projection matrix onto XMTRX, equivalent to glOrtho().
void shz_xmtrx_apply_3x4(const shz_mat3x4_t *matrix) SHZ_NOEXCEPT
Multiplies and accumulates the given 3x4 matrix onto XMTRX, not modifying other elements.
void shz_xmtrx_apply_translation(float x, float y, float z) SHZ_NOEXCEPT
Adds the values of the given 3 components to the 3D translation components of XMTRX.
void shz_xmtrx_apply_rotation(float angle, float x, float y, float z) SHZ_NOEXCEPT
Transforms the values of the inner 3x3 matrix by a rotation matrix of angle radians about the axis wi...
void shz_xmtrx_abs(void) SHZ_NOEXCEPT
Takes the absolute value of each element held within XMTRX.
void shz_xmtrx_apply_permutation_wxyz(void) SHZ_NOEXCEPT
Multiplies and accumulates a permutation matrix, which reorders the components of transformed vectors...
void shz_xmtrx_apply_frustum(float left, float right, float bottom, float top, float znear, float zfar) SHZ_NOEXCEPT
Applies a frustum projection matrix onto XMTRX, equivalent to glFrustum().
void shz_xmtrx_init_frustum(float left, float right, float bottom, float top, float znear, float zfar) SHZ_NOEXCEPT
Initializes XMTRX to a frustum projection matrix, equivalent to glFrustum().
void shz_xmtrx_apply_unaligned_4x4(const float matrix[16]) SHZ_NOEXCEPT
Multiplies and accumulates the given 16-entry float array as a 4x4 matrix onto XMTRX.
void shz_xmtrx_load_cols_4x4(const shz_vec4_t *c1, const shz_vec4_t *c2, const shz_vec4_t *c3, const shz_vec4_t *c4) SHZ_NOEXCEPT
Sets XMTRX equal to the 4x4 matrix created from the 4 given 4D column vectors.
void shz_xmtrx_store_transpose_4x4(shz_mat4x4_t *matrix) SHZ_NOEXCEPT
Stores the transpose of the current values held within XMTRX into the given 4x4 matrix.
void shz_xmtrx_apply_self(void) SHZ_NOEXCEPT
Multiplies and accumulatse the XMTRX matrix by itself, squaring it.
void shz_xmtrx_load_apply_unaligned_4x4(const float matrix1[16], const float matrix2[16]) SHZ_NOEXCEPT
Loads XMTRX with the result of applying unaligned matrix2 onto matrix1.
void shz_xmtrx_transpose(void) SHZ_NOEXCEPT
Transposes the elements within XMTRX, in-place.
void shz_xmtrx_apply_rotation_z(float z) SHZ_NOEXCEPT
Transforms the values of the inner 3x3 matrix by a rotation matrix of z radians about the Z axis.
void shz_xmtrx_load_unaligned_4x4(const float matrix[16]) SHZ_NOEXCEPT
Loads the given array of unaligned 16 float values as the 4x4 XMTRX matrix.
void shz_xmtrx_init_permutation_wzyx(void) SHZ_NOEXCEPT
Initializes XMTRX to a permutation matrix, which reorders the components of transformed vectors to be...
void shz_xmtrx_scale(float x, float y, float z) SHZ_NOEXCEPT
Multiplies and accumulates XMTRX by a 3D scaling matrix with the given components (glScalef() equival...
void shz_xmtrx_init_symmetric_skew(float x, float y, float z) SHZ_NOEXCEPT
Initializes XMTRX to be the 3D symmetric skew matrix formed from the given vector components.
void shz_xmtrx_load_3x4(const shz_mat3x4_t *matrix) SHZ_NOEXCEPT
Loads the given 3x4 matrix into XMTRX, initializing its remaining elements to identity.
void shz_xmtrx_apply_rotation_quat(shz_quat_t quat) SHZ_NOEXCEPT
Transforms the values of the inner 3x3 matrix by the rotation matrix represented by the given quatern...
void shz_xmtrx_store_unaligned_4x4(float matrix[16]) SHZ_NOEXCEPT
Stores the current values held within XMTRX into the given unaligned 16-float array.
void shz_xmtrx_init_rotation_quat(shz_quat_t q) SHZ_NOEXCEPT
Initializes XMTRX to a 3D rotation matrix with its orientation given by a quaternion.
void shz_xmtrx_apply_4x4(const shz_mat4x4_t *matrix) SHZ_NOEXCEPT
Multiplies and accumulates the given 4x4 matrix onto XMTRX.
void shz_xmtrx_apply_rotation_yxz(float yAngle, float xAngle, float zAngle) SHZ_NOEXCEPT
Multiplies and accumulates XMTRX by a 3D Y-X-Z rotation matrix, with the corresponding angles given i...
void shz_xmtrx_init_rotation_x(float x) SHZ_NOEXCEPT
Initializes XMTRX to be a 3D rotation matrix by x radians about the X axis.
void shz_xmtrx_apply_perspective(float fov, float aspect, float znear) SHZ_NOEXCEPT
Multiplies and accumulates the perspective matrix constructed from the given values onto XMTRX.
void shz_xmtrx_init_scale(float x, float y, float z) SHZ_NOEXCEPT
Initializes XMTRX to be a 3D scale matrix with the given dimensions.
void shz_xmtrx_store_3x4(shz_mat3x4_t *matrix) SHZ_NOEXCEPT
Stores the top-left 3x4 values currently held within XMTRX into the given matrix.
void shz_xmtrx_init_diagonal(float x, float y, float z, float w) SHZ_NOEXCEPT
Initializes XMTRX to be a diagonal matrix with the given diagonal values.
void shz_xmtrx_write(shz_xmtrx_reg_t xf, float value) SHZ_NOEXCEPT
Sets the floating-point value held within the given XMTRX register to value.
void shz_xmtrx_init_identity_safe(void) SHZ_NOEXCEPT
Safely initializes XMTRX to be a 4D identity matrix.
void shz_xmtrx_load_apply_store_3x3(shz_mat3x3_t *out, const shz_mat3x3_t *matrix1, const shz_mat3x3_t *matrix2) SHZ_NOEXCEPT
Loads XMTRX with the 3x3 result of applying matrix2 onto matrix1, storing the result.
void shz_xmtrx_init_screen(float width, float height) SHZ_NOEXCEPT
Initializes XMTRX to the viewport matrix with the given dimensions.
void shz_xmtrx_sub_4x4(const shz_mat4x4_t *mat) SHZ_NOEXCEPT
Subtracts each element within mat from each element within XMTRX, storing the result in XMTRX.
void shz_xmtrx_swap_rows(unsigned int index1, unsigned int index2) SHZ_NOEXCEPT
Swaps the values of the rows with the given indices.
void shz_xmtrx_add_symmetric_skew(float x, float y, float z) SHZ_NOEXCEPT
Adds the values of a 3D symmetric skew matrix constructed from the given components to XMTRX.
void shz_xmtrx_store_transpose_unaligned_4x4(float matrix[16]) SHZ_NOEXCEPT
Stores the transpose of the the current values held within XMTRX into the given 16-element float arra...
void shz_xmtrx_apply_reverse_transpose_unaligned_4x4(const float matrix[16]) SHZ_NOEXCEPT
Multiplies and accumulates XMTRX onto the transpose of the given float array as a 4x4 matrix,...
void shz_xmtrx_apply_rotation_x(float x) SHZ_NOEXCEPT
Transforms the values of the inner 3x3 matrix by a rotation matrix of x radians about the X axis.
void shz_xmtrx_apply_scale(float x, float y, float z) SHZ_NOEXCEPT
Multiplies the values of the inner 3x3 matrix by the given 3D scaling terms.
void shz_xmtrx_load_apply_store_unaligned_4x4(float out[16], const float matrix1[16], const float matrix2[16]) SHZ_NOEXCEPT
Loads XMTRX with the result of applying unaligned matrix2 onto unaligned matrix1, storing the result.
void shz_xmtrx_init_rotation_xyz(float xAngle, float yAngle, float zAngle) SHZ_NOEXCEPT
Initializes XMTRX to be a 3D X-Y-Z rotation matrix, with the corresponding angles given in radians.
void shz_xmtrx_add_diagonal(float x, float y, float z, float w) SHZ_NOEXCEPT
Adds the values of a 4D diagonal matrix constructed from the given components to XMTRX.
void shz_xmtrx_init_rotation_zyx(float zAngle, float yAngle, float xAngle) SHZ_NOEXCEPT
Initializes XMTRX to be a 3D Z-Y-X rotation matrix, with the corresponding angles given in radians.
shz_vec4_t shz_xmtrx_read_col(unsigned int index) SHZ_NOEXCEPT
Returns the values at the given column index, as a 4D vector.
void shz_xmtrx_apply_rotation_xyz(float xAngle, float yAngle, float zAngle) SHZ_NOEXCEPT
Multiplies and accumulates XMTRX by a 3D X-Y-Z rotation matrix, with the corresponding angles given i...
void shz_xmtrx_init_rotation_yxz(float yAngle, float xAngle, float zAngle) SHZ_NOEXCEPT
Initializes XMTRX to be a 3D Y-X-Z rotation matrix, with the corresponding angles given in radians.
void shz_xmtrx_init_zero(void) SHZ_NOEXCEPT
Initializes XMTRX to contain the value of 0.0f for each element.
void shz_xmtrx_apply_transpose_4x4(const shz_mat4x4_t *matrix) SHZ_NOEXCEPT
Multiplies and accumulates the transpose of the given 4x4 matrix onto XMTRX.
void shz_xmtrx_negate(void) SHZ_NOEXCEPT
Negates each element held within XMTRX.
void shz_xmtrx_init_rotation_zxy(float zAngle, float xAngle, float yAngle) SHZ_NOEXCEPT
Initializes XMTRX to be a 3D Z-X-Y rotation matrix, with the corresponding angles given in radians.
void shz_xmtrx_init_permutation_yzwx(void) SHZ_NOEXCEPT
Initializes XMTRX to a permutation matrix, which reorders the components of transformed vectors to be...
void shz_xmtrx_apply_store_4x4(shz_mat4x4_t *out, const shz_mat4x4_t *in) SHZ_NOEXCEPT
Multiplies XMTRX by the matrix, in, storing the result within the matrix, out.
shz_vec3_t shz_xmtrx_get_translation(void) SHZ_NOEXCEPT
Returns the translational components from the last column of XMTRX, as a 3D vector.
void shz_xmtrx_apply_reverse_unaligned_4x4(const float matrix[16]) SHZ_NOEXCEPT
Multiplies and accumulates XMTRX onto the given float array as a 4x4 matrix, storing the result as XM...
void shz_xmtrx_swap_cols(unsigned int index1, unsigned int index2) SHZ_NOEXCEPT
Swaps the values of the columns with the given indices.
void shz_xmtrx_apply_reverse_transpose_4x4(const shz_mat4x4_t *matrix) SHZ_NOEXCEPT
Multiplies and accumulates XMTRX onto the transpose of matrix, storing the result as XMTRX.
void shz_xmtrx_apply_symmetric_skew(float x, float y, float z) SHZ_NOEXCEPT
Multiplies and accumulates the 3D symmetric skew matrix with the given components onto XMTRX.
void shz_xmtrx_init_one(void) SHZ_NOEXCEPT
Initializes XMTRX to contain the value of 1.0f for each element.
void shz_xmtrx_init_rotation_y(float y) SHZ_NOEXCEPT
Initializes XMTRX to be a 3D rotation matrix by y radians about the Y axis.
void shz_xmtrx_init_perspective(float fov, float aspect, float znear) SHZ_NOEXCEPT
Initializes XMTRX to a perspective projection matrix.
void shz_xmtrx_rotate(float radians, float xAxis, float yAxis, float zAxis) SHZ_NOEXCEPT
Multiplies and accumulates XMTRX by the 3D rotation matrix formed by the given axis and angle (glRota...
C++ structure representing a quaternion.
Definition shz_quat.hpp:38
2D Vector type
3D Vector type
4D Vector type
Static structure around the 4x4 XMTRX FP register back-bank.
Definition shz_xmtrx.hpp:34
static vec4 read_row(unsigned int index) noexcept
C++ wrapper around shz_xmtrx_read_row().
Definition shz_xmtrx.hpp:75
static void apply_screen(float width, float height) noexcept
C++ wrapper around shz_xmtrx_apply_screen().
static void init_lookat(const vec3 &eye, const vec3 &center, const vec3 &up) noexcept
C++ wrapper around shz_xmtrx_init_lookat().
static void init_symmetric_skew(float x, float y, float z) noexcept
C++ wrapper around shz_xmtrx_init_symmetric_skew().
static void init_translation(float x, float y, float z) noexcept
C++ wrapper around shz_xmtrx_init_translation().
static void rotate_x(float radians) noexcept
C++ wrapper around shz_xmtrx_rotate_x().
static void load_transpose(const std::array< float, 16 > &array) noexcept
C++ wrapper around shz_xmtrx_load_transpose_unaligned_4x4().
static void load_apply_store(shz_mat3x4_t *dst, const shz_mat3x4_t &mat1, const shz_mat3x4_t &mat2) noexcept
C++ wrapper around shz_xmtrx_load_apply_store_3x4().
static void apply_transpose(const shz_mat4x4_t &mat4) noexcept
C++ wrapper around shz_xmtrx_apply_transpose_4x4().
static void load_apply(const float matrix1[16], const float matrix2[16]) noexcept
C++ wrapper around shz_xmtrx_load_apply_unaligned_4x4().
static float read(reg xf) noexcept
C++ wrapper around shz_xmtrx_read().
Definition shz_xmtrx.hpp:65
static void init_zero() noexcept
C++ wrapper around shz_xmtrx_init_zero().
static vec3 get_translation() noexcept
C++ wrapper around shz_xmtrx_set_translation().
static void invert() noexcept
C++ wrapper around shz_xmtrx_invert().
static void load(const shz_mat3x4_t &mat) noexcept
C++ wrapper around shz_xmtrx_load_3x4().
static void init_rotation(float angle, float x, float y, float z) noexcept
C++ wrapper around shz_xmtrx_init_rotation().
static void load_rows(const shz_vec4_t &r1, const shz_vec4_t &r2, const shz_vec4_t &r3, const shz_vec4_t &r4) noexcept
C++ wrapper around shz_xmtrx_load_rows_4x4().
static void apply(const std::array< float, 16 > &array) noexcept
C++ wrapper around shz_xmtrx_apply_unaligned_4x4().
static void load_apply_store(float out[16], const float matrix1[16], const float matrix2[16]) noexcept
C++ wrapper around shz_xmtrx_load_apply_store_unaligned_4x4().
static void write_col(unsigned int index, const vec4 &vector) noexcept
C++ wrapper around shz_xmtrx_write_col().
Definition shz_xmtrx.hpp:90
static void write(reg xf, float value) noexcept
C++ wrapper around shz_xmtrx_write().
Definition shz_xmtrx.hpp:70
static void init_rotation_zyx(float z, float y, float x) noexcept
C++ wrapper around shz_xmtrx_init_rotation_zyx().
static void store_transpose(float cArray[16]) noexcept
C++ wrapper around shz_xmtrx_store_transpose_unaligned_4x4().
static vec2 transform_point(const vec2 &pt) noexcept
C++ wrapper around shz_xmtrx_transform_point2().
static void rotate(float radians, const vec3 &axis) noexcept
C++ wrapper around shz_xmtrx_rotate().
static void init_outer_product(const vec4 &a, const vec4 &b) noexcept
C++ wrapper around shz_xmtrx_init_outer_product().
reg
FP back-bank registers comprising XMTRX.
Definition shz_xmtrx.hpp:37
@ XF9
FP register XF9.
Definition shz_xmtrx.hpp:47
@ XF11
FP register XF11.
Definition shz_xmtrx.hpp:49
@ XF10
FP register XF10.
Definition shz_xmtrx.hpp:48
@ XF4
FP register XF4.
Definition shz_xmtrx.hpp:42
@ XF15
FP register XF15.
Definition shz_xmtrx.hpp:53
@ XF7
FP register XF7.
Definition shz_xmtrx.hpp:45
@ XF13
FP register XF13.
Definition shz_xmtrx.hpp:51
@ XF0
FP register XF0.
Definition shz_xmtrx.hpp:38
@ XF8
FP register XF8.
Definition shz_xmtrx.hpp:46
@ XF1
FP register XF1.
Definition shz_xmtrx.hpp:39
@ XF12
FP register XF12.
Definition shz_xmtrx.hpp:50
@ XF6
FP register XF6.
Definition shz_xmtrx.hpp:44
@ XF3
FP register XF3.
Definition shz_xmtrx.hpp:41
@ XF14
FP register XF14.
Definition shz_xmtrx.hpp:52
@ XF5
FP register XF5.
Definition shz_xmtrx.hpp:43
@ XF2
FP register XF2.
Definition shz_xmtrx.hpp:40
static void add_diagonal(const vec4 &v) noexcept
C++ wrapper around shz_xmtrx_add_diagonal().
static void store_transpose(shz_mat4x4_t *mat) noexcept
C++ wrapper around shz_xmtrx_store_transpose_4x4().
static void apply_transpose(const std::array< float, 16 > &array) noexcept
C++ wrapper around shz_xmtrx_apply_transpose_unaligned_4x4().
static void apply_translation(const vec3 &v) noexcept
C++ wrapper around shz_xmtrx_apply_translation().
static void translate(vec3 v) noexcept
C++ wrapper around shz_xmtrx_translate().
static void apply_store(float out[16], const float in[16]) noexcept
C++ wrapper around shz_xmtrx_apply_store_unaligned_4x4().
static void swap_cols(unsigned int index1, unsigned int index2) noexcept
C++ wrapper around shz_xmtrx_swap_cols().
static void rotate_zyx(float z, float y, float x) noexcept
C++ wrapper around shz_xmtrx_rotate_zyx().
static void add_diagonal(float x, float y, float z, float w) noexcept
C++ wrapper around shz_xmtrx_add_diagonal().
static void store(shz_mat3x4_t *mat) noexcept
C++ wrapper around shz_xmtrx_store_3x4().
static void load_transpose(const float cArray[16]) noexcept
C++ wrapper around shz_xmtrx_load_transpose_unaligned_4x4().
static void store(shz_mat4x4_t *mat) noexcept
C++ wrapper around shz_xmtrx_store_4x4().
static void write_row(unsigned int index, const vec4 &vector) noexcept
C++ wrapper around shz_xmtrx_write_row().
Definition shz_xmtrx.hpp:85
static void init_fill(float value) noexcept
C++ wrapper around shz_xmtrx_init_fill().
static void apply_permutation_yzwx() noexcept
C++ wrapper around shz_xmtrx_apply_permutation_yzwx().
static void init_identity_safe() noexcept
C++ wrapper around shz_xmtrx_init_identity_safe().
static void init_rotation_z(float z) noexcept
C++ wrapper around shz_xmtrx_init_rotation_z().
static void rotate_z(float radians) noexcept
C++ wrapper around shz_xmtrx_rotate_x().
static void init_screen(float width, float height) noexcept
C++ wrapper around shz_xmtrx_init_screen().
static void load(const std::array< float, 16 > &array) noexcept
C++ wrapper around shz_xmtrx_load_unaligned_4x4().
static void store(float cArray[16]) noexcept
C++ wrapper around shz_xmtrx_store_unaligned_4x4().
static void init_permutation_wxyz() noexcept
C++ wrapper around shz_xmtrx_init_permutation_wxyz().
static void init_rotation_y(float y) noexcept
C++ wrapper around shz_xmtrx_init_rotation_y().
static void load_apply_store(shz_mat4x4_t *dst, const shz_mat4x4_t &mat1, const shz_mat4x4_t &mat2) noexcept
C++ wrapper around shz_xmtrx_load_apply_store_4x4().
static void set_translation(float x, float y, float z) noexcept
C++ wrapper around shz_xmtrx_set_translation().
static void apply_reverse(const std::array< float, 16 > &array) noexcept
C++ wrapper around shz_xmtrx_apply_reverse_unaligned_4x4().
static void abs() noexcept
C++ wrapper around shz_xmtrx_abs().
static void store(std::array< float, 16 > *array) noexcept
C++ wrapper around shz_xmtrx_store_unaligned_4x4().
static void load(const shz_mat4x4_t &mat4) noexcept
C++ wrapper around shz_xmtrx_load_4x4().
static void init_one() noexcept
C++ wrapper around shz_xmtrx_init_one().
static void transpose() noexcept
C++ wrapper around shz_xmtrx_transpose().
static void init_translation(const vec3 &v) noexcept
C++ wrapper around shz_xmtrx_init_translation().
static void apply(const float cArray[16]) noexcept
C++ wrapper around shz_xmtrx_apply_unaligned_4x4().
static void init_permutation_yzwx() noexcept
C++ wrapper around shz_xmtrx_init_permutation_yzwx().
static void init_rotation_zxy(float z, float x, float y) noexcept
C++ wrapper around shz_xmtrx_init_rotation_zxy().
static void init_rotation_xyz(float x, float y, float z) noexcept
C++ wrapper around shz_xmtrx_init_rotation_xyz().
static void load_wxyz(const shz_mat4x4_t &mat4) noexcept
C++ wrapper around shz_xmtrx_load_wxyz_4x4().
static void init_diagonal(float x, float y, float z, float w) noexcept
C++ wrapper around shz_xmtrx_init_diagonal().
static vec2 transform(const vec2 &in) noexcept
C++ wrapper around shz_xmtrx_transform_vec2().
static void add(const shz_mat4x4_t &mat) noexcept
C++ wrapper around shz_xmtrx_add_4x4().
void set_translation(const vec3 &v) noexcept
C++ wrapper around shz_xmtrx_set_translation().
static void rotate(float radians, float x, float y, float z) noexcept
C++ wrapper around shz_xmtrx_rotate().
static void apply_rotation_x(float x) noexcept
C++ wrapper around shz_xmtrx_apply_rotation_x().
static void apply_rotation_zxy(float z, float x, float y) noexcept
C++ wrapper around shz_xmtrx_apply_rotation_zxy().
static void apply(const shz_mat4x4_t &mat4) noexcept
C++ wrapper around shz_xmtrx_apply_4x4().
static void load(const float cArray[16]) noexcept
C++ wrapper around shz_xmtrx_load_unaligned_4x4().
static void apply_self() noexcept
C++ wrapper around shz_xmtrx_apply_self().
static void apply_rotation_zyx(float z, float y, float x) noexcept
C++ wrapper around shz_xmtrx_apply_rotation_zyx().
static void scale(vec3 v) noexcept
C++ wrapper around shz_xmtrx_scale().
static void rotate_zxy(float z, float x, float y) noexcept
C++ wrapper around shz_xmtrx_rotate_zxy().
static void scale(float x, float y, float z) noexcept
C++ wrapper around shz_xmtrx_scale().
static void apply_reverse(const shz_mat4x4_t &mat4) noexcept
C++ wrapper around shz_xmtrx_apply_reverse_4x4().
static void negate() noexcept
C++ wrapper around shz_xmtrx_negate().
static vec4 read_col(unsigned int index) noexcept
C++ wrapper around shz_xmtrx_read_col().
Definition shz_xmtrx.hpp:80
static void swap_rows(unsigned int index1, unsigned int index2) noexcept
C++ wrapper around shz_xmtrx_swap_rows().
Definition shz_xmtrx.hpp:95
static void apply_store(shz_mat4x4_t *out, const shz_mat4x4_t &in) noexcept
C++ wrapper around shz_xmtrx_apply_store_4x4().
static void store_transpose(std::array< float, 16 > *array) noexcept
C++ wrapper around shz_xmtrx_store_transpose_unaligned_4x4().
static void init_diagonal(const vec4 &v) noexcept
C++ wrapper around shz_xmtrx_init_diagonal().
static quat to_quat() noexcept
C++ wrapper around shz_xmtrx_to_quat().
static void load_apply_store(shz_mat3x3_t *dst, const shz_mat3x3_t &mat1, const shz_mat3x3_t &mat2) noexcept
C++ wrapper around shz_xmtrx_load_apply_store_3x3().
static void load_transpose(const shz_mat4x4_t &mat4) noexcept
C++ wrapper around shz_xmtrx_load_transpose_4x4().
static void init_perspective(float fov, float aspect, float znear) noexcept
C++ wrapper around shz_xmtrx_init_perspective().
static void init_rotation(float angle, const vec3 &axis) noexcept
C++ wrapper around shz_xmtrx_init_rotation().
static void apply_rotation_z(float z) noexcept
C++ wrapper around shz_xmtrx_apply_rotation_z().
static void init_ortho(float left, float right, float bottom, float top, float znear, float zfar) noexcept
C++ wrapper around shz_xmtrx_init_ortho().
static void init_frustum(float left, float right, float bottom, float top, float znear, float zfar) noexcept
C++ wrapper around shz_xmtrx_init_frustum().
static void init_rotation_quat(const quat &q) noexcept
C++ wrapper around shz_xmtrx_init_rotation_quat().
static void load_cols(const shz_vec4_t &c1, const shz_vec4_t &c2, const shz_vec4_t &c3, const shz_vec4_t &c4) noexcept
C++ wrapper around shz_xmtrx_load_cols_4x4().
static void init_upper_triangular(float col1, const vec2 &col2, const vec3 &col3, const vec4 &col4) noexcept
C++ wrapper around shz_xmtrx_init_upper_triangular().
static void init_rotation_x(float x) noexcept
C++ wrapper around shz_xmtrx_init_rotation_x().
static void sub(const shz_mat4x4_t &mat) noexcept
C++ wrapper around shz_xmtrx_sub_4x4().
static void apply_reverse(const float cArray[16]) noexcept
C++ wrapper around shz_xmtrx_apply_reverse_unaligned_4x4().
static void apply_rotation_yxz(float y, float x, float z) noexcept
C++ wrapper around shz_xmtrx_apply_rotation_yxz().
static void init_permutation_wzyx() noexcept
C++ wrapper around shz_xmtrx_init_permutation_wzyx().
static void translate(float x, float y, float z) noexcept
C++ wrapper around shz_xmtrx_translate().
static void init_rotation_yxz(float y, float x, float z) noexcept
C++ wrapper around shz_xmtrx_init_rotation_yxz().
static void init_identity() noexcept
C++ wrapper around shz_xmtrx_init_identity().
static void apply_ortho(float left, float right, float bottom, float top, float znear, float zfar) noexcept
C++ wrapper around shz_xmtrx_apply_ortho().
static void apply_rotation_xyz(float x, float y, float z) noexcept
C++ wrapper around shz_xmtrx_init_rotation_xyz().
static vec3 transform_point(const vec3 &pt) noexcept
C++ wrapper around shz_xmtrx_transform_point3().
static void apply(const shz_mat3x4_t &mat) noexcept
C++ wrapper around shz_xmtrx_apply_3x4().
static void load_apply(const shz_mat4x4_t &mat1, const shz_mat4x4_t &mat2) noexcept
C++ wrapper around shz_xmtrx_load_apply_4x4().
static void rotate_xyz(float x, float y, float z) noexcept
C++ wrapper around shz_xmtrx_rotate_xyz().
static void apply_permutation_wxyz() noexcept
C++ wrapper around shz_xmtrx_apply_permutation_wxyz().
static void apply_perspective(float fov, float aspect, float znear) noexcept
C++ wrapper around shz_xmtrx_apply_perspective().
static void apply_lookat(const vec3 &eye, const vec3 &center, const vec3 &up) noexcept
C++ wrapper around shz_xmtrx_apply_lookat().
static void init_lower_triangular(const vec4 &col1, const vec3 &col2, const vec2 &col3, float col4) noexcept
C++ wrapper around shz_xmtrx_init_lower_diagonal().
static void apply_permutation_wzyx() noexcept
C++ wrapper around shz_xmtrx_apply_permutation_wzyx().
static void rotate_yxz(float y, float x, float z) noexcept
C++ wrapper around shz_xmtrx_rotate_yxz().
static void apply_rotation_y(float y) noexcept
C++ wrapper around shz_xmtrx_apply_rotation_y().
static vec4 transform(const vec4 &in) noexcept
C++ wrapper around shz_xmtrx_transform_vec4().
static void init_scale(const vec3 &v) noexcept
C++ wrapper around shz_xmtrx_init_scale().
static void apply_rotation_quat(const quat &q) noexcept
C++ wrapper around shz_xmtrx_apply_rotation_quat().
static float determinant() noexcept
C++ wrapper around shz_xmtrx_determinant().
static vec3 transform(const vec3 &in) noexcept
C++ wrapper around shz_xmtrx_transform_vec3().
static void apply_frustum(float left, float right, float bottom, float top, float znear, float zfar) noexcept
C++ wrapper around shz_xmtrx_apply_frustum().
static void apply_reverse_transpose(const float cArray[16]) noexcept
C++ wrapper around shz_xmtrx_apply_reverse_transpose_unaligned_4x4().
static void apply_reverse_transpose(const shz_mat4x4_t &mat4) noexcept
C++ wrapper around shz_xmtrx_apply_reverse_transpose_4x4().
static void init_scale(float x, float y, float z) noexcept
C++ wrapper around shz_xmtrx_init_scale().
static void apply_translation(float x, float y, float z) noexcept
C++ wrapper around shz_xmtrx_apply_translation().
static void add_symmetric_skew(const vec3 &v) noexcept
C++ wrapper around shz_xmtrx_add_symmetric_skew().
static void apply_scale(const vec3 &v) noexcept
C++ wrapper around shz_xmtrx_apply_scale().
static void add_symmetric_skew(float x, float y, float z) noexcept
C++ wrapper around shz_xmtrx_add_symmetric_skew().
static void apply_symmetric_skew(float x, float y, float z) noexcept
C++ wrapper around shz_xmtrx_apply_symmetric_skew().
static void rotate_y(float radians) noexcept
C++ wrapper around shz_xmtrx_rotate_x().
static void apply_transpose(const float cArray[16]) noexcept
C++ wrapper around shz_xmtrx_apply_transpose_unaligned_4x4().
static void apply_scale(float x, float y, float z) noexcept
C++ wrapper around shz_xmtrx_apply_scale().
static void apply_reverse_transpose(const std::array< float, 16 > &array) noexcept
C++ wrapper around shz_xmtrx_apply_reverse_transpose_unaligned_4x4().