Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10270 in orxonox.OLD for branches/playability/src


Ignore:
Timestamp:
Jan 17, 2007, 5:52:08 PM (18 years ago)
Author:
muellmic
Message:

1) the centerpoint of the radar is now the centerpoint of the camera, so the enemies won't move in the radar when the player is moving; 2)fovy and cameradistance of each viewmode can now be set dynamically. so one would't have to readjust the fovy for each viewmode, when it has been manually changed once. (it's better to just change the fovy or distance for the viewmode where you need it); 3)unlike in the last revision, it doesnt have a soft- zoom- effect when setting a fovy anymore.

Location:
branches/playability/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/playability/src/story_entities/menu/game_menu.cc

    r9869 r10270  
    111111
    112112  this->dataTank->localCamera->setRelCoor(this->cameraVector);
     113  //this->dataTank->localCamera->setFovy(60);
    113114
    114115  GraphicsEngine::getInstance()->displayFPS(false);
  • branches/playability/src/util/hud.cc

    r10234 r10270  
    3030#include "specials/glgui_notifier.h"
    3131#include "elements/glgui_radar.h"
     32#include "world_entities/space_ships/space_ship.h"
    3233
    3334
     
    6970
    7071  this->_radar = new OrxGui::GLGuiRadar();
     72  this->radarCenterNode = NULL;
    7173
    7274  this->subscribeEvent(ES_ALL, EV_VIDEO_RESIZE);
     
    329331    PRINTF(4)("UPDATING RADAR\n");
    330332    this->_radar->setParent2D(this->leftRect);
    331     this->_radar->setCenterNode(State::getPlayer()->getPlayable());
     333    if (radarCenterNode == NULL)
     334      this->_radar->setCenterNode(State::getPlayer()->getPlayable());
     335    else
     336      this->_radar->setCenterNode(this->radarCenterNode);
     337
    332338    //this->_radar->addEntityList(&State::getObjectManager()->getEntityList((OM_LIST)(State::getPlayer()->getPlayable()->getOMListNumber()+1)), Color(.4, .4, 1.0));
    333339    this->_radar->addEntityList(&State::getObjectManager()->getEntityList(OM_GROUP_00), Color(1, 0, 0));
  • branches/playability/src/util/hud.h

    r10233 r10270  
    4646
    4747  void setWeaponManager(WeaponManager* weaponMan, WeaponManager* weaponManSec = NULL);
     48  inline void setRadarCenterNode(PNode* node) {this->radarCenterNode = node;};
    4849
    4950  void addWeaponWidget(OrxGui::GLGuiWidget* widget);
     
    9091  OrxGui::GLGuiInputLine*  inputLine;
    9192  OrxGui::GLGuiRadar*      _radar;
     93  PNode*                   radarCenterNode;
    9294
    9395  OrxGui::GLGuiWidget*     rightRect;
  • branches/playability/src/world_entities/camera.cc

    r10251 r10270  
    1818#include "key_mapper.h"
    1919#include "glincl.h"
     20//#include "util/loading/load_param.h"
     21#include "world_entity.h"
    2022
    2123ObjectListDefinition(Camera);
     
    2729{
    2830  this->registerObject(this, Camera::_objectList);
     31  this->init();
     32}
     33
     34/*
     35Camera::Camera(const TiXmlElement* root)
     36{
     37  this->registerObject(this, Camera::_objectList);
     38  this->init();
     39  this->loadParams(root);
     40}
     41*/
     42
     43/**
     44 *  default destructor
     45*/
     46Camera::~Camera()
     47{}
     48
     49void Camera::init()
     50{
    2951  this->setName("camera");
    3052  this->target = new CameraTarget();
     
    3759  this->subscribeEvent(ES_GAME, KeyMapper::PEV_VIEW5);
    3860
    39   this->setFovy(90);
     61  //this->setFovy(90);
    4062  this->setAspectRatio(1.33f);
    4163  this->setClipRegion(.1, 10000);
     64 
     65  this->viewTopFovy = 60;
     66  this->viewNormalFovy = 90;
     67  this->viewFrontFovy = 120;
     68  this->viewRightFovy = 90;
     69  this->viewLeftFovy = 90;
     70
     71  this->viewTopDistance = 70;
     72  this->viewNormalDistance = 10;
     73  this->viewFrontDistance = 4;
     74  this->viewRightDistance = 10;
     75  this->viewLeftDistance = 10;
     76
     77  //this->loadParams(doc.RootElement());
    4278
    4379  this->setViewMode(Camera::ViewNormal);
     
    4581  this->setParentMode(PNODE_ALL);
    4682  this->eventHandling = true;
    47 
    48 
    49 }
    50 
    51 /**
    52  *  default destructor
    53 */
    54 Camera::~Camera()
    55 {}
     83}
    5684
    5785/**
     
    104132    case Camera::ViewNormal:
    105133    {
    106       this->toFovy = 60.0;
    107       this->setRelCoorSoft(-10, 5, 0);
     134      this->fovy = viewNormalFovy;
     135      this->toFovy = viewNormalFovy;
     136      //this->fovy = 60;
     137      //this->toFovy = 60;
     138      this->setRelCoorSoft(-2.0/3.0 * this->viewNormalDistance, 1.0/3.0 * this->viewNormalDistance, 0);
    108139      this->target->setRelCoorSoft(0,0,0);
    109140      break;
     
    113144    case Camera::ViewFront:
    114145    {
    115       this->toFovy = 120.0;
    116       this->setRelCoorSoft(4, 0, 0, 5);
     146      this->fovy = viewFrontFovy;
     147      this->toFovy = viewFrontFovy;
     148      this->setRelCoorSoft(this->viewFrontDistance, 0, 0, 5);
    117149      this->target->setRelCoorSoft(Vector(10,0,0), 5);
    118150      break;
     
    120152    case Camera::ViewLeft:
    121153    {
    122       this->toFovy = 90;
    123       this->setRelCoorSoft(0, 1, -10, .5);
     154      this->fovy = viewLeftFovy;
     155      this->toFovy = viewLeftFovy;
     156      this->setRelCoorSoft(0, 1, -viewLeftDistance, .5);
    124157      this->target->setRelCoorSoft(0,0,0);
    125158      break;
     
    127160    case Camera::ViewRight:
    128161    {
    129       this->toFovy = 90;
    130       this->setRelCoorSoft(Vector(0, 1, 10));
     162      this->fovy = viewRightFovy;
     163      this->toFovy = viewRightFovy;
     164      this->setRelCoorSoft(Vector(0, 1, viewRightDistance), 0.5);
    131165      this->target->setRelCoorSoft(0,0,0);
    132166      break;
     
    134168    case Camera::ViewTop:
    135169    {
    136       this->toFovy= 30;
    137       this->setRelCoor(Vector(-0.05, 200 , 0));
     170      this->fovy= viewTopFovy;
     171      this->toFovy = viewTopFovy;
     172      this->setRelCoorSoft(Vector(-0.05, this->viewTopDistance , 0), 0.5);
    138173      this->target->setRelCoor(0,0,0);
    139174    }
     
    234269}
    235270
     271/*
     272void Camera::loadParams(const TiXmlElement* root)
     273{
     274  // Do the PNode loading stuff
     275  PNode::loadParams(root);
     276
     277  LoadParam(root, "viewTopFovy", this, Camera, setViewTopFovy);
     278  LoadParam(root, "viewFrontFovy", this, Camera, setViewFrontFovy);
     279  LoadParam(root, "viewLeftFovy", this, Camera, setViewLeftFovy);
     280  LoadParam(root, "viewRightFovy", this, Camera, setViewRightFovy);
     281  LoadParam(root, "viewBehindFovy", this, Camera, setViewBehindFovy);
     282  LoadParam(root, "viewNormalFovy", this, Camera, setViewNormalFovy);
     283
     284  LoadParam(root, "viewTopDistance", this, Camera, setViewTopDistance);
     285  LoadParam(root, "viewFrontDistance", this, Camera, setViewFrontDistance);
     286  LoadParam(root, "viewLeftDistance", this, Camera, setViewLeftDistance);
     287  LoadParam(root, "viewRightDistance", this, Camera, setViewRightDistance);
     288  LoadParam(root, "viewBehindDistance", this, Camera, setViewBehindDistance);
     289  LoadParam(root, "viewNormalDistance", this, Camera, setViewNormalDistance);
     290}
     291*/
     292
     293void Camera::setViewTopFovy(float fovy)
     294{
     295  this->viewTopFovy = fovy;
     296}
     297
     298void Camera::setViewFrontFovy(float fovy)
     299{
     300  this->viewFrontFovy = fovy;
     301}
     302
     303void Camera::setViewLeftFovy(float fovy)
     304{
     305  this->viewLeftFovy = fovy;
     306}
     307
     308void Camera::setViewRightFovy(float fovy)
     309{
     310  this->viewRightFovy = fovy;
     311}
     312
     313void Camera::setViewBehindFovy(float fovy)
     314{
     315  this->viewBehindFovy = fovy;
     316}
     317
     318void Camera::setViewNormalFovy(float fovy)
     319{
     320  this->viewNormalFovy = fovy;
     321}
     322
     323void Camera::setViewTopDistance(float Distance)
     324{
     325  this->viewTopDistance = Distance;
     326}
     327
     328void Camera::setViewFrontDistance(float Distance)
     329{
     330  this->viewFrontDistance = Distance;
     331}
     332
     333void Camera::setViewLeftDistance(float Distance)
     334{
     335  this->viewLeftDistance = Distance;
     336}
     337
     338void Camera::setViewRightDistance(float Distance)
     339{
     340  this->viewRightDistance = Distance;
     341}
     342
     343void Camera::setViewBehindDistance(float Distance)
     344{
     345  this->viewBehindDistance = Distance;
     346}
     347
     348void Camera::setViewNormalDistance(float Distance)
     349{
     350  this->viewNormalDistance = Distance;
     351}
     352
    236353
    237354///////////////////
  • branches/playability/src/world_entities/camera.h

    r10237 r10270  
    3636
    3737  Camera();
     38  Camera(const TiXmlElement* root);
    3839  virtual ~Camera();
    3940
     
    4647
    4748  /** @param fovy new field of view factor (in degrees) */
    48   void setFovy(float fovy) { this->fovy = fovy; };
     49  inline void setFovy(float fovy)
     50  {
     51    this->fovy = fovy;
     52    this->toFovy = fovy;
     53  };
    4954  /** @param fovy new field of view factor (in degrees) to iterate to */
    5055  void setToFovy(float toFovy) { this->toFovy = toFovy; };
     
    6772  void process(const Event &event);
    6873
     74  //virtual void loadParams(const TiXmlElement* root);
     75
     76  void              setViewTopFovy(float fovy);
     77  void              setViewLeftFovy(float fovy);
     78  void              setViewRightFovy(float fovy);
     79  void              setViewBehindFovy(float fovy);
     80  void              setViewFrontFovy(float fovy);
     81  void              setViewNormalFovy(float fovy);
     82
     83  void              setViewTopDistance(float Distance);
     84  void              setViewLeftDistance(float Distance);
     85  void              setViewRightDistance(float Distance);
     86  void              setViewBehindDistance(float Distance);
     87  void              setViewFrontDistance(float Distance);
     88  void              setViewNormalDistance(float Distance);
     89
    6990private:
     91
     92  void              init();
     93
    7094  CameraTarget*     target;          //!< The Target of the Camera (where this Camera Looks at)
    7195
     
    84108  Vector            viewVector;      //!< the direction of the camera view
    85109  Vector            upVector;        //!< direction of the up vector
     110
     111  float             viewTopFovy;
     112  float             viewLeftFovy;
     113  float             viewRightFovy;
     114  float             viewBehindFovy;
     115  float             viewFrontFovy;
     116  float             viewNormalFovy;
     117
     118  float             viewTopDistance;
     119  float             viewLeftDistance;
     120  float             viewRightDistance;
     121  float             viewBehindDistance;
     122  float             viewFrontDistance;
     123  float             viewNormalDistance;
     124 
    86125};
    87126
  • branches/playability/src/world_entities/space_ships/space_ship.cc

    r10261 r10270  
    395395
    396396  LoadParam(root, "playmode", this, SpaceShip, setPlaymodeXML);
     397  LoadParam(root, "cameraDistance", this, SpaceShip, setCameraDistance);
     398  LoadParam(root, "cameraFovy", this, SpaceShip, setCameraFovy);
    397399}
    398400
     
    418420  this->secWeaponMan.showCrosshair();
    419421  this->toList( OM_GROUP_01 );
     422  State::getPlayer()->hud().setRadarCenterNode(this->travelNode);
    420423  State::getPlayer()->hud().setOverlayActive(true);
    421424  //dynamic_cast <OrxGui::GLGuiEnergyWidgetVertical*> (State::getPlayer()->hud().getArmorWidget())->setDisplayedName("Armor");
     
    431434  State::getPlayer()->hud().setOverlayActive(false);
    432435  State::getCamera()->setEventHandling(true);
     436  State::getPlayer()->hud().setRadarCenterNode(NULL);
    433437  //dynamic_cast<Element2D*>(this->secWeaponMan.getFixedTarget())->setVisibility( false);
    434438  //this->detachCamera();
     
    10801084  }
    10811085}
     1086
     1087void SpaceShip::setCameraDistance(float dist)
     1088{
     1089  State::getCamera()->setViewTopDistance(dist);
     1090}
     1091
     1092void SpaceShip::setCameraFovy(float fovy)
     1093{
     1094  State::getCamera()->setViewTopFovy(fovy);
     1095}
  • branches/playability/src/world_entities/space_ships/space_ship.h

    r10261 r10270  
    7171    inline float getElectronicCur() { return this->electronicCur; }; //!< returns current electronic value
    7272    inline float getElectronicMax() { return this->electronicMax; }; //!< returns current electronic value
     73
     74    inline PNode* getTravelNode() { return this->travelNode; };
    7375
    7476    //damage handler
     
    179181    float                 cameraSpeed;
    180182
     183    void                  setCameraDistance(float dist);
     184    void                  setCameraFovy(float fovy);
     185
    181186    /*
    182187    Quaternion            mouseDir;           //!< the direction where the player wants to fly
Note: See TracChangeset for help on using the changeset viewer.