wren
Vulkan-based game engine
Loading...
Searching...
No Matches
utils.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <ostream>
4
5
#include "
matrix.hpp
"
6
#include "
vector.hpp
"
7
8
namespace
wren::math
{
9
10
template
<
typename
T, std::
size_t
N>
11
auto
operator<<
(std::ostream& os,
const
Vec<T, N>
& value) -> std::ostream& {
12
os <<
"("
;
13
for
(std::size_t i = 0; i < value.data.size(); i++) {
14
os << value.data.at(i);
15
if
(i < value.data.size() - 1) os <<
","
;
16
}
17
os <<
")"
;
18
19
return
os;
20
}
21
22
template
<
typename
T, std::
size_t
Rows, std::
size_t
Cols>
23
auto
operator<<
(std::ostream& os,
const
Mat<T, Rows, Cols>
& value)
24
-> std::ostream& {
25
os <<
"\n("
;
26
27
for
(std::size_t r = 0; r < Rows; ++r) {
28
for
(std::size_t c = 0; c < Cols; ++c) {
29
os << value.at(c, r);
30
if
(c < Cols - 1) os <<
","
;
31
}
32
33
if
(r < Rows - 1) os <<
"\n"
;
34
}
35
os <<
")"
;
36
return
os;
37
}
38
39
}
// namespace wren::math
wren::math::Mat
Definition
matrix.hpp:13
matrix.hpp
wren::math
Definition
geometry.hpp:8
wren::math::operator<<
auto operator<<(std::ostream &os, const Vec< T, N > &value) -> std::ostream &
Definition
utils.hpp:11
wren::math::Vec
Definition
vector.hpp:9
vector.hpp
wren_math
include
wren
math
utils.hpp
Generated by
1.10.0