The incredible shrinknig man: Part II
This commit is contained in:
parent
432bb0d562
commit
47f36c814c
3 changed files with 12 additions and 0 deletions
|
@ -31,6 +31,12 @@ void Camera::processMovement(Direction direction, float deltaTime) {
|
|||
case DIRECTION_RIGHT:
|
||||
cameraPos += glm::normalize(glm::cross(cameraFront, cameraUp)) * speed;
|
||||
break;
|
||||
case DIRECTION_UP:
|
||||
cameraPos += cameraUp * speed;
|
||||
break;
|
||||
case DIRECTION_DOWN:
|
||||
cameraPos -= cameraUp * speed;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@ enum Direction {
|
|||
DIRECTION_BACKWARDS,
|
||||
DIRECTION_RIGHT,
|
||||
DIRECTION_LEFT,
|
||||
DIRECTION_UP,
|
||||
DIRECTION_DOWN,
|
||||
};
|
||||
|
||||
class Camera {
|
||||
|
|
|
@ -76,6 +76,10 @@ void processInput(GLFWwindow* window) {
|
|||
camera.processMovement(DIRECTION_LEFT, deltaTime);
|
||||
if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)
|
||||
camera.processMovement(DIRECTION_RIGHT, deltaTime);
|
||||
if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_PRESS)
|
||||
camera.processMovement(DIRECTION_UP, deltaTime);
|
||||
if (glfwGetKey(window, GLFW_KEY_LEFT_CONTROL) == GLFW_PRESS)
|
||||
camera.processMovement(DIRECTION_DOWN, deltaTime);
|
||||
|
||||
if (mode == 2) {
|
||||
float shiftFactor = (glfwGetKey(window, GLFW_KEY_LEFT_SHIFT) == GLFW_PRESS) ? -0.5 : 0.5;
|
||||
|
|
Loading…
Add table
Reference in a new issue