Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7014 in orxonox.OLD for trunk/src/world_entities


Ignore:
Timestamp:
Feb 3, 2006, 2:14:22 PM (18 years ago)
Author:
bensch
Message:

trunk: new algorithm for the Camera-Distance

Location:
trunk/src/world_entities
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/camera.cc

    r7013 r7014  
    6565 * @returns The PNode of the Target (from there you can get position and so on
    6666*/
    67 PNode* Camera::getTarget()
     67PNode* Camera::getTargetNode() const
    6868{
    6969  return (PNode*)this->target;
     
    146146{
    147147  //update frustum plane
    148   this->viewVector = (this->getAbsCoor() -  this->target->getAbsCoor()).getNormalized();
    149   this->frustumPlane = Plane(this->viewVector, this->getAbsCoor() + this->viewVector * 3.0);
     148  this->viewVector = (this->target->getAbsCoor() - this->getAbsCoor()).getNormalized();
     149  this->frustumPlane = Plane(this->viewVector, this->getAbsCoor() + this->viewVector * 0.1);
    150150
    151151  this->upVector =  this->getAbsDirV();
  • trunk/src/world_entities/camera.h

    r7013 r7014  
    3737
    3838  void lookAt(PNode* target);
    39   PNode* getTarget();
     39  CameraTarget* getTarget() const { return this->target; };
     40  PNode* getTargetNode() const;
    4041
    4142  void setAspectRatio(float aspectRatio);
  • trunk/src/world_entities/creatures/md2_creature.cc

    r6990 r7014  
    119119  this->cameraConnNode.setName("CameraConnectorNode");
    120120  this->addChild(&this->cameraConnNode);
    121   this->cameraConnNode.addChild(State::getCameraTarget());
    122   this->cameraConnNode.addChild(State::getCamera());
    123   State::getCameraTarget()->setRelCoor(10,0,0);
     121  this->cameraConnNode.addChild(State::getCameraTargetNode());
     122  this->cameraConnNode.addChild(State::getCameraNode());
     123  State::getCameraTargetNode()->setRelCoor(10,0,0);
    124124
    125125  travelSpeed = 15.0;
  • trunk/src/world_entities/playable.cc

    r7010 r7014  
    285285void  Playable::attachCamera()
    286286{
    287   State::getCamera()->setParentSoft(this);
    288   State::getCameraTarget()->setParentSoft(this);
     287  State::getCameraNode()->setParentSoft(this);
     288  State::getCameraTargetNode()->setParentSoft(this);
    289289
    290290}
  • trunk/src/world_entities/space_ships/helicopter.cc

    r6997 r7014  
    203203{
    204204  dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( true);
    205   State::getCamera()->setParentSoft(this->getWeaponManager()->getFixedTarget());
    206   State::getCameraTarget()->setParentSoft(this->getWeaponManager()->getFixedTarget());
     205  State::getCameraNode()->setParentSoft(this->getWeaponManager()->getFixedTarget());
     206  State::getCameraTargetNode()->setParentSoft(this->getWeaponManager()->getFixedTarget());
    207207}
    208208
  • trunk/src/world_entities/space_ships/hover.cc

    r6999 r7014  
    192192  dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( true);
    193193
    194   State::getCamera()->setParentSoft(&this->cameraNode);
    195   State::getCamera()->setRelCoorSoft(-10, 0,0);
    196   State::getCameraTarget()->setParentSoft(&this->cameraNode);
     194  State::getCameraNode()->setParentSoft(&this->cameraNode);
     195  State::getCameraNode()->setRelCoorSoft(-10, 0,0);
     196  State::getCameraTargetNode()->setParentSoft(&this->cameraNode);
    197197}
    198198
  • trunk/src/world_entities/space_ships/turbine_hover.cc

    r7004 r7014  
    222222  dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( true);
    223223
    224   State::getCamera()->setParentSoft(&this->cameraNode);
    225   State::getCamera()->setRelCoorSoft(-10, 0,0);
    226   State::getCameraTarget()->setParentSoft(&this->cameraNode);
     224  State::getCameraNode()->setParentSoft(&this->cameraNode);
     225  State::getCameraNode()->setRelCoorSoft(-10, 0,0);
     226  State::getCameraTargetNode()->setParentSoft(&this->cameraNode);
    227227}
    228228
  • trunk/src/world_entities/terrain.cc

    r6956 r7014  
    241241glPushMatrix();
    242242glLoadIdentity();
    243  Vector camera =   State::getCamera()->getAbsCoor(); // Go on here ..........!!!
     243 Vector camera =   State::getCameraNode()->getAbsCoor(); // Go on here ..........!!!
    244244
    245245    /*
  • trunk/src/world_entities/world_entity.cc

    r6959 r7014  
    3030
    3131#include "state.h"
     32#include "camera.h"
    3233
    3334using namespace std;
     
    319320
    320321    // This Draws the LOD's
    321     float cameraDistance = (State::getCamera()->getAbsCoor() - this->getAbsCoor()).len();
     322    float cameraDistance = State::getCamera()->distance(this);
     323    printf("%s::%s, distance %f\n", this->getClassName(), this->getName(), cameraDistance);
    322324    if (cameraDistance > 30 && this->models.size() >= 3 && this->models[2] != NULL)
    323325    {
Note: See TracChangeset for help on using the changeset viewer.