Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 27, 2011, 11:00:06 AM (13 years ago)
Author:
landauf
Message:
  • deactivate motion blur shader when blur-strength is 0
  • made motion blur configurable
  • moved blurStrength config value from [Engine] to [GraphicsSettings]
Location:
code/branches/usability/src/orxonox/items
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/usability/src/orxonox/items/Engine.cc

    r7976 r7986  
    102102    void Engine::setConfigValues()
    103103    {
    104         SetConfigValue(blurStrength_, 3.0f);
     104        SetConfigValueExternal(bEnableMotionBlur_, "GraphicsSettings", "enableMotionBlur", true)
     105            .description("Enable or disable the motion blur effect when moving very fast")
     106            .callback(this, &Engine::changedEnableMotionBlur);
     107        SetConfigValueExternal(blurStrength_, "GraphicsSettings", "blurStrength", 3.0f)
     108            .description("Defines the strength of the motion blur effect");
    105109    }
    106110
     
    204208        this->ship_->setSteeringDirection(Vector3::ZERO);
    205209
    206         if (!this->boostBlur_ && this->ship_->hasLocalController() && this->ship_->hasHumanController())
     210        if (this->bEnableMotionBlur_ && !this->boostBlur_ && this->ship_->hasLocalController() && this->ship_->hasHumanController())
    207211        {
    208212            this->boostBlur_ = new Shader(this->ship_->getScene()->getSceneManager());
     
    211215
    212216        if (this->boostBlur_ && this->maxSpeedFront_ != 0 && this->boostFactor_ != 1)
    213             this->boostBlur_->setParameter(0, 0, "sampleStrength", this->blurStrength_ * clamp((-velocity.z - this->maxSpeedFront_) / ((this->boostFactor_ - 1) * this->maxSpeedFront_), 0.0f, 1.0f));
     217        {
     218            float blur = this->blurStrength_ * clamp((-velocity.z - this->maxSpeedFront_) / ((this->boostFactor_ - 1) * this->maxSpeedFront_), 0.0f, 1.0f);
     219
     220            this->boostBlur_->setVisible(blur > 0);
     221            this->boostBlur_->setParameter(0, 0, "sampleStrength", blur);
     222        }
    214223    }
    215224
     
    257266        return this->ship_->getWorldPosition();
    258267    }
     268
     269    void Engine::changedEnableMotionBlur()
     270    {
     271        if (!this->bEnableMotionBlur_)
     272        {
     273            this->boostBlur_->destroy();
     274            this->boostBlur_ = 0;
     275        }
     276    }
    259277}
  • code/branches/usability/src/orxonox/items/Engine.h

    r7552 r7986  
    127127            void registerVariables();
    128128            void networkcallback_shipID();
     129            void changedEnableMotionBlur();
    129130
    130131            SpaceShip* ship_;
     
    150151            Shader* boostBlur_;
    151152            float blurStrength_;
     153            bool bEnableMotionBlur_;
    152154    };
    153155}
Note: See TracChangeset for help on using the changeset viewer.