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