2025-04-26 23:05:11 +02:00
|
|
|
module;
|
|
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
|
#define GLM_FORCE_RADIANS
|
|
|
|
|
#define GLM_FORCE_DEPTH_ZERO_TO_ONE
|
|
|
|
|
#define GLM_ENABLE_EXPERIMENTAL
|
|
|
|
|
#include <glm/glm.hpp>
|
|
|
|
|
#include <glm/gtc/matrix_transform.hpp>
|
|
|
|
|
#include <glm/gtc/matrix_inverse.hpp>
|
|
|
|
|
#include <glm/gtc/type_ptr.hpp>
|
|
|
|
|
#include "VulkanBuffer.h"
|
|
|
|
|
#include "camera.hpp"
|
|
|
|
|
#include <vulkan/vulkan.h>
|
|
|
|
|
|
|
|
|
|
module Crafter.Graphics;
|
|
|
|
|
using namespace Crafter;
|
|
|
|
|
|
2025-04-27 00:05:21 +02:00
|
|
|
Camera::Camera() : buffer(VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT) {
|
2025-04-26 23:05:11 +02:00
|
|
|
old::Camera camera;
|
|
|
|
|
camera.type = old::Camera::CameraType::lookat;
|
|
|
|
|
camera.setPerspective(60.0f, 128 / 128, 0.1f, 512.0f);
|
|
|
|
|
camera.setRotation(glm::vec3(0.0f, 15.0f, 0.0f));
|
|
|
|
|
camera.setTranslation(glm::vec3(0.0f, 0.0f, -5.0f));
|
|
|
|
|
|
2025-04-27 00:05:21 +02:00
|
|
|
buffer.value->projection = camera.matrices.perspective;
|
|
|
|
|
buffer.value->view = camera.matrices.view;
|
|
|
|
|
buffer.value->model = glm::mat4(1.0f);
|
2025-04-26 23:05:11 +02:00
|
|
|
}
|