Changeset 6412 for code/branches/pickup2/src/orxonox/graphics
- Timestamp:
- Dec 25, 2009, 1:18:03 PM (15 years ago)
- Location:
- code/branches/pickup2
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickup2
- Property svn:mergeinfo changed
-
code/branches/pickup2/src/orxonox/graphics/Billboard.cc
r5781 r6412 42 42 RegisterObject(Billboard); 43 43 44 this->material_ = "";45 44 this->colour_ = ColourValue::White; 46 45 // this->rotation_ = 0; … … 76 75 void Billboard::changedMaterial() 77 76 { 78 if (this->material_ == "")77 if (this->material_.empty()) 79 78 return; 80 79 … … 99 98 { 100 99 /* 101 if (this->getScene() && GameMode::showsGraphics() && (this->material_ != ""))100 if (this->getScene() && GameMode::showsGraphics() && !this->material_.empty()) 102 101 { 103 102 this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->material_, this->colour_, 1); -
code/branches/pickup2/src/orxonox/graphics/BlinkingBillboard.cc
r5781 r6412 81 81 this->setScale(this->amplitude_ * static_cast<float>(square(sin((6.2831853 * this->time_ + this->phase_.valueRadians()) * this->frequency_)))); 82 82 else 83 this->setScale(this->amplitude_ * static_cast<float>( sin((6.2831853 * this->time_ + this->phase_.valueRadians()) * this->frequency_)));83 this->setScale(this->amplitude_ * static_cast<float>(fabs(sin((6.2831853 * this->time_ + this->phase_.valueRadians()) * this->frequency_)))); 84 84 } 85 85 } -
code/branches/pickup2/src/orxonox/graphics/Camera.cc
r5929 r6412 42 42 #include "Scene.h" 43 43 #include "CameraManager.h" 44 #include "sound/SoundManager.h" 44 45 45 46 namespace orxonox … … 61 62 62 63 this->camera_ = this->getScene()->getSceneManager()->createCamera(getUniqueNumberString()); 64 this->camera_->setUserObject(this); 63 65 this->cameraNode_ = this->getScene()->getRootSceneNode()->createChildSceneNode(); 64 66 this->attachNode(this->cameraNode_); … … 68 70 this->bDrag_ = false; 69 71 this->nearClipDistance_ = 1; 72 this->lastDtLagged_ = false; 70 73 71 74 this->setSyncMode(0x0); … … 111 114 { 112 115 // this stuff here may need some adjustments 113 float coeff = std::min(1.0f, 15.0f * dt); 116 float poscoeff = 15.0f * dt / this->getTimeFactor(); 117 float anglecoeff = 7.0f * dt / this->getTimeFactor(); 118 // Only clamp if fps rate is actually falling. Occasional high dts should 119 // not be clamped to reducing lagging effects. 120 if (poscoeff > 1.0f) 121 { 122 if (this->lastDtLagged_) 123 poscoeff = 1.0f; 124 else 125 this->lastDtLagged_ = true; 126 } 127 else 128 this->lastDtLagged_ = false; 129 130 if (anglecoeff > 1.0f) 131 { 132 if (this->lastDtLagged_) 133 anglecoeff = 1.0f; 134 else 135 this->lastDtLagged_ = true; 136 } 137 else 138 this->lastDtLagged_ = false; 114 139 115 140 Vector3 offset = this->getWorldPosition() - this->cameraNode_->_getDerivedPosition(); 116 this->cameraNode_->translate( coeff * offset);141 this->cameraNode_->translate(poscoeff * offset); 117 142 118 this->cameraNode_->setOrientation(Quaternion::Slerp(coeff, this->cameraNode_->_getDerivedOrientation(), this->getWorldOrientation(), true)); 119 //this->cameraNode_->setOrientation(this->getWorldOrientation()); 143 this->cameraNode_->setOrientation(Quaternion::Slerp(anglecoeff, this->cameraNode_->_getDerivedOrientation(), this->getWorldOrientation(), true)); 144 } 145 146 // Update sound listener transformation 147 if (GameMode::playsSound() && this->bHasFocus_) 148 { 149 SoundManager::getInstance().setListenerPosition(this->getWorldPosition()); 150 SoundManager::getInstance().setListenerOrientation(this->getWorldOrientation()); 120 151 } 121 152 } -
code/branches/pickup2/src/orxonox/graphics/Camera.h
r5781 r6412 34 34 #include "util/OgreForwardRefs.h" 35 35 #include "tools/interfaces/Tickable.h" 36 #include "tools/interfaces/TimeFactorListener.h" 36 37 #include "worldentities/StaticEntity.h" 37 38 38 39 namespace orxonox 39 40 { 40 class _OrxonoxExport Camera : public StaticEntity, public Tickable 41 class _OrxonoxExport Camera : public StaticEntity, public Tickable, public TimeFactorListener 41 42 { 42 43 friend class CameraManager; … … 51 52 void requestFocus(); 52 53 void releaseFocus(); 54 55 inline Ogre::Camera* getOgreCamera() 56 { return this->camera_; } 53 57 54 58 inline bool hasFocus() … … 69 73 bool bHasFocus_; 70 74 bool bDrag_; 75 bool lastDtLagged_; 71 76 }; 72 77 }
Note: See TracChangeset
for help on using the changeset viewer.