Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 19, 2008, 12:55:41 AM (16 years ago)
Author:
landauf
Message:

added support for Vector4 to MultiTypeMath and added a new function called 'assimilate' that converts the stored value of a given MultiType to it's own type and assigns it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/console/src/util/MultiTypeMath.h

    r1064 r1319  
    6363        inline MultiTypeMath(const orxonox::Vector2&     value) { this->setValue(value); }
    6464        inline MultiTypeMath(const orxonox::Vector3&     value) { this->setValue(value); }
     65        inline MultiTypeMath(const orxonox::Vector4&     value) { this->setValue(value); }
    6566        inline MultiTypeMath(const orxonox::ColourValue& value) { this->setValue(value); }
    6667        inline MultiTypeMath(const orxonox::Quaternion&  value) { this->setValue(value); }
     
    7374        inline MultiTypeMath& operator=(const orxonox::Vector2&     value) { this->setValue(value); return *this; }
    7475        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; }
    7577        inline MultiTypeMath& operator=(const orxonox::ColourValue& value) { this->setValue(value); return *this; }
    7678        inline MultiTypeMath& operator=(const orxonox::Quaternion&  value) { this->setValue(value); return *this; }
     
    8284        inline bool operator==(const orxonox::Vector2&     value) const { return (this->vector2_     == value); }
    8385        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); }
    8487        inline bool operator==(const orxonox::ColourValue& value) const { return (this->colourvalue_ == value); }
    8588        inline bool operator==(const orxonox::Quaternion&  value) const { return (this->quaternion_  == value); }
     
    9194        inline bool operator!=(const orxonox::Vector2&     value) const { return (this->vector2_     != value); }
    9295        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); }
    9397        inline bool operator!=(const orxonox::ColourValue& value) const { return (this->colourvalue_ != value); }
    9498        inline bool operator!=(const orxonox::Quaternion&  value) const { return (this->quaternion_  != value); }
     
    114118        virtual operator orxonox::Vector2()     const;
    115119        virtual operator orxonox::Vector3()     const;
     120        virtual operator orxonox::Vector4()     const;
    116121        virtual operator orxonox::ColourValue() const;
    117122        virtual operator orxonox::Quaternion()  const;
     
    122127        inline void setValue(const orxonox::Vector2&     value) { this->type_ = MT_vector2;     this->vector2_     = value; }
    123128        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; }
    124130        inline void setValue(const orxonox::ColourValue& value) { this->type_ = MT_colourvalue; this->colourvalue_ = value; }
    125131        inline void setValue(const orxonox::Quaternion&  value) { this->type_ = MT_quaternion;  this->quaternion_  = value; }
     
    130136        inline orxonox::Vector2     getVector2()     const { return this->vector2_;     }
    131137        inline orxonox::Vector3     getVector3()     const { return this->vector3_;     }
     138        inline orxonox::Vector4     getVector4()     const { return this->vector4_;     }
    132139        inline orxonox::ColourValue getColourValue() const { return this->colourvalue_; }
    133140        inline orxonox::Quaternion  getQuaternion()  const { return this->quaternion_;  }
     
    137144        inline orxonox::Vector2&     getVector2()     { return this->vector2_;     }
    138145        inline orxonox::Vector3&     getVector3()     { return this->vector3_;     }
     146        inline orxonox::Vector4&     getVector4()     { return this->vector4_;     }
    139147        inline orxonox::ColourValue& getColourValue() { return this->colourvalue_; }
    140148        inline orxonox::Quaternion&  getQuaternion()  { return this->quaternion_;  }
     
    145153        inline void getValue(orxonox::Vector2*     variable) const { (*variable) = orxonox::Vector2     (this->vector2_);     }
    146154        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_);     }
    147156        inline void getValue(orxonox::ColourValue* variable) const { (*variable) = orxonox::ColourValue (this->colourvalue_); }
    148157        inline void getValue(orxonox::Quaternion*  variable) const { (*variable) = orxonox::Quaternion  (this->quaternion_);  }
     
    155164        virtual bool fromString(const std::string value);
    156165
     166        virtual void assimilate(const MultiTypeMath& mtm);
     167
    157168    protected:
    158169        orxonox::Vector2      vector2_;
    159170        orxonox::Vector3      vector3_;
     171        orxonox::Vector4      vector4_;
    160172        orxonox::ColourValue  colourvalue_;
    161173        orxonox::Quaternion   quaternion_;
Note: See TracChangeset for help on using the changeset viewer.