Commit 25bb855ec5e9a2ca0f40dfdb6087b37862826c1d
1 parent
b606443d
Stable basic skeleton with spider movement, panning and rotation implemented and functioning
Showing
2 changed files
with
46 additions
and
14 deletions
Show diff stats
TextureTest.cu
... | ... | @@ -79,6 +79,8 @@ glInit() |
79 | 79 | glOrtho(-5.0, 2.0,-5.0, 2.0, -0.0, 1000.0); |
80 | 80 | glMatrixMode(GL_MODELVIEW); |
81 | 81 | spidey = stim::gl_spider<float>(0.5, 0.5, 0.5, -0.1, -0.1, -0.1, 0.1, 0.1); |
82 | + Parker.setPosition(spidey.getPosition()); | |
83 | + Parker.LookAt(spidey.getDirection()); | |
82 | 84 | CHECK_OPENGL_ERROR |
83 | 85 | } |
84 | 86 | |
... | ... | @@ -336,11 +338,9 @@ void MouseMotion(int x, int y) |
336 | 338 | mousePos[1] = ((float)y - prevmousePos[1])*0.00001; |
337 | 339 | prevmousePos[0] = (float)x; |
338 | 340 | prevmousePos[1] = (float)y; |
339 | - Parker.setPosition(spidey.getPosition()); | |
340 | - Parker.LookAt(spidey.getDirection()); | |
341 | 341 | Parker.Pan(mousePos[0]*degtorad); |
342 | 342 | Parker.Tilt(mousePos[1]*degtorad); |
343 | - spidey.setDirection(Parker.getLookAt()); | |
343 | + spidey.setDirection(Parker.getDirection()); | |
344 | 344 | spidey.Update(); |
345 | 345 | std::cout << Parker.getLookAt() << std::endl; |
346 | 346 | } |
... | ... | @@ -365,13 +365,21 @@ switch(key) { |
365 | 365 | else{ |
366 | 366 | oriDrw[2] = oriDrw[2] + adjustDrw; |
367 | 367 | } |
368 | - if (glutGetModifiers() == 1) | |
368 | + if (glutGetModifiers() == GLUT_ACTIVE_SHIFT) | |
369 | 369 | { |
370 | 370 | stim::vec<float> temp = spidey.getPosition(); |
371 | - temp[1] += 0.0001; | |
371 | + temp[1] += 0.001; | |
372 | 372 | spidey.setPosition(temp); |
373 | 373 | spidey.Update(); |
374 | 374 | } |
375 | + if (glutGetModifiers() == GLUT_ACTIVE_CTRL) | |
376 | + { | |
377 | + //stim::vec<float> temp = Parker.getDirection(); | |
378 | + //temp[1] += 0.001; | |
379 | + Parker.Pan(0.01); | |
380 | + spidey.setDirection(Parker.getDirection()); | |
381 | + spidey.Update(); | |
382 | + } | |
375 | 383 | break; |
376 | 384 | case GLUT_KEY_DOWN: |
377 | 385 | oriTex[2] = oriTex[2]-adjustTex; |
... | ... | @@ -381,13 +389,21 @@ switch(key) { |
381 | 389 | else{ |
382 | 390 | oriDrw[2] = oriDrw[2] - adjustDrw; |
383 | 391 | } |
384 | - if (glutGetModifiers() == 1) | |
392 | + if (glutGetModifiers() == GLUT_ACTIVE_SHIFT) | |
385 | 393 | { |
386 | 394 | stim::vec<float> temp = spidey.getPosition(); |
387 | - temp[1] -= 0.0001; | |
395 | + temp[1] -= 0.001; | |
388 | 396 | spidey.setPosition(temp); |
389 | 397 | spidey.Update(); |
390 | - } | |
398 | + } | |
399 | + if (glutGetModifiers() == GLUT_ACTIVE_CTRL) | |
400 | + { | |
401 | + //stim::vec<float> temp = Parker.getDirection(); | |
402 | + //temp[1] -= 0.001; | |
403 | + Parker.Pan(-0.01); | |
404 | + spidey.setDirection(Parker.getDirection()); | |
405 | + spidey.Update(); | |
406 | + } | |
391 | 407 | break; |
392 | 408 | case GLUT_KEY_LEFT: |
393 | 409 | oriTex[1] = oriTex[1]+adjustTex; |
... | ... | @@ -397,13 +413,21 @@ switch(key) { |
397 | 413 | else{ |
398 | 414 | oriDrw[1] = oriDrw[1] + adjustDrw; |
399 | 415 | } |
400 | - if (glutGetModifiers() == 1) | |
416 | + if (glutGetModifiers() == GLUT_ACTIVE_SHIFT) | |
401 | 417 | { |
402 | 418 | stim::vec<float> temp = spidey.getPosition(); |
403 | - temp[0] += 0.0001; | |
419 | + temp[0] += 0.001; | |
404 | 420 | spidey.setPosition(temp); |
405 | 421 | spidey.Update(); |
406 | 422 | } |
423 | + if (glutGetModifiers() == GLUT_ACTIVE_CTRL) | |
424 | + { | |
425 | + //stim::vec<float> temp = Parker.getDirection(); | |
426 | + //temp[0] += 0.001; | |
427 | + Parker.Tilt(0.01); | |
428 | + spidey.setDirection(Parker.getDirection()); | |
429 | + spidey.Update(); | |
430 | + } | |
407 | 431 | break; |
408 | 432 | case GLUT_KEY_RIGHT: |
409 | 433 | oriTex[1] = oriTex[1]-adjustTex; |
... | ... | @@ -413,14 +437,22 @@ switch(key) { |
413 | 437 | else{ |
414 | 438 | oriDrw[1] = oriDrw[1] - adjustDrw; |
415 | 439 | } |
416 | - break; | |
417 | - if (glutGetModifiers() == 1) | |
440 | + if (glutGetModifiers() == GLUT_ACTIVE_SHIFT) | |
418 | 441 | { |
419 | 442 | stim::vec<float> temp = spidey.getPosition(); |
420 | - temp[0] -= 0.0001; | |
443 | + temp[0] -= 0.001; | |
421 | 444 | spidey.setPosition(temp); |
422 | 445 | spidey.Update(); |
423 | 446 | } |
447 | + if (glutGetModifiers() == GLUT_ACTIVE_CTRL) | |
448 | + { | |
449 | + //stim::vec<float> temp = Parker.getDirection(); | |
450 | + //temp[0] -= 0.001; | |
451 | + Parker.Tilt(-0.01); | |
452 | + spidey.setDirection(Parker.getDirection()); | |
453 | + spidey.Update(); | |
454 | + } | |
455 | + break; | |
424 | 456 | } |
425 | 457 | glutPostRedisplay(); |
426 | 458 | } | ... | ... |