Skip to content

Commit ba15e98

Browse files
committed
[*] Move camera code to tools folder
1 parent 0ea08dd commit ba15e98

File tree

6 files changed

+13
-10
lines changed

6 files changed

+13
-10
lines changed

include/inexor/vulkan-renderer/renderer.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#pragma once
22

3-
#include "inexor/vulkan-renderer/camera.hpp"
43
#include "inexor/vulkan-renderer/fps_counter.hpp"
54
#include "inexor/vulkan-renderer/imgui.hpp"
65
#include "inexor/vulkan-renderer/octree_gpu_vertex.hpp"
76
#include "inexor/vulkan-renderer/time_step.hpp"
7+
#include "inexor/vulkan-renderer/tools/camera.hpp"
88
#include "inexor/vulkan-renderer/wrapper/instance.hpp"
99
#include "inexor/vulkan-renderer/wrapper/uniform_buffer.hpp"
1010
#include "inexor/vulkan-renderer/wrapper/window/surface.hpp"
@@ -35,7 +35,7 @@ class VulkanRenderer {
3535

3636
bool m_vsync_enabled{false};
3737

38-
std::unique_ptr<Camera> m_camera;
38+
std::unique_ptr<tools::Camera> m_camera;
3939

4040
std::unique_ptr<Window> m_window;
4141
std::unique_ptr<wrapper::Instance> m_instance;

include/inexor/vulkan-renderer/camera.hpp renamed to include/inexor/vulkan-renderer/tools/camera.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include <array>
88
#include <vector>
99

10-
namespace inexor::vulkan_renderer {
10+
namespace inexor::vulkan_renderer::tools {
1111

1212
namespace directions {
1313
/// The default value of the camera's front vector.
@@ -225,4 +225,4 @@ class Camera {
225225
return m_perspective_matrix;
226226
}
227227
};
228-
} // namespace inexor::vulkan_renderer
228+
} // namespace inexor::vulkan_renderer::tools

src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
set(INEXOR_SOURCE_FILES
22
vulkan-renderer/application.cpp
3-
vulkan-renderer/camera.cpp
43
vulkan-renderer/exception.cpp
54
vulkan-renderer/fps_counter.cpp
65
vulkan-renderer/imgui.cpp
@@ -15,6 +14,7 @@ set(INEXOR_SOURCE_FILES
1514
vulkan-renderer/io/byte_stream.cpp
1615
vulkan-renderer/io/nxoc_parser.cpp
1716

17+
vulkan-renderer/tools/camera.cpp
1818
vulkan-renderer/tools/cla_parser.cpp
1919
vulkan-renderer/tools/device_info.cpp
2020
vulkan-renderer/tools/enumerate.cpp

src/vulkan-renderer/application.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#include "inexor/vulkan-renderer/application.hpp"
22

3-
#include "inexor/vulkan-renderer/camera.hpp"
43
#include "inexor/vulkan-renderer/exception.hpp"
54
#include "inexor/vulkan-renderer/meta.hpp"
65
#include "inexor/vulkan-renderer/octree_gpu_vertex.hpp"
76
#include "inexor/vulkan-renderer/standard_ubo.hpp"
7+
#include "inexor/vulkan-renderer/tools/camera.hpp"
88
#include "inexor/vulkan-renderer/tools/cla_parser.hpp"
99
#include "inexor/vulkan-renderer/tools/enumerate.hpp"
1010
#include "inexor/vulkan-renderer/world/collision.hpp"
@@ -526,6 +526,8 @@ void Application::process_input() {
526526

527527
auto deadzone_lambda = [](const float state) { return (glm::abs(state) < 0.2f) ? 0.0f : state; };
528528

529+
using namespace tools;
530+
529531
if (m_camera->type() == CameraType::LOOK_AT &&
530532
m_input->kbm_data().is_mouse_button_pressed(GLFW_MOUSE_BUTTON_LEFT)) {
531533
m_camera->rotate(static_cast<float>(cursor_pos_delta[0]), -static_cast<float>(cursor_pos_delta[1]));

src/vulkan-renderer/renderer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ void VulkanRenderer::recreate_swapchain() {
7878
m_render_graph = std::make_unique<RenderGraph>(*m_device, *m_swapchain);
7979
setup_render_graph();
8080

81-
m_camera = std::make_unique<Camera>(glm::vec3(6.0f, 10.0f, 2.0f), 180.0f, 0.0f,
81+
m_camera =
82+
std::make_unique<tools::Camera>(glm::vec3(6.0f, 10.0f, 2.0f), 180.0f, 0.0f,
8283
static_cast<float>(m_window->width()), static_cast<float>(m_window->height()));
8384

8485
m_camera->set_movement_speed(5.0f);

src/vulkan-renderer/camera.cpp renamed to src/vulkan-renderer/tools/camera.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#include "inexor/vulkan-renderer/camera.hpp"
1+
#include "inexor/vulkan-renderer/tools/camera.hpp"
22

3-
namespace inexor::vulkan_renderer {
3+
namespace inexor::vulkan_renderer::tools {
44

55
Camera::Camera(const glm::vec3 &position, const float yaw, const float pitch, const float window_width,
66
const float window_height)
@@ -144,4 +144,4 @@ void Camera::update(const float delta_time) {
144144
}
145145
}
146146

147-
} // namespace inexor::vulkan_renderer
147+
} // namespace inexor::vulkan_renderer::tools

0 commit comments

Comments
 (0)