[Orxonox-commit 3297] r7986 - code/branches/usability/src/orxonox/items
landauf at orxonox.net
landauf at orxonox.net
Sun Feb 27 11:00:06 CET 2011
Author: landauf
Date: 2011-02-27 11:00:06 +0100 (Sun, 27 Feb 2011)
New Revision: 7986
Modified:
code/branches/usability/src/orxonox/items/Engine.cc
code/branches/usability/src/orxonox/items/Engine.h
Log:
- deactivate motion blur shader when blur-strength is 0
- made motion blur configurable
- moved blurStrength config value from [Engine] to [GraphicsSettings]
Modified: code/branches/usability/src/orxonox/items/Engine.cc
===================================================================
--- code/branches/usability/src/orxonox/items/Engine.cc 2011-02-27 07:09:59 UTC (rev 7985)
+++ code/branches/usability/src/orxonox/items/Engine.cc 2011-02-27 10:00:06 UTC (rev 7986)
@@ -101,7 +101,11 @@
void Engine::setConfigValues()
{
- SetConfigValue(blurStrength_, 3.0f);
+ SetConfigValueExternal(bEnableMotionBlur_, "GraphicsSettings", "enableMotionBlur", true)
+ .description("Enable or disable the motion blur effect when moving very fast")
+ .callback(this, &Engine::changedEnableMotionBlur);
+ SetConfigValueExternal(blurStrength_, "GraphicsSettings", "blurStrength", 3.0f)
+ .description("Defines the strength of the motion blur effect");
}
void Engine::registerVariables()
@@ -203,14 +207,19 @@
this->ship_->setBoost(false);
this->ship_->setSteeringDirection(Vector3::ZERO);
- if (!this->boostBlur_ && this->ship_->hasLocalController() && this->ship_->hasHumanController())
+ if (this->bEnableMotionBlur_ && !this->boostBlur_ && this->ship_->hasLocalController() && this->ship_->hasHumanController())
{
this->boostBlur_ = new Shader(this->ship_->getScene()->getSceneManager());
this->boostBlur_->setCompositorName("Radial Blur");
}
if (this->boostBlur_ && this->maxSpeedFront_ != 0 && this->boostFactor_ != 1)
- this->boostBlur_->setParameter(0, 0, "sampleStrength", this->blurStrength_ * clamp((-velocity.z - this->maxSpeedFront_) / ((this->boostFactor_ - 1) * this->maxSpeedFront_), 0.0f, 1.0f));
+ {
+ float blur = this->blurStrength_ * clamp((-velocity.z - this->maxSpeedFront_) / ((this->boostFactor_ - 1) * this->maxSpeedFront_), 0.0f, 1.0f);
+
+ this->boostBlur_->setVisible(blur > 0);
+ this->boostBlur_->setParameter(0, 0, "sampleStrength", blur);
+ }
}
void Engine::changedActivity()
@@ -256,4 +265,13 @@
{
return this->ship_->getWorldPosition();
}
+
+ void Engine::changedEnableMotionBlur()
+ {
+ if (!this->bEnableMotionBlur_)
+ {
+ this->boostBlur_->destroy();
+ this->boostBlur_ = 0;
+ }
+ }
}
Modified: code/branches/usability/src/orxonox/items/Engine.h
===================================================================
--- code/branches/usability/src/orxonox/items/Engine.h 2011-02-27 07:09:59 UTC (rev 7985)
+++ code/branches/usability/src/orxonox/items/Engine.h 2011-02-27 10:00:06 UTC (rev 7986)
@@ -126,6 +126,7 @@
private:
void registerVariables();
void networkcallback_shipID();
+ void changedEnableMotionBlur();
SpaceShip* ship_;
unsigned int shipID_;
@@ -149,6 +150,7 @@
Shader* boostBlur_;
float blurStrength_;
+ bool bEnableMotionBlur_;
};
}
More information about the Orxonox-commit
mailing list