Toggle navigation
ivorium
iv_components
Example project
GitHub
Main Page
Modules
Classes
Files
File List
File Members
ivorium_graphics
Elements
Axis.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <
ivorium_core/ivorium_core.hpp
>
4
5
namespace
iv
6
{
7
8
enum class
Axis
9
{
10
X
,
11
Y
,
12
Z
,
13
_Size
14
};
15
16
enum class
AxisOrder
17
{
18
Incremental
,
19
Decremental
,
20
};
21
22
enum class
AxisDirection
23
{
24
X_Inc
,
25
X_Dec
,
26
Y_Inc
,
27
Y_Dec
,
28
Z_Inc
,
29
Z_Dec
,
30
};
31
32
33
template
<>
34
struct
StringIO
<
Axis
> :
public
StringIO_Table
< Axis >
35
{
36
static
const
ValuesType
Values
;
37
};
38
39
template
<>
40
struct
StringIO
<
AxisOrder
> :
public
StringIO_Table
< AxisOrder >
41
{
42
static
const
ValuesType
Values
;
43
};
44
45
template
<>
46
struct
StringIO
<
AxisDirection
> :
public
StringIO_Table
< AxisDirection >
47
{
48
static
const
ValuesType
Values
;
49
};
50
51
52
inline
float
&
float3_Axis
(
float3
& vec,
Axis
axis )
53
{
54
if
( axis ==
Axis::X
)
55
return
vec.x;
56
else
if
( axis ==
Axis::Y
)
57
return
vec.y;
58
else
59
return
vec.z;
60
}
61
62
inline
float
const
&
float3_Axis
(
float3
const
& vec,
Axis
axis )
63
{
64
if
( axis ==
Axis::X
)
65
return
vec.x;
66
else
if
( axis ==
Axis::Y
)
67
return
vec.y;
68
else
69
return
vec.z;
70
}
71
72
template
<
class
Callable >
73
inline
void
foreach_axis
( Callable c )
74
{
75
c(
Axis::X
);
76
c(
Axis::Y
);
77
c(
Axis::Z
);
78
}
79
80
}