Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10128 in orxonox.OLD for branches/camera/src


Ignore:
Timestamp:
Dec 20, 2006, 4:34:00 PM (18 years ago)
Author:
gfilip
Message:

finally

Location:
branches/camera/src/world_entities
Files:
2 edited

Legend:

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

    r10122 r10128  
    2222#include "shell_command.h"
    2323#include "targets.h"
     24#include <iostream.h>
     25
    2426
    2527ObjectListDefinition(Camera);
     
    291293SHELL_COMMAND(det, CameraTarget, detach);
    292294SHELL_COMMAND(tes, CameraTarget, test);
    293 
     295SHELL_COMMAND(tr, CameraTarget,trans);
     296SHELL_COMMAND(t2, CameraTarget,test2);
    294297
    295298
     
    308311  rotateBy.y=0;
    309312  rotateBy.z=0;
    310   //target=State::getCamera()->getTargetNode();
     313  target=createStick();
    311314
    312315}
     
    323326 // State::getCameraTargetNode()->setParentSoft(PNode::getNullParent());
    324327}
     328
     329PNode* CameraTarget::createStick()
     330{
     331  return new Targets();
     332}
     333
    325334
    326335void CameraTarget::atach(PNode* object)
     
    345354void CameraTarget::translate(float speed, float dt)
    346355{
    347   if (translateTo.x >= 0.01+State::getCameraNode()->getAbsCoorX() || translateTo.y
    348       >= 0.01+State::getCameraNode()->getAbsCoorX() || translateTo.z
    349       >= 0.01+State::getCameraNode()->getAbsCoorX())
     356  if (translateTo.x >= 0.01+target->getAbsCoorX() || translateTo.y >= 0.01+target->getAbsCoorY() || translateTo.z
     357      >= 0.01+target->getAbsCoorZ() || translateTo.x <= target->getAbsCoorX()-0.01 || translateTo.y <= target->getAbsCoorY()-0.01 || translateTo.z
     358      <= target->getAbsCoorZ()-0.01)
    350359  {
    351360    Vector tmpVec= iterate(dt,  &translateTo,  &(State::getCameraNode()->getAbsCoor()));
    352361    glLoadIdentity();
    353362    //glTranslatef(
    354     State::getCamera()->getTargetNode()->setAbsCoor(tmpVec.x, tmpVec.y, tmpVec.z);
     363    cout << tmpVec.x;
     364    target->setAbsCoor(target->getAbsCoorX()+tmpVec.x, target->getAbsCoorY()+tmpVec.y, target->getAbsCoorZ()+tmpVec.z);
    355365  }
    356366}
     
    364374{
    365375
     376}
     377
     378
     379void CameraTarget::trans(float x, float y, float z)
     380{
     381  Vector tmpVec=Vector(x,y,z);
     382  translateNow(&tmpVec);
    366383}
    367384
     
    381398void CameraTarget::test()
    382399{
    383 Targets* tar=new Targets();
    384 atach(tar);
     400  glLoadIdentity();
     401
     402atach(target);
     403
     404//tar->setRelCoorSoft(1000,1000,1000);
    385405
    386406
     
    394414
    395415
    396 
    397 
    398 
     416void CameraTarget::test2()
     417{
     418  trans(-200, 0, 0);
     419  //target->setAbsCoor(target->getAbsCoorX()-200, target->getAbsCoorY(), target->getAbsCoorZ());
     420}
     421
     422
  • branches/camera/src/world_entities/camera.h

    r10122 r10128  
    108108  void test();
    109109  void translateNow(Vector* vec);
     110  PNode* createStick();
     111  void trans(float x, float y, float z);
     112  void test2();
    110113};
    111114
Note: See TracChangeset for help on using the changeset viewer.