Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6195


Ignore:
Timestamp:
Dec 2, 2009, 2:40:22 PM (14 years ago)
Author:
wirthmi
Message:

More camera easing, new center overlay and pauseControl/resumeControl

Location:
code/branches/presentation2/src/orxonox
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2/src/orxonox/controllers/Controller.h

    r6111 r6195  
    4040        friend class PlayerInfo;
    4141        friend class ControllableEntity;
    42        
     42
    4343        public:
    4444            Controller(BaseObject* creator);
  • code/branches/presentation2/src/orxonox/controllers/HumanController.cc

    r6191 r6195  
    6969        RegisterObject(HumanController);
    7070
     71        controlPaused_ = false;
     72
    7173        HumanController::localController_s = this;
    7274    }
     
    250252            HumanController::localController_s->controllableEntity_->getScene()->getRadar()->releaseFocus();
    251253    }
     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    }
    252266}
  • code/branches/presentation2/src/orxonox/controllers/HumanController.h

    r6159 r6195  
    7575            static void killBots(unsigned int amount = 0);
    7676
     77            static void pauseControl();
     78            static void resumeControl();
     79            virtual void doPauseControl() {};
     80            virtual void doResumeControl() {};
     81
    7782            static inline HumanController* getLocalControllerSingleton()
    7883                { return HumanController::localController_s; }
     
    8388        protected:
    8489            static HumanController* localController_s;
     90            bool controlPaused_;
    8591    };
    8692}
  • code/branches/presentation2/src/orxonox/controllers/NewHumanController.cc

    r6173 r6195  
    5757        : HumanController(creator)
    5858        , crossHairOverlay_(NULL)
     59        , centerOverlay_(NULL)
    5960    {
    6061        RegisterObject(NewHumanController);
     
    7273            crossHairOverlay_->setBackgroundMaterial("Orxonox/Crosshair3");
    7374            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();
    7582        }
    7683
     
    8188
    8289        NewHumanController::localController_s = this;
     90
     91//HumanController::localController_s->getControllableEntity()->getCamera()->setDrag(true);
    8392    }
    8493
     
    99108            {
    100109                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 {
    105117                this->crossHairOverlay_->hide();
    106             // TODO: update aimPosition of Pawn
     118                this->centerOverlay_->hide();
     119            }
    107120
    108121            if ( this->acceleration_ > 0 )
     
    229242                }
    230243
    231                 itr->movable->getParentSceneNode()->showBoundingBox(true);
     244                //itr->movable->getParentSceneNode()->showBoundingBox(true);
    232245                //std::cout << itr->movable->getParentSceneNode()->_getDerivedPosition() << endl;
    233246                //return mouseRay.getOrigin() + mouseRay.getDirection() * itr->distance; //or itr->movable->getParentSceneNode()->_getDerivedPosition()
     
    308321        }
    309322    }
     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    }
    310335}
  • code/branches/presentation2/src/orxonox/controllers/NewHumanController.h

    r6173 r6195  
    5959
    6060            virtual void changedControllableEntity();
     61            virtual void doPauseControl();
     62            virtual void doResumeControl();
    6163
    6264        protected:
     
    6971            float                       currentPitch_;
    7072            OrxonoxOverlay*             crossHairOverlay_;
     73            OrxonoxOverlay*             centerOverlay_;
    7174            float                       overlaySize_;
    7275            bool                        accelerating_;
  • code/branches/presentation2/src/orxonox/graphics/Camera.cc

    r6191 r6195  
    114114        {
    115115            // 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();
    117118            // Only clamp if fps rate is actually falling. Occasional high dts should
    118119            // not be clamped to reducing lagging effects.
    119             if (coeff > 1.0f)
     120            if (poscoeff > 1.0f)
    120121            {
    121122                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;
    123134                else
    124135                    this->lastDtLagged_ = true;
     
    128139
    129140            Vector3 offset = this->getWorldPosition() - this->cameraNode_->_getDerivedPosition();
    130             this->cameraNode_->translate(coeff * offset);
     141            this->cameraNode_->translate(poscoeff * offset);
    131142
    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));
    133144        }
    134145
Note: See TracChangeset for help on using the changeset viewer.