Changeset 6195
- Timestamp:
- Dec 2, 2009, 2:40:22 PM (15 years ago)
- Location:
- code/branches/presentation2/src/orxonox
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2/src/orxonox/controllers/Controller.h
r6111 r6195 40 40 friend class PlayerInfo; 41 41 friend class ControllableEntity; 42 42 43 43 public: 44 44 Controller(BaseObject* creator); -
code/branches/presentation2/src/orxonox/controllers/HumanController.cc
r6191 r6195 69 69 RegisterObject(HumanController); 70 70 71 controlPaused_ = false; 72 71 73 HumanController::localController_s = this; 72 74 } … … 250 252 HumanController::localController_s->controllableEntity_->getScene()->getRadar()->releaseFocus(); 251 253 } 254 255 void HumanController::pauseControl() 256 { 257 if (HumanController::localController_s) 258 HumanController::localController_s->doPauseControl(); 259 } 260 261 void HumanController::resumeControl() 262 { 263 if (HumanController::localController_s) 264 HumanController::localController_s->doResumeControl(); 265 } 252 266 } -
code/branches/presentation2/src/orxonox/controllers/HumanController.h
r6159 r6195 75 75 static void killBots(unsigned int amount = 0); 76 76 77 static void pauseControl(); 78 static void resumeControl(); 79 virtual void doPauseControl() {}; 80 virtual void doResumeControl() {}; 81 77 82 static inline HumanController* getLocalControllerSingleton() 78 83 { return HumanController::localController_s; } … … 83 88 protected: 84 89 static HumanController* localController_s; 90 bool controlPaused_; 85 91 }; 86 92 } -
code/branches/presentation2/src/orxonox/controllers/NewHumanController.cc
r6173 r6195 57 57 : HumanController(creator) 58 58 , crossHairOverlay_(NULL) 59 , centerOverlay_(NULL) 59 60 { 60 61 RegisterObject(NewHumanController); … … 72 73 crossHairOverlay_->setBackgroundMaterial("Orxonox/Crosshair3"); 73 74 crossHairOverlay_->setSize(Vector2(overlaySize_, overlaySize_)); 74 crossHairOverlay_->show(); 75 crossHairOverlay_->hide(); 76 77 centerOverlay_ = new OrxonoxOverlay(this); 78 centerOverlay_->setBackgroundMaterial("Orxonox/CenterOverlay"); 79 centerOverlay_->setSize(Vector2(overlaySize_ * 2.5, overlaySize_ * 2.5)); 80 centerOverlay_->setPosition(Vector2(0.5 - overlaySize_*2.5/2.0, 0.5 - overlaySize_*2.5/2.0));\ 81 centerOverlay_->hide(); 75 82 } 76 83 … … 81 88 82 89 NewHumanController::localController_s = this; 90 91 //HumanController::localController_s->getControllableEntity()->getCamera()->setDrag(true); 83 92 } 84 93 … … 99 108 { 100 109 this->updateTarget(); 101 this->crossHairOverlay_->setPosition(Vector2(static_cast<float>(this->currentYaw_)/2*-1+.5-overlaySize_/2, static_cast<float>(this->currentPitch_)/2*-1+.5-overlaySize_/2)); 102 this->crossHairOverlay_->show(); 103 } 104 else 110 if ( !controlPaused_ ) { 111 this->crossHairOverlay_->setPosition(Vector2(static_cast<float>(this->currentYaw_)/2*-1+.5-overlaySize_/2, static_cast<float>(this->currentPitch_)/2*-1+.5-overlaySize_/2)); 112 this->crossHairOverlay_->show(); 113 this->centerOverlay_->show(); 114 } 115 } 116 else { 105 117 this->crossHairOverlay_->hide(); 106 // TODO: update aimPosition of Pawn 118 this->centerOverlay_->hide(); 119 } 107 120 108 121 if ( this->acceleration_ > 0 ) … … 229 242 } 230 243 231 itr->movable->getParentSceneNode()->showBoundingBox(true);244 //itr->movable->getParentSceneNode()->showBoundingBox(true); 232 245 //std::cout << itr->movable->getParentSceneNode()->_getDerivedPosition() << endl; 233 246 //return mouseRay.getOrigin() + mouseRay.getDirection() * itr->distance; //or itr->movable->getParentSceneNode()->_getDerivedPosition() … … 308 321 } 309 322 } 323 324 void NewHumanController::doResumeControl() { 325 this->controlPaused_ = false; 326 this->crossHairOverlay_->show(); 327 this->centerOverlay_->show(); 328 } 329 330 void NewHumanController::doPauseControl() { 331 this->controlPaused_ = true; 332 this->crossHairOverlay_->hide(); 333 this->centerOverlay_->hide(); 334 } 310 335 } -
code/branches/presentation2/src/orxonox/controllers/NewHumanController.h
r6173 r6195 59 59 60 60 virtual void changedControllableEntity(); 61 virtual void doPauseControl(); 62 virtual void doResumeControl(); 61 63 62 64 protected: … … 69 71 float currentPitch_; 70 72 OrxonoxOverlay* crossHairOverlay_; 73 OrxonoxOverlay* centerOverlay_; 71 74 float overlaySize_; 72 75 bool accelerating_; -
code/branches/presentation2/src/orxonox/graphics/Camera.cc
r6191 r6195 114 114 { 115 115 // this stuff here may need some adjustments 116 float coeff = 15.0f * dt / this->getTimeFactor(); 116 float poscoeff = 15.0f * dt / this->getTimeFactor(); 117 float anglecoeff = 7.0f * dt / this->getTimeFactor(); 117 118 // Only clamp if fps rate is actually falling. Occasional high dts should 118 119 // not be clamped to reducing lagging effects. 119 if ( coeff > 1.0f)120 if (poscoeff > 1.0f) 120 121 { 121 122 if (this->lastDtLagged_) 122 coeff = 1.0f; 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; 123 134 else 124 135 this->lastDtLagged_ = true; … … 128 139 129 140 Vector3 offset = this->getWorldPosition() - this->cameraNode_->_getDerivedPosition(); 130 this->cameraNode_->translate( coeff * offset);141 this->cameraNode_->translate(poscoeff * offset); 131 142 132 this->cameraNode_->setOrientation(Quaternion::Slerp( coeff, this->cameraNode_->_getDerivedOrientation(), this->getWorldOrientation(), true));143 this->cameraNode_->setOrientation(Quaternion::Slerp(anglecoeff, this->cameraNode_->_getDerivedOrientation(), this->getWorldOrientation(), true)); 133 144 } 134 145
Note: See TracChangeset
for help on using the changeset viewer.