Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 17, 2016, 6:41:22 PM (8 years ago)
Author:
landauf
Message:

merged remaining commits from cpp11_v2 to cpp11_v3 (for some reason they were not merged in the first attempt)

Location:
code/branches/cpp11_v3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v3

  • code/branches/cpp11_v3/src/orxonox/graphics/Light.cc

    r11054 r11068  
    4444
    4545    // Be sure we don't do bad conversions
    46     static_assert((int)Ogre::Light::LT_POINT       == (int)Light::Point,       "check enum");
    47     static_assert((int)Ogre::Light::LT_DIRECTIONAL == (int)Light::Directional, "check enum");
    48     static_assert((int)Ogre::Light::LT_SPOTLIGHT   == (int)Light::Spotlight,   "check enum");
     46    static_assert((int)Ogre::Light::LT_POINT       == (int)Light::Type::Point,       "check enum");
     47    static_assert((int)Ogre::Light::LT_DIRECTIONAL == (int)Light::Type::Directional, "check enum");
     48    static_assert((int)Ogre::Light::LT_SPOTLIGHT   == (int)Light::Type::Spotlight,   "check enum");
    4949
    5050    Light::Light(Context* context) : StaticEntity(context)
     
    5555        this->diffuse_ = ColourValue::White;
    5656        this->specular_ = ColourValue::White;
    57         this->type_ = Light::Point;
     57        this->type_ = Type::Point;
    5858        this->attenuation_ = Vector4(100000, 1, 0, 0);
    5959        this->spotlightRange_ = Vector3(40.0f, 30.0f, 1.0f);
     
    105105    void Light::registerVariables()
    106106    {
    107         registerVariable((int&)this->type_,     VariableDirection::ToClient, new NetworkCallback<Light>(this, &Light::updateType));
     107        registerVariable(this->type_,           VariableDirection::ToClient, new NetworkCallback<Light>(this, &Light::updateType));
    108108        registerVariable(this->diffuse_,        VariableDirection::ToClient, new NetworkCallback<Light>(this, &Light::updateDiffuseColour));
    109109        registerVariable(this->specular_,       VariableDirection::ToClient, new NetworkCallback<Light>(this, &Light::updateSpecularColour));
     
    126126    void Light::updateAttenuation()
    127127    {
    128         if (this->light_ && this->type_ != Light::Directional)
     128        if (this->light_ && this->type_ != Type::Directional)
    129129            this->light_->setAttenuation(this->attenuation_.x, this->attenuation_.y, this->attenuation_.z, this->attenuation_.w);
    130130    }
     
    132132    void Light::updateSpotlightRange()
    133133    {
    134         if (this->light_ && this->type_ == Light::Spotlight)
     134        if (this->light_ && this->type_ == Type::Spotlight)
    135135            this->light_->setSpotlightRange(Degree(this->spotlightRange_.x), Degree(this->spotlightRange_.y), this->spotlightRange_.z);
    136136    }
     
    139139    {
    140140        if (type == "point")
    141             this->setType(Light::Point);
     141            this->setType(Type::Point);
    142142        else if (type == "directional")
    143             this->setType(Light::Directional);
     143            this->setType(Type::Directional);
    144144        else if (type == "spotlight")
    145             this->setType(Light::Spotlight);
     145            this->setType(Type::Spotlight);
    146146        else
    147             this->setType(Light::Point);
     147            this->setType(Type::Point);
    148148    }
    149149
     
    152152        switch (this->type_)
    153153        {
    154             case Light::Directional:
     154            case Type::Directional:
    155155                return "directional";
    156             case Light::Spotlight:
     156            case Type::Spotlight:
    157157                return "spotlight";
    158             case Light::Point:
     158            case Type::Point:
    159159            default:
    160160                return "point";
     
    168168            this->light_->setType(static_cast<Ogre::Light::LightTypes>(this->type_));
    169169
    170             if (this->type_ != Light::Directional)
     170            if (this->type_ != Type::Directional)
    171171                this->updateAttenuation();
    172             if (this->type_ == Light::Spotlight)
     172            if (this->type_ == Type::Spotlight)
    173173                this->updateSpotlightRange();
    174174        }
Note: See TracChangeset for help on using the changeset viewer.