1 | #ifndef _AXIS_H_ |
---|
2 | #define _AXIS_H_ |
---|
3 | |
---|
4 | #include <R2/R2Fonts.h> |
---|
5 | #include "Vector3.h" |
---|
6 | |
---|
7 | class Grid { |
---|
8 | Vector3 __axisScale; |
---|
9 | |
---|
10 | Vector3 _axisColor; |
---|
11 | Vector3 _gridLineColor; |
---|
12 | Vector3 _axisMax; |
---|
13 | Vector3 _axisMin; |
---|
14 | Vector3 _axisGridLineCount; |
---|
15 | R2Fonts* _font; |
---|
16 | bool _showGrid; |
---|
17 | bool _visible; |
---|
18 | |
---|
19 | R2string _axisName[3]; |
---|
20 | |
---|
21 | public : |
---|
22 | Grid(); |
---|
23 | public : |
---|
24 | bool isVisible() const; |
---|
25 | void render(); |
---|
26 | |
---|
27 | void setMin(const Vector3& min); |
---|
28 | void setMax(const Vector3& max); |
---|
29 | |
---|
30 | void setFont(R2Fonts* font); |
---|
31 | void setVisible(bool visible); |
---|
32 | |
---|
33 | void setGridLineCount(int x, int y, int z); |
---|
34 | void setAxisColor(float r, float g, float b); |
---|
35 | void setGridLineColor(float r, float g, float b); |
---|
36 | void setMinMax(const Vector3& min, const Vector3& max); |
---|
37 | void setAxisName(int axisID, const char* name); |
---|
38 | }; |
---|
39 | |
---|
40 | inline bool Grid::isVisible() const |
---|
41 | { |
---|
42 | return _visible; |
---|
43 | } |
---|
44 | |
---|
45 | inline void Grid::setMin(const Vector3& min) |
---|
46 | { |
---|
47 | _axisMin = min; |
---|
48 | __axisScale = _axisMax - _axisMin; |
---|
49 | } |
---|
50 | |
---|
51 | inline void Grid::setMax(const Vector3& max) |
---|
52 | { |
---|
53 | _axisMax = max; |
---|
54 | __axisScale = _axisMax - _axisMin; |
---|
55 | } |
---|
56 | |
---|
57 | inline void Grid::setVisible(bool visible) |
---|
58 | { |
---|
59 | _visible = visible; |
---|
60 | } |
---|
61 | |
---|
62 | inline void Grid::setGridLineCount(int x, int y, int z) |
---|
63 | { |
---|
64 | _axisGridLineCount.x = x; |
---|
65 | _axisGridLineCount.y = y; |
---|
66 | _axisGridLineCount.z = z; |
---|
67 | } |
---|
68 | |
---|
69 | inline void Grid::setAxisColor(float r, float g, float b) |
---|
70 | { |
---|
71 | _axisColor.x = r; |
---|
72 | _axisColor.y = g; |
---|
73 | _axisColor.z = b; |
---|
74 | } |
---|
75 | |
---|
76 | inline void Grid::setGridLineColor(float r, float g, float b) |
---|
77 | { |
---|
78 | _gridLineColor.x = r; |
---|
79 | _gridLineColor.y = g; |
---|
80 | _gridLineColor.z = b; |
---|
81 | } |
---|
82 | |
---|
83 | inline void Grid::setMinMax(const Vector3& min, const Vector3& max) |
---|
84 | { |
---|
85 | _axisMin = min; |
---|
86 | _axisMax = max; |
---|
87 | __axisScale = _axisMax - _axisMin; |
---|
88 | } |
---|
89 | |
---|
90 | inline void Grid::setAxisName(int axisID, const char* name) |
---|
91 | { |
---|
92 | if (axisID >= 0 && axisID < 3) |
---|
93 | { |
---|
94 | _axisName[axisID] = name; |
---|
95 | } |
---|
96 | } |
---|
97 | |
---|
98 | |
---|
99 | #endif |
---|