Changeset 8079 for code/trunk/src/orxonox/items
- Timestamp:
- Mar 15, 2011, 9:47:11 PM (14 years ago)
- Location:
- code/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/items/Engine.cc
r7547 r8079 102 102 void Engine::setConfigValues() 103 103 { 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"); 105 109 } 106 110 … … 204 208 this->ship_->setSteeringDirection(Vector3::ZERO); 205 209 206 if ( !this->boostBlur_ && this->ship_->hasLocalController() && this->ship_->hasHumanController())210 if (this->bEnableMotionBlur_ && !this->boostBlur_ && this->ship_->hasLocalController() && this->ship_->hasHumanController()) 207 211 { 208 212 this->boostBlur_ = new Shader(this->ship_->getScene()->getSceneManager()); 209 this->boostBlur_->setCompositor ("Radial Blur");213 this->boostBlur_->setCompositorName("Radial Blur"); 210 214 } 211 215 212 216 if (this->boostBlur_ && this->maxSpeedFront_ != 0 && this->boostFactor_ != 1) 213 this->boostBlur_->setParameter("Ogre/Compositor/Radial_Blur", 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 } 214 223 } 215 224 … … 257 266 return this->ship_->getWorldPosition(); 258 267 } 268 269 void Engine::changedEnableMotionBlur() 270 { 271 if (!this->bEnableMotionBlur_) 272 { 273 this->boostBlur_->destroy(); 274 this->boostBlur_ = 0; 275 } 276 } 259 277 } -
code/trunk/src/orxonox/items/Engine.h
r7552 r8079 127 127 void registerVariables(); 128 128 void networkcallback_shipID(); 129 void changedEnableMotionBlur(); 129 130 130 131 SpaceShip* ship_; … … 150 151 Shader* boostBlur_; 151 152 float blurStrength_; 153 bool bEnableMotionBlur_; 152 154 }; 153 155 }
Note: See TracChangeset
for help on using the changeset viewer.