Changeset 1319
- Timestamp:
- May 19, 2008, 12:55:41 AM (17 years ago)
- Location:
- code/branches/console/src/util
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/console/src/util/Convert.h
r1064 r1319 384 384 else if (input.getType() == MT_vector3) 385 385 return ConvertValue(output, input.getVector3()); 386 else if (input.getType() == MT_vector4) 387 return ConvertValue(output, input.getVector4()); 386 388 else if (input.getType() == MT_quaternion) 387 389 return ConvertValue(output, input.getQuaternion()); -
code/branches/console/src/util/MultiType.h
r1056 r1319 54 54 MT_vector2, 55 55 MT_vector3, 56 MT_vector4, 56 57 MT_colourvalue, 57 58 MT_quaternion, -
code/branches/console/src/util/MultiTypeMath.cc
r1056 r1319 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_); … … 76 80 else if (this->type_ == MT_vector3) 77 81 return (this->vector3_ != mtm.vector3_); 82 else if (this->type_ == MT_vector4) 83 return (this->vector4_ != mtm.vector4_); 78 84 else if (this->type_ == MT_colourvalue) 79 85 return (this->colourvalue_ != mtm.colourvalue_); … … 123 129 MultiTypeMath::operator orxonox::Vector3() const 124 130 { return (this->type_ == MT_vector3) ? this->vector3_ : getConvertedValue<MultiTypeMath, orxonox::Vector3>(*this); } 131 MultiTypeMath::operator orxonox::Vector4() const 132 { return (this->type_ == MT_vector4) ? this->vector4_ : getConvertedValue<MultiTypeMath, orxonox::Vector4>(*this); } 125 133 MultiTypeMath::operator orxonox::Quaternion() const 126 134 { return (this->type_ == MT_quaternion) ? this->quaternion_ : getConvertedValue<MultiTypeMath, orxonox::Quaternion>(*this); } … … 137 145 this->vector2_ = mtm.vector2_; 138 146 this->vector3_ = mtm.vector3_; 147 this->vector4_ = mtm.vector4_; 139 148 this->quaternion_ = mtm.quaternion_; 140 149 this->colourvalue_ = mtm.colourvalue_; … … 149 158 else if (this->type_ == MT_vector3) 150 159 return "Vector3"; 160 else if (this->type_ == MT_vector4) 161 return "Vector4"; 151 162 else if (this->type_ == MT_colourvalue) 152 163 return "ColourValue"; … … 169 180 else if (this->type_ == MT_vector3) 170 181 ConvertValue(&output, this->vector3_); 182 else if (this->type_ == MT_vector4) 183 ConvertValue(&output, this->vector4_); 171 184 else if (this->type_ == MT_colourvalue) 172 185 ConvertValue(&output, this->colourvalue_); … … 189 202 else if (this->type_ == MT_vector3) 190 203 return ConvertValue(&this->vector3_, value, orxonox::Vector3(0, 0, 0)); 204 else if (this->type_ == MT_vector4) 205 return ConvertValue(&this->vector4_, value, orxonox::Vector4(0, 0, 0, 0)); 191 206 else if (this->type_ == MT_colourvalue) 192 207 return ConvertValue(&this->colourvalue_, value, orxonox::ColourValue(0, 0, 0, 0)); … … 199 214 else 200 215 return MultiTypeString::fromString(value); 216 } 217 218 void MultiTypeMath::assimilate(const MultiTypeMath& mtm) 219 { 220 if (this->type_ == MT_vector2) 221 this->vector2_ = mtm.operator orxonox::Vector2(); 222 else if (this->type_ == MT_vector3) 223 this->vector3_ = mtm.operator orxonox::Vector3(); 224 else if (this->type_ == MT_vector4) 225 this->vector4_ = mtm.operator orxonox::Vector4(); 226 else if (this->type_ == MT_colourvalue) 227 this->colourvalue_ = mtm; 228 else if (this->type_ == MT_quaternion) 229 this->quaternion_ = mtm; 230 else if (this->type_ == MT_radian) 231 this->radian_ = mtm.operator orxonox::Radian(); 232 else if (this->type_ == MT_degree) 233 this->degree_ = mtm.operator orxonox::Degree(); 234 else 235 MultiTypeString::assimilate(mtm); 201 236 } 202 237 -
code/branches/console/src/util/MultiTypeMath.h
r1064 r1319 63 63 inline MultiTypeMath(const orxonox::Vector2& value) { this->setValue(value); } 64 64 inline MultiTypeMath(const orxonox::Vector3& value) { this->setValue(value); } 65 inline MultiTypeMath(const orxonox::Vector4& value) { this->setValue(value); } 65 66 inline MultiTypeMath(const orxonox::ColourValue& value) { this->setValue(value); } 66 67 inline MultiTypeMath(const orxonox::Quaternion& value) { this->setValue(value); } … … 73 74 inline MultiTypeMath& operator=(const orxonox::Vector2& value) { this->setValue(value); return *this; } 74 75 inline MultiTypeMath& operator=(const orxonox::Vector3& value) { this->setValue(value); return *this; } 76 inline MultiTypeMath& operator=(const orxonox::Vector4& value) { this->setValue(value); return *this; } 75 77 inline MultiTypeMath& operator=(const orxonox::ColourValue& value) { this->setValue(value); return *this; } 76 78 inline MultiTypeMath& operator=(const orxonox::Quaternion& value) { this->setValue(value); return *this; } … … 82 84 inline bool operator==(const orxonox::Vector2& value) const { return (this->vector2_ == value); } 83 85 inline bool operator==(const orxonox::Vector3& value) const { return (this->vector3_ == value); } 86 inline bool operator==(const orxonox::Vector4& value) const { return (this->vector4_ == value); } 84 87 inline bool operator==(const orxonox::ColourValue& value) const { return (this->colourvalue_ == value); } 85 88 inline bool operator==(const orxonox::Quaternion& value) const { return (this->quaternion_ == value); } … … 91 94 inline bool operator!=(const orxonox::Vector2& value) const { return (this->vector2_ != value); } 92 95 inline bool operator!=(const orxonox::Vector3& value) const { return (this->vector3_ != value); } 96 inline bool operator!=(const orxonox::Vector4& value) const { return (this->vector4_ != value); } 93 97 inline bool operator!=(const orxonox::ColourValue& value) const { return (this->colourvalue_ != value); } 94 98 inline bool operator!=(const orxonox::Quaternion& value) const { return (this->quaternion_ != value); } … … 114 118 virtual operator orxonox::Vector2() const; 115 119 virtual operator orxonox::Vector3() const; 120 virtual operator orxonox::Vector4() const; 116 121 virtual operator orxonox::ColourValue() const; 117 122 virtual operator orxonox::Quaternion() const; … … 122 127 inline void setValue(const orxonox::Vector2& value) { this->type_ = MT_vector2; this->vector2_ = value; } 123 128 inline void setValue(const orxonox::Vector3& value) { this->type_ = MT_vector3; this->vector3_ = value; } 129 inline void setValue(const orxonox::Vector4& value) { this->type_ = MT_vector4; this->vector4_ = value; } 124 130 inline void setValue(const orxonox::ColourValue& value) { this->type_ = MT_colourvalue; this->colourvalue_ = value; } 125 131 inline void setValue(const orxonox::Quaternion& value) { this->type_ = MT_quaternion; this->quaternion_ = value; } … … 130 136 inline orxonox::Vector2 getVector2() const { return this->vector2_; } 131 137 inline orxonox::Vector3 getVector3() const { return this->vector3_; } 138 inline orxonox::Vector4 getVector4() const { return this->vector4_; } 132 139 inline orxonox::ColourValue getColourValue() const { return this->colourvalue_; } 133 140 inline orxonox::Quaternion getQuaternion() const { return this->quaternion_; } … … 137 144 inline orxonox::Vector2& getVector2() { return this->vector2_; } 138 145 inline orxonox::Vector3& getVector3() { return this->vector3_; } 146 inline orxonox::Vector4& getVector4() { return this->vector4_; } 139 147 inline orxonox::ColourValue& getColourValue() { return this->colourvalue_; } 140 148 inline orxonox::Quaternion& getQuaternion() { return this->quaternion_; } … … 145 153 inline void getValue(orxonox::Vector2* variable) const { (*variable) = orxonox::Vector2 (this->vector2_); } 146 154 inline void getValue(orxonox::Vector3* variable) const { (*variable) = orxonox::Vector3 (this->vector3_); } 155 inline void getValue(orxonox::Vector4* variable) const { (*variable) = orxonox::Vector4 (this->vector4_); } 147 156 inline void getValue(orxonox::ColourValue* variable) const { (*variable) = orxonox::ColourValue (this->colourvalue_); } 148 157 inline void getValue(orxonox::Quaternion* variable) const { (*variable) = orxonox::Quaternion (this->quaternion_); } … … 155 164 virtual bool fromString(const std::string value); 156 165 166 virtual void assimilate(const MultiTypeMath& mtm); 167 157 168 protected: 158 169 orxonox::Vector2 vector2_; 159 170 orxonox::Vector3 vector3_; 171 orxonox::Vector4 vector4_; 160 172 orxonox::ColourValue colourvalue_; 161 173 orxonox::Quaternion quaternion_; -
code/branches/console/src/util/MultiTypePrimitive.cc
r1056 r1319 266 266 } 267 267 268 void MultiTypePrimitive::assimilate(const MultiTypePrimitive& mtp) 269 { 270 if (this->type_ == MT_void) 271 this->value_.void_ = mtp; 272 else if (this->type_ == MT_int) 273 this->value_.int_ = mtp; 274 else if (this->type_ == MT_uint) 275 this->value_.uint_ = mtp; 276 else if (this->type_ == MT_char) 277 this->value_.char_ = mtp; 278 else if (this->type_ == MT_uchar) 279 this->value_.uchar_ = mtp; 280 else if (this->type_ == MT_short) 281 this->value_.short_ = mtp; 282 else if (this->type_ == MT_ushort) 283 this->value_.ushort_ = mtp; 284 else if (this->type_ == MT_long) 285 this->value_.long_ = mtp; 286 else if (this->type_ == MT_ulong) 287 this->value_.ulong_ = mtp; 288 else if (this->type_ == MT_float) 289 this->value_.float_ = mtp; 290 else if (this->type_ == MT_double) 291 this->value_.double_ = mtp; 292 else if (this->type_ == MT_longdouble) 293 this->value_.longdouble_ = mtp; 294 else if (this->type_ == MT_bool) 295 this->value_.bool_ = mtp; 296 } 297 268 298 std::ostream& operator<<(std::ostream& out, const MultiTypePrimitive& mtp) 269 299 { -
code/branches/console/src/util/MultiTypePrimitive.h
r1062 r1319 187 187 virtual bool fromString(const std::string value); 188 188 189 virtual void assimilate(const MultiTypePrimitive& mtp); 190 189 191 protected: 190 192 MultiTypeValue value_; -
code/branches/console/src/util/MultiTypeString.cc
r1064 r1319 136 136 } 137 137 138 void MultiTypeString::assimilate(const MultiTypeString& mts) 139 { 140 if (this->type_ == MT_constchar) 141 this->string_ = mts.toString(); 142 else if (this->type_ == MT_string) 143 this->string_ = mts.toString(); 144 else 145 MultiTypePrimitive::assimilate(mts); 146 } 147 138 148 std::ostream& operator<<(std::ostream& out, MultiTypeString& mts) 139 149 { -
code/branches/console/src/util/MultiTypeString.h
r1064 r1319 117 117 virtual bool fromString(const std::string value); 118 118 119 virtual void assimilate(const MultiTypeString& mts); 120 119 121 protected: 120 122 std::string string_;
Note: See TracChangeset
for help on using the changeset viewer.