nngn
Loading...
Searching...
No Matches
mat3.h
Go to the documentation of this file.
1#ifndef NNGN_MATH_MAT3_H
2#define NNGN_MATH_MAT3_H
3
4#include <type_traits>
5
6#include "mat.h"
7#include "vec3.h"
8
9namespace nngn {
10
11template<typename T>
12struct mat3_base : mat<mat3_base, T, 3> {
13 constexpr mat3_base(void) = default;
14 explicit constexpr mat3_base(T diag);
15 constexpr mat3_base(vec3 col0, vec3 col1, vec3 col2);
16 constexpr mat3_base(
17 T v0, T v1, T v2,
18 T v3, T v4, T v5,
19 T v6, T v7, T v8);
20};
21
22template<typename T>
23inline constexpr mat3_base<T>::mat3_base(T diag) {
24 this->m = {
25 diag, 0, 0,
26 0, diag, 0,
27 0, 0, diag,
28 };
29}
30
31template<typename T>
32inline constexpr mat3_base<T>::mat3_base(vec3 col0, vec3 col1, vec3 col2) {
33 this->m = {
34 col0[0], col0[1], col0[2],
35 col1[0], col1[1], col1[2],
36 col2[0], col2[1], col2[2],
37 };
38}
39
40template<typename T>
41inline constexpr mat3_base<T>::mat3_base(
42 T v0, T v1, T v2,
43 T v3, T v4, T v5,
44 T v6, T v7, T v8)
45{
46 this->m = {v0, v1, v2, v3, v4, v5, v6, v7, v8};
47}
48
53
54}
55
56#endif
#define T(f0, f1, f2)
Definition audio.cpp:7
local m
Definition input.lua:28
Definition mat3.h:12
constexpr mat3_base(void)=default
Definition mat.h:11