Changeset 7986 for code/branches/usability/src
- Timestamp:
- Feb 27, 2011, 11:00:06 AM (14 years ago)
- Location:
- code/branches/usability/src/orxonox/items
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/usability/src/orxonox/items/Engine.cc
r7976 r7986 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()); … … 211 215 212 216 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 } 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/branches/usability/src/orxonox/items/Engine.h
r7552 r7986 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.