Mathter
A configurable 3D math library for game developers.
Mathter
Vector
VectorConcat.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include "
VectorImpl.hpp
"
4
5
namespace
mathter
{
6
7
9
template
<
class
T,
int
Dim,
bool
Packed,
class
U>
10
mathter::Vector<T, Dim + 1, Packed>
operator|
(
const
mathter::Vector<T, Dim, Packed>
& lhs, U rhs) {
11
mathter::Vector<T, Dim + 1, Packed>
ret;
12
for
(
int
i = 0; i < Dim; ++i) {
13
ret(i) = lhs(i);
14
}
15
ret(Dim) = rhs;
16
return
ret;
17
}
18
20
template
<
class
T1,
int
Dim1,
class
T2,
int
Dim2,
bool
Packed>
21
mathter::Vector<T1, Dim1 + Dim2, Packed>
operator|
(
const
mathter::Vector<T1, Dim1, Packed>
& lhs,
const
mathter::Vector<T2, Dim2, Packed>
& rhs) {
22
mathter::Vector<T1, Dim1 + Dim2, Packed>
ret;
23
for
(
int
i = 0; i < Dim1; ++i) {
24
ret(i) = lhs(i);
25
}
26
for
(
int
i = 0; i < Dim2; ++i) {
27
ret(Dim1 + i) = rhs(i);
28
}
29
return
ret;
30
}
31
33
template
<
class
T,
int
Dim,
bool
Packed,
class
U>
34
mathter::Vector<T, Dim + 1, Packed>
operator|
(U lhs,
const
mathter::Vector<T, Dim, Packed>
& rhs) {
35
mathter::Vector<T, Dim + 1, Packed>
ret;
36
ret(0) = lhs;
37
for
(
int
i = 0; i < Dim; ++i) {
38
ret(i + 1) = rhs(i);
39
}
40
return
ret;
41
}
42
44
template
<
class
T1,
int
... Indices1,
class
T2,
int
... Indices2>
45
Vector
<T1,
sizeof
...(Indices2) +
sizeof
...(Indices2),
false
>
operator|
(
const
Swizzle<T1, Indices1...>
& lhs,
const
Swizzle<T2, Indices2...>
& rhs) {
46
return
Vector
<T1,
sizeof
...(Indices1),
false
>(lhs) |
Vector
<T1,
sizeof
...(Indices2),
false
>(rhs);
47
}
49
template
<
class
T1,
int
... Indices1,
class
T2,
int
Dim,
bool
Packed>
50
Vector
<T1,
sizeof
...(Indices1) + Dim, Packed>
operator
|(
const
Swizzle<T1, Indices1...>
& lhs,
const
Vector<T2, Dim, Packed>
& rhs) {
51
return
Vector
<T1,
sizeof
...(Indices1), Packed>(lhs) | rhs;
52
}
54
template
<
class
T1,
int
... Indices1,
class
T2,
int
Dim,
bool
Packed>
55
Vector
<T1,
sizeof
...(Indices1) + Dim, Packed>
operator
|(
const
Vector<T2, Dim, Packed>
& lhs,
const
Swizzle<T1, Indices1...>
& rhs) {
56
return
lhs |
Vector
<T1,
sizeof
...(Indices1),
false
>(rhs);
57
}
59
template
<
class
T1,
int
... Indices1,
class
U>
60
Vector
<T1,
sizeof
...(Indices1) + 1,
false
>
operator
|(
const
Swizzle<T1, Indices1...>
& lhs, U rhs) {
61
return
Vector
<T1,
sizeof
...(Indices1),
false
>(lhs) | rhs;
62
}
64
template
<
class
T1,
int
... Indices1,
class
U>
65
Vector
<T1,
sizeof
...(Indices1) + 1,
false
>
operator
|(U lhs,
const
Swizzle<T1, Indices1...>
& rhs) {
66
return
lhs |
Vector
<T1,
sizeof
...(Indices1),
false
>(rhs);
67
}
68
69
70
}
// namespace mathter
mathter::Vector
Represents a vector in N-dimensional space.
Definition:
Definitions.hpp:57
mathter::Swizzle
Enables element swizzling (reordering elements) for vectors.
Definition:
Definitions.hpp:60
mathter
Definition:
Approx.hpp:11
VectorImpl.hpp
mathter::operator|
mathter::Vector< T, Dim+1, Packed > operator|(const mathter::Vector< T, Dim, Packed > &lhs, U rhs)
Concatenates the arguments, and returns the concatenated vector.
Definition:
VectorConcat.hpp:10
Generated by
1.8.13