source: trunk/vizservers/nanovis/Grid.h @ 916

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