Changeset 10128 in orxonox.OLD for branches/camera/src/world_entities
- Timestamp:
- Dec 20, 2006, 4:34:00 PM (18 years ago)
- Location:
- branches/camera/src/world_entities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/camera/src/world_entities/camera.cc
r10122 r10128 22 22 #include "shell_command.h" 23 23 #include "targets.h" 24 #include <iostream.h> 25 24 26 25 27 ObjectListDefinition(Camera); … … 291 293 SHELL_COMMAND(det, CameraTarget, detach); 292 294 SHELL_COMMAND(tes, CameraTarget, test); 293 295 SHELL_COMMAND(tr, CameraTarget,trans); 296 SHELL_COMMAND(t2, CameraTarget,test2); 294 297 295 298 … … 308 311 rotateBy.y=0; 309 312 rotateBy.z=0; 310 //target=State::getCamera()->getTargetNode();313 target=createStick(); 311 314 312 315 } … … 323 326 // State::getCameraTargetNode()->setParentSoft(PNode::getNullParent()); 324 327 } 328 329 PNode* CameraTarget::createStick() 330 { 331 return new Targets(); 332 } 333 325 334 326 335 void CameraTarget::atach(PNode* object) … … 345 354 void CameraTarget::translate(float speed, float dt) 346 355 { 347 if (translateTo.x >= 0.01+ State::getCameraNode()->getAbsCoorX() || translateTo.y348 >= 0.01+ State::getCameraNode()->getAbsCoorX()|| translateTo.z349 >= 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) 350 359 { 351 360 Vector tmpVec= iterate(dt, &translateTo, &(State::getCameraNode()->getAbsCoor())); 352 361 glLoadIdentity(); 353 362 //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); 355 365 } 356 366 } … … 364 374 { 365 375 376 } 377 378 379 void CameraTarget::trans(float x, float y, float z) 380 { 381 Vector tmpVec=Vector(x,y,z); 382 translateNow(&tmpVec); 366 383 } 367 384 … … 381 398 void CameraTarget::test() 382 399 { 383 Targets* tar=new Targets(); 384 atach(tar); 400 glLoadIdentity(); 401 402 atach(target); 403 404 //tar->setRelCoorSoft(1000,1000,1000); 385 405 386 406 … … 394 414 395 415 396 397 398 416 void 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 108 108 void test(); 109 109 void translateNow(Vector* vec); 110 PNode* createStick(); 111 void trans(float x, float y, float z); 112 void test2(); 110 113 }; 111 114
Note: See TracChangeset
for help on using the changeset viewer.