-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDOF.cpp
More file actions
134 lines (113 loc) · 2.27 KB
/
Copy pathDOF.cpp
File metadata and controls
134 lines (113 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#include "DOF.h"
QHash<DOF::Type, QString> DOF::_names;
DOF::DOF(Type type, bool enabled)
{
if (_names.isEmpty()) {
_names[DOF::RotationX] = "Rotation X";
_names[DOF::RotationY] = "Rotation Y";
_names[DOF::RotationZ] = "Rotation Z";
_names[DOF::TranslationX] = "Translation X";
_names[DOF::TranslationY] = "Translation Y";
_names[DOF::TranslationZ] = "Translation Z";
_names[DOF::ColorR] = "Color R";
_names[DOF::ColorG] = "Color G";
_names[DOF::ColorB] = "Color B";
_names[DOF::ColorA] = "Color A";
_names[DOF::Diffuse] = "Diffuse";
_names[DOF::Specular] = "Specular";
_names[DOF::MorphTarget] = "Level";
_names[DOF::Speed] = "Speed";
_names[DOF::WindX] = "Wind X";
_names[DOF::WindY] = "Wind Y";
_names[DOF::WindZ] = "Wind Z";
_names[DOF::Density] = "Density";
_names[DOF::DragCoef] = "Drag Coef";
_names[DOF::Friction] = "Friction";
_names[DOF::Elasticity] = "Elasticity";
}
_hasMin = false;
_min = 0;
_hasMax = false;
_max = 0;
_value = 0;
_enabled = enabled;
_type = type;
_name = _names[type];
}
DOF::~DOF()
{
}
float DOF::value() const
{
return _value;
}
void DOF::setValue(float val)
{
if (_hasMin && val < _min)
val = _min;
else if (_hasMax && val > _max)
val = _max;
_value = val;
}
bool DOF::hasMin() const
{
return _hasMin;
}
void DOF::setHasMin(bool hasMin)
{
_hasMin = hasMin;
}
float DOF::min() const
{
return _min;
}
void DOF::setMin(float val)
{
_min = val;
if (_value < _min)
_value = _min;
_hasMin = true;
}
bool DOF::hasMax() const
{
return _hasMax;
}
void DOF::setHasMax(bool hasMax)
{
_hasMax = hasMax;
}
float DOF::max() const
{
return _max;
}
void DOF::setMax(float val)
{
_max = val;
if (_value > _max)
_value = _max;
_hasMax = true;
}
bool DOF::isEnabled() const
{
return _enabled;
}
void DOF::setEnabled(bool enabled)
{
_enabled = enabled;
}
const QString &DOF::name() const
{
return _name;
}
void DOF::setName(const QString &name)
{
_name = name;
}
DOF::Type DOF::type() const
{
return _type;
}
void DOF::setType(DOF::Type type)
{
_type = type;
}