- Timestamp:
- 06/20/08 20:22:58 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r2793 r2794 95 95 bool upKeyPressed = false; 96 96 bool downKeyPressed = false; 97 bool nineKeyPressed = false; 98 bool eightKeyPressed = false; 99 97 100 98 101 void InitExtensions(); … … 125 128 126 129 void KeyHorizontalMotion(float shift); 130 void KeyVerticalMotion(float shift); 127 131 void KeyRotate(float angle); 128 132 … … 441 445 442 446 447 void KeyVerticalMotion(float shift) 448 { 449 Vector3 uvec = Vector3(0, 0, shift); 450 451 Vector3 pos = camera->GetPosition(); 452 pos += uvec; 453 454 camera->SetPosition(pos); 455 } 456 457 458 443 459 void Display() 444 460 { … … 451 467 if (downKeyPressed) 452 468 KeyHorizontalMotion(-keyForwardMotion); 469 if (eightKeyPressed) 470 KeyVerticalMotion(keyForwardMotion); 471 if (nineKeyPressed) 472 KeyVerticalMotion(-keyForwardMotion); 453 473 454 474 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); … … 471 491 void KeyBoard(unsigned char c, int x, int y) 472 492 { 473 // used to avoid vertical motion with the keys474 Vector3 hvec = Vector3(camera->GetDirection()[0], camera->GetDirection()[1], 0.0f);475 Vector3 uvec = Vector3(0, 0, 1);476 477 493 switch(c) 478 494 { … … 514 530 case '8': 515 531 { 516 Vector3 pos = camera->GetPosition(); 517 pos += uvec * keyForwardMotion; 518 camera->SetPosition(pos); 532 eightKeyPressed = true; 533 KeyVerticalMotion(keyForwardMotion); 519 534 break; 520 535 } 521 536 case '9': 522 537 { 523 Vector3 pos = camera->GetPosition(); 524 pos -= uvec * keyForwardMotion; 525 camera->SetPosition(pos); 538 nineKeyPressed = true; 539 KeyVerticalMotion(-keyForwardMotion); 526 540 break; 527 541 } … … 627 641 downKeyPressed = false; 628 642 break; 643 case '8': 644 eightKeyPressed = false; 645 break; 646 647 case '9': 648 nineKeyPressed = false; 649 break; 650 629 651 default: 630 652 return;
Note: See TracChangeset
for help on using the changeset viewer.