From 25bb855ec5e9a2ca0f40dfdb6087b37862826c1d Mon Sep 17 00:00:00 2001 From: Pavel Govyadinov Date: Tue, 14 Apr 2015 15:38:45 -0500 Subject: [PATCH] Stable basic skeleton with spider movement, panning and rotation implemented and functioning --- TextureTest.cu | 58 +++++++++++++++++++++++++++++++++++++++++++++------------- stim | 2 +- 2 files changed, 46 insertions(+), 14 deletions(-) diff --git a/TextureTest.cu b/TextureTest.cu index b76e1e5..85036ab 100644 --- a/TextureTest.cu +++ b/TextureTest.cu @@ -79,6 +79,8 @@ glInit() glOrtho(-5.0, 2.0,-5.0, 2.0, -0.0, 1000.0); glMatrixMode(GL_MODELVIEW); spidey = stim::gl_spider(0.5, 0.5, 0.5, -0.1, -0.1, -0.1, 0.1, 0.1); + Parker.setPosition(spidey.getPosition()); + Parker.LookAt(spidey.getDirection()); CHECK_OPENGL_ERROR } @@ -336,11 +338,9 @@ void MouseMotion(int x, int y) mousePos[1] = ((float)y - prevmousePos[1])*0.00001; prevmousePos[0] = (float)x; prevmousePos[1] = (float)y; - Parker.setPosition(spidey.getPosition()); - Parker.LookAt(spidey.getDirection()); Parker.Pan(mousePos[0]*degtorad); Parker.Tilt(mousePos[1]*degtorad); - spidey.setDirection(Parker.getLookAt()); + spidey.setDirection(Parker.getDirection()); spidey.Update(); std::cout << Parker.getLookAt() << std::endl; } @@ -365,13 +365,21 @@ switch(key) { else{ oriDrw[2] = oriDrw[2] + adjustDrw; } - if (glutGetModifiers() == 1) + if (glutGetModifiers() == GLUT_ACTIVE_SHIFT) { stim::vec temp = spidey.getPosition(); - temp[1] += 0.0001; + temp[1] += 0.001; spidey.setPosition(temp); spidey.Update(); } + if (glutGetModifiers() == GLUT_ACTIVE_CTRL) + { + //stim::vec temp = Parker.getDirection(); + //temp[1] += 0.001; + Parker.Pan(0.01); + spidey.setDirection(Parker.getDirection()); + spidey.Update(); + } break; case GLUT_KEY_DOWN: oriTex[2] = oriTex[2]-adjustTex; @@ -381,13 +389,21 @@ switch(key) { else{ oriDrw[2] = oriDrw[2] - adjustDrw; } - if (glutGetModifiers() == 1) + if (glutGetModifiers() == GLUT_ACTIVE_SHIFT) { stim::vec temp = spidey.getPosition(); - temp[1] -= 0.0001; + temp[1] -= 0.001; spidey.setPosition(temp); spidey.Update(); - } + } + if (glutGetModifiers() == GLUT_ACTIVE_CTRL) + { + //stim::vec temp = Parker.getDirection(); + //temp[1] -= 0.001; + Parker.Pan(-0.01); + spidey.setDirection(Parker.getDirection()); + spidey.Update(); + } break; case GLUT_KEY_LEFT: oriTex[1] = oriTex[1]+adjustTex; @@ -397,13 +413,21 @@ switch(key) { else{ oriDrw[1] = oriDrw[1] + adjustDrw; } - if (glutGetModifiers() == 1) + if (glutGetModifiers() == GLUT_ACTIVE_SHIFT) { stim::vec temp = spidey.getPosition(); - temp[0] += 0.0001; + temp[0] += 0.001; spidey.setPosition(temp); spidey.Update(); } + if (glutGetModifiers() == GLUT_ACTIVE_CTRL) + { + //stim::vec temp = Parker.getDirection(); + //temp[0] += 0.001; + Parker.Tilt(0.01); + spidey.setDirection(Parker.getDirection()); + spidey.Update(); + } break; case GLUT_KEY_RIGHT: oriTex[1] = oriTex[1]-adjustTex; @@ -413,14 +437,22 @@ switch(key) { else{ oriDrw[1] = oriDrw[1] - adjustDrw; } - break; - if (glutGetModifiers() == 1) + if (glutGetModifiers() == GLUT_ACTIVE_SHIFT) { stim::vec temp = spidey.getPosition(); - temp[0] -= 0.0001; + temp[0] -= 0.001; spidey.setPosition(temp); spidey.Update(); } + if (glutGetModifiers() == GLUT_ACTIVE_CTRL) + { + //stim::vec temp = Parker.getDirection(); + //temp[0] -= 0.001; + Parker.Tilt(-0.01); + spidey.setDirection(Parker.getDirection()); + spidey.Update(); + } + break; } glutPostRedisplay(); } diff --git a/stim b/stim index 879321c..a39577b 160000 --- a/stim +++ b/stim @@ -1 +1 @@ -Subproject commit 879321c4a5e974144996aae02c44c6583e4a2fbd +Subproject commit a39577bf6661bcb962a7329abbebc66e501b1dac -- libgit2 0.21.4