[792] | 1 | /* |
---|
| 2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
| 3 | * |
---|
| 4 | * |
---|
| 5 | * License notice: |
---|
| 6 | * |
---|
| 7 | * This program is free software; you can redistribute it and/or |
---|
| 8 | * modify it under the terms of the GNU General Public License |
---|
| 9 | * as published by the Free Software Foundation; either version 2 |
---|
| 10 | * of the License, or (at your option) any later version. |
---|
| 11 | * |
---|
| 12 | * This program is distributed in the hope that it will be useful, |
---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 15 | * GNU General Public License for more details. |
---|
| 16 | * |
---|
| 17 | * You should have received a copy of the GNU General Public License |
---|
| 18 | * along with this program; if not, write to the Free Software |
---|
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
| 20 | * |
---|
| 21 | * Author: |
---|
| 22 | * Fabian 'x3n' Landau |
---|
| 23 | * Co-authors: |
---|
| 24 | * ... |
---|
| 25 | * |
---|
| 26 | * Inspiration: MultiType by Benjamin Grauer |
---|
| 27 | */ |
---|
| 28 | |
---|
| 29 | #ifndef _MultiTypeMath_H__ |
---|
| 30 | #define _MultiTypeMath_H__ |
---|
| 31 | |
---|
| 32 | #include "UtilPrereqs.h" |
---|
| 33 | |
---|
| 34 | #include "MultiTypeString.h" |
---|
| 35 | #include "Math.h" |
---|
| 36 | |
---|
| 37 | class _UtilExport MultiTypeMath : public MultiTypeString |
---|
| 38 | { |
---|
| 39 | public: |
---|
| 40 | MultiTypeMath(MultiType type = MT_null); |
---|
| 41 | MultiTypeMath(int value) : MultiTypeString(value) {} |
---|
| 42 | MultiTypeMath(unsigned int value) : MultiTypeString(value) {} |
---|
| 43 | MultiTypeMath(char value) : MultiTypeString(value) {} |
---|
| 44 | MultiTypeMath(unsigned char value) : MultiTypeString(value) {} |
---|
| 45 | MultiTypeMath(short value) : MultiTypeString(value) {} |
---|
| 46 | MultiTypeMath(unsigned short value) : MultiTypeString(value) {} |
---|
| 47 | MultiTypeMath(long value) : MultiTypeString(value) {} |
---|
| 48 | MultiTypeMath(unsigned long value) : MultiTypeString(value) {} |
---|
| 49 | MultiTypeMath(float value) : MultiTypeString(value) {} |
---|
| 50 | MultiTypeMath(double value) : MultiTypeString(value) {} |
---|
| 51 | MultiTypeMath(long double value) : MultiTypeString(value) {} |
---|
| 52 | MultiTypeMath(bool value) : MultiTypeString(value) {} |
---|
| 53 | MultiTypeMath(const char* value) : MultiTypeString(value) {} |
---|
| 54 | MultiTypeMath(const std::string& value) : MultiTypeString(value) {} |
---|
| 55 | MultiTypeMath(const orxonox::Vector2& value) { this->setValue(value); } |
---|
| 56 | MultiTypeMath(const orxonox::Vector3& value) { this->setValue(value); } |
---|
| 57 | MultiTypeMath(const orxonox::ColourValue& value) { this->setValue(value); } |
---|
| 58 | MultiTypeMath(const orxonox::Quaternion& value) { this->setValue(value); } |
---|
| 59 | MultiTypeMath(const orxonox::Radian& value) { this->setValue(value); } |
---|
| 60 | MultiTypeMath(const orxonox::Degree& value) { this->setValue(value); } |
---|
| 61 | MultiTypeMath(const MultiTypeMath& mtm); |
---|
| 62 | |
---|
| 63 | MultiTypeMath& operator=(const orxonox::Vector2& value) { this->setValue(value); return *this; } |
---|
| 64 | MultiTypeMath& operator=(const orxonox::Vector3& value) { this->setValue(value); return *this; } |
---|
| 65 | MultiTypeMath& operator=(const orxonox::ColourValue& value) { this->setValue(value); return *this; } |
---|
| 66 | MultiTypeMath& operator=(const orxonox::Quaternion& value) { this->setValue(value); return *this; } |
---|
| 67 | MultiTypeMath& operator=(const orxonox::Radian& value) { this->setValue(value); return *this; } |
---|
| 68 | MultiTypeMath& operator=(const orxonox::Degree& value) { this->setValue(value); return *this; } |
---|
| 69 | MultiTypeMath& operator=(const MultiTypeMath& mtm); |
---|
| 70 | |
---|
| 71 | bool operator==(const orxonox::Vector2& value) const { return (this->vector2_ == value); } |
---|
| 72 | bool operator==(const orxonox::Vector3& value) const { return (this->vector3_ == value); } |
---|
| 73 | bool operator==(const orxonox::ColourValue& value) const { return (this->colourvalue_ == value); } |
---|
| 74 | bool operator==(const orxonox::Quaternion& value) const { return (this->quaternion_ == value); } |
---|
| 75 | bool operator==(const orxonox::Radian& value) const { return (this->radian_ == value); } |
---|
| 76 | bool operator==(const orxonox::Degree& value) const { return (this->degree_ == value); } |
---|
| 77 | bool operator==(const MultiTypeMath& mtm) const; |
---|
| 78 | |
---|
| 79 | bool operator!=(const orxonox::Vector2& value) const { return (this->vector2_ != value); } |
---|
| 80 | bool operator!=(const orxonox::Vector3& value) const { return (this->vector3_ != value); } |
---|
| 81 | bool operator!=(const orxonox::ColourValue& value) const { return (this->colourvalue_ != value); } |
---|
| 82 | bool operator!=(const orxonox::Quaternion& value) const { return (this->quaternion_ != value); } |
---|
| 83 | bool operator!=(const orxonox::Radian& value) const { return (this->radian_ != value); } |
---|
| 84 | bool operator!=(const orxonox::Degree& value) const { return (this->degree_ != value); } |
---|
| 85 | bool operator!=(const MultiTypeMath& mtm) const; |
---|
| 86 | |
---|
| 87 | inline void setValue(const orxonox::Vector2& value) { this->type_ = MT_vector2; this->vector2_ = value; } |
---|
| 88 | inline void setValue(const orxonox::Vector3& value) { this->type_ = MT_vector3; this->vector3_ = value; } |
---|
| 89 | inline void setValue(const orxonox::ColourValue& value) { this->type_ = MT_colourvalue; this->colourvalue_ = value; } |
---|
| 90 | inline void setValue(const orxonox::Quaternion& value) { this->type_ = MT_quaternion; this->quaternion_ = value; } |
---|
| 91 | inline void setValue(const orxonox::Radian& value) { this->type_ = MT_radian; this->radian_ = value; } |
---|
| 92 | inline void setValue(const orxonox::Degree& value) { this->type_ = MT_degree; this->degree_ = value; } |
---|
| 93 | void setValue(const MultiTypeMath& mtm); |
---|
| 94 | |
---|
| 95 | inline orxonox::Vector2& getVector2() { return this->vector2_; } |
---|
| 96 | inline orxonox::Vector3& getVector3() { return this->vector3_; } |
---|
| 97 | inline orxonox::ColourValue& getColourValue() { return this->colourvalue_; } |
---|
| 98 | inline orxonox::Quaternion& getQuaternion() { return this->quaternion_; } |
---|
| 99 | inline orxonox::Radian& getRadian() { return this->radian_; } |
---|
| 100 | inline orxonox::Degree& getDegree() { return this->degree_; } |
---|
| 101 | |
---|
| 102 | inline void getValue(orxonox::Vector2* variable) const { (*variable) = orxonox::Vector2 (this->vector2_); } |
---|
| 103 | inline void getValue(orxonox::Vector3* variable) const { (*variable) = orxonox::Vector3 (this->vector3_); } |
---|
| 104 | inline void getValue(orxonox::ColourValue* variable) const { (*variable) = orxonox::ColourValue (this->colourvalue_); } |
---|
| 105 | inline void getValue(orxonox::Quaternion* variable) const { (*variable) = orxonox::Quaternion (this->quaternion_); } |
---|
| 106 | inline void getValue(orxonox::Radian* variable) const { (*variable) = orxonox::Radian (this->radian_); } |
---|
| 107 | inline void getValue(orxonox::Degree* variable) const { (*variable) = orxonox::Degree (this->degree_); } |
---|
| 108 | |
---|
| 109 | protected: |
---|
| 110 | orxonox::Vector2 vector2_; |
---|
| 111 | orxonox::Vector3 vector3_; |
---|
| 112 | orxonox::ColourValue colourvalue_; |
---|
| 113 | orxonox::Quaternion quaternion_; |
---|
| 114 | orxonox::Radian radian_; |
---|
| 115 | orxonox::Degree degree_; |
---|
| 116 | }; |
---|
| 117 | |
---|
| 118 | #endif /* _MultiTypeMath_H__ */ |
---|