Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 1, 2008, 3:54:20 PM (16 years ago)
Author:
rgrieder
Message:
  • @everyone: Do not create a branch until I've added the svn:eol-style property correctly. Otherwise this would cost me another 4 hours or so when we want to merge back.
  • merged network branch back to trunk
  • I had to omit the changes from last evening concerning the line endings
  • might not work yet because of the line endings
  • @beni: script branch is the only branch still open. you probably will have to apply a patch because of inconsistent new lines
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/util/MultiTypeMath.cc

    r1056 r1502  
    3737    else if (type == MT_vector3)
    3838        this->vector3_ = orxonox::Vector3(0, 0, 0);
     39    else if (type == MT_vector4)
     40        this->vector4_ = orxonox::Vector4(0, 0, 0, 0);
    3941    else if (type == MT_colourvalue)
    4042        this->colourvalue_ = orxonox::ColourValue(0, 0, 0, 0);
     
    5557        else if (this->type_ == MT_vector3)
    5658            return (this->vector3_ == mtm.vector3_);
     59        else if (this->type_ == MT_vector4)
     60            return (this->vector4_ == mtm.vector4_);
    5761        else if (this->type_ == MT_colourvalue)
    5862            return (this->colourvalue_ == mtm.colourvalue_);
     
    6872}
    6973
     74bool MultiTypeMath::operator==(const MultiTypeString& mts) const
     75{
     76    return MultiTypeString::operator==(mts);
     77}
     78
     79bool MultiTypeMath::operator==(const MultiTypePrimitive& mtp) const
     80{
     81    return MultiTypePrimitive::operator==(mtp);
     82}
     83
    7084bool MultiTypeMath::operator!=(const MultiTypeMath& mtm) const
    7185{
     
    7690        else if (this->type_ == MT_vector3)
    7791            return (this->vector3_ != mtm.vector3_);
     92        else if (this->type_ == MT_vector4)
     93            return (this->vector4_ != mtm.vector4_);
    7894        else if (this->type_ == MT_colourvalue)
    7995            return (this->colourvalue_ != mtm.colourvalue_);
     
    87103
    88104    return true;
     105}
     106
     107bool MultiTypeMath::operator!=(const MultiTypeString& mts) const
     108{
     109    return MultiTypeString::operator!=(mts);
     110}
     111
     112bool MultiTypeMath::operator!=(const MultiTypePrimitive& mtp) const
     113{
     114    return MultiTypePrimitive::operator!=(mtp);
    89115}
    90116
     
    123149MultiTypeMath::operator orxonox::Vector3() const
    124150{ return (this->type_ == MT_vector3) ? this->vector3_ : getConvertedValue<MultiTypeMath, orxonox::Vector3>(*this); }
     151MultiTypeMath::operator orxonox::Vector4() const
     152{ return (this->type_ == MT_vector4) ? this->vector4_ : getConvertedValue<MultiTypeMath, orxonox::Vector4>(*this); }
    125153MultiTypeMath::operator orxonox::Quaternion() const
    126154{ return (this->type_ == MT_quaternion) ? this->quaternion_ : getConvertedValue<MultiTypeMath, orxonox::Quaternion>(*this); }
     
    137165    this->vector2_ = mtm.vector2_;
    138166    this->vector3_ = mtm.vector3_;
     167    this->vector4_ = mtm.vector4_;
    139168    this->quaternion_ = mtm.quaternion_;
    140169    this->colourvalue_ = mtm.colourvalue_;
     
    143172}
    144173
     174void MultiTypeMath::setValue(const MultiTypeString& mts)
     175{
     176    MultiTypeString::setValue(mts);
     177}
     178
     179void MultiTypeMath::setValue(const MultiTypePrimitive& mtp)
     180{
     181    MultiTypePrimitive::setValue(mtp);
     182}
     183
    145184std::string MultiTypeMath::getTypename() const
    146185{
     
    149188    else if (this->type_ == MT_vector3)
    150189        return "Vector3";
     190    else if (this->type_ == MT_vector4)
     191        return "Vector4";
    151192    else if (this->type_ == MT_colourvalue)
    152193        return "ColourValue";
     
    169210    else if (this->type_ == MT_vector3)
    170211        ConvertValue(&output, this->vector3_);
     212    else if (this->type_ == MT_vector4)
     213        ConvertValue(&output, this->vector4_);
    171214    else if (this->type_ == MT_colourvalue)
    172215        ConvertValue(&output, this->colourvalue_);
     
    189232    else if (this->type_ == MT_vector3)
    190233        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));
    191236    else if (this->type_ == MT_colourvalue)
    192237        return ConvertValue(&this->colourvalue_, value, orxonox::ColourValue(0, 0, 0, 0));
     
    201246}
    202247
     248bool 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
    203298std::ostream& operator<<(std::ostream& out, MultiTypeMath& mtm)
    204299{
Note: See TracChangeset for help on using the changeset viewer.