Changeset 1502 for code/trunk/src/util/MultiTypeMath.cc
- Timestamp:
- Jun 1, 2008, 3:54:20 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/util/MultiTypeMath.cc
r1056 r1502 37 37 else if (type == MT_vector3) 38 38 this->vector3_ = orxonox::Vector3(0, 0, 0); 39 else if (type == MT_vector4) 40 this->vector4_ = orxonox::Vector4(0, 0, 0, 0); 39 41 else if (type == MT_colourvalue) 40 42 this->colourvalue_ = orxonox::ColourValue(0, 0, 0, 0); … … 55 57 else if (this->type_ == MT_vector3) 56 58 return (this->vector3_ == mtm.vector3_); 59 else if (this->type_ == MT_vector4) 60 return (this->vector4_ == mtm.vector4_); 57 61 else if (this->type_ == MT_colourvalue) 58 62 return (this->colourvalue_ == mtm.colourvalue_); … … 68 72 } 69 73 74 bool MultiTypeMath::operator==(const MultiTypeString& mts) const 75 { 76 return MultiTypeString::operator==(mts); 77 } 78 79 bool MultiTypeMath::operator==(const MultiTypePrimitive& mtp) const 80 { 81 return MultiTypePrimitive::operator==(mtp); 82 } 83 70 84 bool MultiTypeMath::operator!=(const MultiTypeMath& mtm) const 71 85 { … … 76 90 else if (this->type_ == MT_vector3) 77 91 return (this->vector3_ != mtm.vector3_); 92 else if (this->type_ == MT_vector4) 93 return (this->vector4_ != mtm.vector4_); 78 94 else if (this->type_ == MT_colourvalue) 79 95 return (this->colourvalue_ != mtm.colourvalue_); … … 87 103 88 104 return true; 105 } 106 107 bool MultiTypeMath::operator!=(const MultiTypeString& mts) const 108 { 109 return MultiTypeString::operator!=(mts); 110 } 111 112 bool MultiTypeMath::operator!=(const MultiTypePrimitive& mtp) const 113 { 114 return MultiTypePrimitive::operator!=(mtp); 89 115 } 90 116 … … 123 149 MultiTypeMath::operator orxonox::Vector3() const 124 150 { return (this->type_ == MT_vector3) ? this->vector3_ : getConvertedValue<MultiTypeMath, orxonox::Vector3>(*this); } 151 MultiTypeMath::operator orxonox::Vector4() const 152 { return (this->type_ == MT_vector4) ? this->vector4_ : getConvertedValue<MultiTypeMath, orxonox::Vector4>(*this); } 125 153 MultiTypeMath::operator orxonox::Quaternion() const 126 154 { return (this->type_ == MT_quaternion) ? this->quaternion_ : getConvertedValue<MultiTypeMath, orxonox::Quaternion>(*this); } … … 137 165 this->vector2_ = mtm.vector2_; 138 166 this->vector3_ = mtm.vector3_; 167 this->vector4_ = mtm.vector4_; 139 168 this->quaternion_ = mtm.quaternion_; 140 169 this->colourvalue_ = mtm.colourvalue_; … … 143 172 } 144 173 174 void MultiTypeMath::setValue(const MultiTypeString& mts) 175 { 176 MultiTypeString::setValue(mts); 177 } 178 179 void MultiTypeMath::setValue(const MultiTypePrimitive& mtp) 180 { 181 MultiTypePrimitive::setValue(mtp); 182 } 183 145 184 std::string MultiTypeMath::getTypename() const 146 185 { … … 149 188 else if (this->type_ == MT_vector3) 150 189 return "Vector3"; 190 else if (this->type_ == MT_vector4) 191 return "Vector4"; 151 192 else if (this->type_ == MT_colourvalue) 152 193 return "ColourValue"; … … 169 210 else if (this->type_ == MT_vector3) 170 211 ConvertValue(&output, this->vector3_); 212 else if (this->type_ == MT_vector4) 213 ConvertValue(&output, this->vector4_); 171 214 else if (this->type_ == MT_colourvalue) 172 215 ConvertValue(&output, this->colourvalue_); … … 189 232 else if (this->type_ == MT_vector3) 190 233 return ConvertValue(&this->vector3_, value, orxonox::Vector3(0, 0, 0)); 234 else if (this->type_ == MT_vector4) 235 return ConvertValue(&this->vector4_, value, orxonox::Vector4(0, 0, 0, 0)); 191 236 else if (this->type_ == MT_colourvalue) 192 237 return ConvertValue(&this->colourvalue_, value, orxonox::ColourValue(0, 0, 0, 0)); … … 201 246 } 202 247 248 bool MultiTypeMath::assimilate(const MultiTypeMath& mtm, const MultiTypeMath& defvalue) 249 { 250 if (this->type_ == MT_void) 251 return ConvertValue(&this->value_.void_, mtm, defvalue.value_.void_); 252 else if (this->type_ == MT_int) 253 return ConvertValue(&this->value_.int_, mtm, defvalue.value_.int_); 254 else if (this->type_ == MT_uint) 255 return ConvertValue(&this->value_.uint_, mtm, defvalue.value_.uint_); 256 else if (this->type_ == MT_char) 257 return ConvertValue(&this->value_.char_, mtm, defvalue.value_.char_); 258 else if (this->type_ == MT_uchar) 259 return ConvertValue(&this->value_.uchar_, mtm, defvalue.value_.uchar_); 260 else if (this->type_ == MT_short) 261 return ConvertValue(&this->value_.short_, mtm, defvalue.value_.short_); 262 else if (this->type_ == MT_ushort) 263 return ConvertValue(&this->value_.ushort_, mtm, defvalue.value_.ushort_); 264 else if (this->type_ == MT_long) 265 return ConvertValue(&this->value_.long_, mtm, defvalue.value_.long_); 266 else if (this->type_ == MT_ulong) 267 return ConvertValue(&this->value_.ulong_, mtm, defvalue.value_.ulong_); 268 else if (this->type_ == MT_float) 269 return ConvertValue(&this->value_.float_, mtm, defvalue.value_.float_); 270 else if (this->type_ == MT_double) 271 return ConvertValue(&this->value_.double_, mtm, defvalue.value_.double_); 272 else if (this->type_ == MT_longdouble) 273 return ConvertValue(&this->value_.longdouble_, mtm, defvalue.value_.longdouble_); 274 else if (this->type_ == MT_bool) 275 return ConvertValue(&this->value_.bool_, mtm, defvalue.value_.bool_); 276 else if (this->type_ == MT_constchar) 277 return ConvertValue(&this->string_, mtm, defvalue.string_); 278 else if (this->type_ == MT_string) 279 return ConvertValue(&this->string_, mtm, defvalue.string_); 280 else if (this->type_ == MT_vector2) 281 return ConvertValue(&this->vector2_, mtm, defvalue.vector2_); 282 else if (this->type_ == MT_vector3) 283 return ConvertValue(&this->vector3_, mtm, defvalue.vector3_); 284 else if (this->type_ == MT_vector4) 285 return ConvertValue(&this->vector4_, mtm, defvalue.vector4_); 286 else if (this->type_ == MT_colourvalue) 287 return ConvertValue(&this->colourvalue_, mtm, defvalue.colourvalue_); 288 else if (this->type_ == MT_quaternion) 289 return ConvertValue(&this->quaternion_, mtm, defvalue.quaternion_); 290 else if (this->type_ == MT_radian) 291 return ConvertValue(&this->radian_, mtm, defvalue.radian_); 292 else if (this->type_ == MT_degree) 293 return ConvertValue(&this->degree_, mtm, defvalue.degree_); 294 else 295 return false; 296 } 297 203 298 std::ostream& operator<<(std::ostream& out, MultiTypeMath& mtm) 204 299 {
Note: See TracChangeset
for help on using the changeset viewer.