Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@ apps/apple/VulkanSplatting/ThirdParty
# xcuserdata under any directory is ignored
xcuserdata/

project.xcconfig
project.xcconfig
/build
2 changes: 2 additions & 0 deletions src/GUIManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ void GUIManager::buildGui() {
ImGui::Text("WASD: move");
ImGui::Text("Space: up");
ImGui::Text("Shift: down");
ImGui::Text("Q: rotate left");
ImGui::Text("E: rotate right");
ImGui::Text("Left click: capture mouse");
ImGui::Text("ESC: release mouse");
ImGui::Text("Mouse captured: %s", mouseCapture ? "true" : "false");
Expand Down
6 changes: 6 additions & 0 deletions src/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ void Renderer::handleInput() {
window->mouseCapture(false);
guiManager.mouseCapture = false;
}
if (keys[7]) {
camera.rotation = glm::rotate(camera.rotation, -0.05f, glm::vec3(0.0f, 0.0f, 1.0f));
}
if (keys[8]) {
camera.rotation = glm::rotate(camera.rotation, 0.05f, glm::vec3(0.0f, 0.0f, 1.0f));
}
if (direction != glm::vec3(0.0f, 0.0f, 0.0f)) {
direction = glm::normalize(direction);
camera.position += (glm::mat4_cast(camera.rotation) * glm::vec4(direction, 1.0f)).xyz() * 0.3f;
Expand Down
2 changes: 1 addition & 1 deletion src/vulkan/Window.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Window {

virtual std::array<double, 2> getCursorTranslation() { return {0, 0}; }

virtual std::array<bool, 7> getKeys() { return {false, false, false, false, false, false, false}; }
virtual std::array<bool, 9> getKeys() { return {false, false, false, false, false, false, false, false, false}; }

virtual void mouseCapture(bool capture) { }

Expand Down
6 changes: 4 additions & 2 deletions src/vulkan/windowing/GLFWWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,17 @@ std::array<double, 2> GLFWWindow::getCursorTranslation() {
return translation;
}

std::array<bool, 7> GLFWWindow::getKeys() {
std::array<bool, 9> GLFWWindow::getKeys() {
return {
glfwGetKey(static_cast<GLFWwindow *>(window), GLFW_KEY_W) == GLFW_PRESS,
glfwGetKey(static_cast<GLFWwindow *>(window), GLFW_KEY_A) == GLFW_PRESS,
glfwGetKey(static_cast<GLFWwindow *>(window), GLFW_KEY_S) == GLFW_PRESS,
glfwGetKey(static_cast<GLFWwindow *>(window), GLFW_KEY_D) == GLFW_PRESS,
glfwGetKey(static_cast<GLFWwindow *>(window), GLFW_KEY_SPACE) == GLFW_PRESS,
glfwGetKey(static_cast<GLFWwindow *>(window), GLFW_KEY_LEFT_SHIFT) == GLFW_PRESS,
glfwGetKey(static_cast<GLFWwindow *>(window), GLFW_KEY_ESCAPE) == GLFW_PRESS
glfwGetKey(static_cast<GLFWwindow *>(window), GLFW_KEY_ESCAPE) == GLFW_PRESS,
glfwGetKey(static_cast<GLFWwindow *>(window), GLFW_KEY_Q) == GLFW_PRESS,
glfwGetKey(static_cast<GLFWwindow *>(window), GLFW_KEY_E) == GLFW_PRESS
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/vulkan/windowing/GLFWWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class GLFWWindow final : public Window {

std::array<double, 2> getCursorTranslation() override;

std::array<bool, 7> getKeys() override;
std::array<bool, 9> getKeys() override;

void mouseCapture(bool capture) override;

Expand Down
Loading