Changeset 3105 for GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
- Timestamp:
- 11/06/08 15:14:49 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3103 r3105 175 175 bool descendKeyPressed = false; 176 176 bool ascendKeyPressed = false; 177 bool leftStrafeKeyPressed = false; 178 bool rightStrafeKeyPressed = false; 179 177 180 bool altKeyPressed = false; 178 181 … … 844 847 845 848 849 void KeyStrafe(float shift) 850 { 851 Vector3 viewDir = camera->GetDirection(); 852 Vector3 pos = camera->GetPosition(); 853 854 // the 90 degree rotated view vector 855 // z zero so we don't move in the vertical 856 Vector3 rVec(viewDir[0], viewDir[1], 0); 857 858 Matrix4x4 rot = RotationZMatrix(M_PI * 0.5f); 859 rVec = rot * rVec; 860 pos += rVec * shift; 861 862 camera->SetPosition(pos); 863 } 864 865 846 866 /** Initialize the deferred rendering pass. 847 867 */ … … 899 919 if (descendKeyPressed) 900 920 KeyVerticalMotion(-KeyShift()); 921 if (leftStrafeKeyPressed) 922 KeyStrafe(KeyShift()); 923 if (rightStrafeKeyPressed) 924 KeyStrafe(-KeyShift()); 925 901 926 902 927 // place view on ground … … 1218 1243 downKeyPressed = true; 1219 1244 break; 1245 case 'j': 1246 case 'J': 1247 leftStrafeKeyPressed = true; 1248 break; 1249 case 'k': 1250 case 'K': 1251 rightStrafeKeyPressed = true; 1252 break; 1220 1253 case 'r': 1221 1254 case 'R': … … 1297 1330 ascendKeyPressed = false; 1298 1331 break; 1299 1332 case 'j': 1333 case 'J': 1334 leftStrafeKeyPressed = false; 1335 break; 1336 case 'k': 1337 case 'K': 1338 rightStrafeKeyPressed = false; 1339 break; 1300 1340 default: 1301 1341 return; … … 1505 1545 1506 1546 1507 // strafe 1547 /** strafe 1548 */ 1508 1549 void MiddleMotion(int x, int y) 1509 1550 {
Note: See TracChangeset
for help on using the changeset viewer.