Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 16, 2007, 7:55:24 PM (18 years ago)
Author:
gfilip
Message:

black camera

File:
1 edited

Legend:

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

    r10236 r10238  
    1919#include "glincl.h"
    2020#include "vector.h"
    21 #include "state.h"
    2221#include "shell_command.h"
    2322#include "targets.h"
     
    3736  this->setName("camera");
    3837  this->target = new CameraTarget();
    39 
     38  this->target->masta=this;
    4039  this->subscribeEvent(ES_GAME, KeyMapper::PEV_VIEW0);
    4140  this->subscribeEvent(ES_GAME, KeyMapper::PEV_VIEW1);
     
    318317  rotateBy.z=0;
    319318  target=createStick();
    320 
    321319}
    322320
     
    324322void CameraTarget::detach()
    325323{
    326   State::getCameraNode()->setParentSoft(target);
    327   State::getCameraTargetNode()->setParentSoft(target);
     324  masta->setParentSoft(target);
     325  masta->getTargetNode()->setParentSoft(target);
    328326}
    329327
     
    336334void CameraTarget::atach(PNode* object)
    337335{
    338   State::getCameraNode()->setParentSoft(object);
    339   State::getCameraTargetNode()->setParentSoft(object);
    340 }
    341 
    342 
    343 
    344 
    345 Vector CameraTarget::iterate(float dt, const Vector* target, const Vector* cam)
     336  masta->setParentSoft(object);
     337  masta->getTargetNode()->setParentSoft(object);
     338}
     339
     340
     341
     342
     343Vector CameraTarget::iterate(float dt, const Vector* Target, const Vector* cam)
    346344{
    347345
    348346
    349347  Vector tmpVec;
    350   tmpVec= (*target - *cam);
     348  tmpVec= (*Target - *cam);
    351349  tmpVec.normalize();
    352350  return  tmpVec;
     
    360358 {
    361359
    362    Vector tmpVec= iterate(dt,  &translateTo,  &(State::getCameraNode()->getAbsCoor()));
     360   Vector tmpVec= iterate(dt,  &translateTo,  &(masta->getAbsCoor()));
    363361    glLoadIdentity();
    364362    target->shiftCoor(speed*tmpVec.x, speed*tmpVec.y, speed*tmpVec.z);
     
    399397void CameraTarget::test()
    400398{
    401 glLoadIdentity();
    402 
    403 atach(target);
    404 
     399  atach(target);
    405400}
    406401
Note: See TracChangeset for help on using the changeset viewer.