This commit is contained in:
Jorijn van der Graaf 2025-04-27 22:16:56 +02:00
commit cfc9ca8349
10 changed files with 124 additions and 81 deletions

View file

@ -15,14 +15,12 @@ module;
module Crafter.Graphics;
using namespace Crafter;
Camera::Camera() : buffer(VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT) {
Camera::Camera() {
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));
camera.setPerspective(60.0f, 16 / 9, 0.1f, 512.0f);
camera.setRotation(glm::vec3(180.0f, 0.0f, 0.0f));
camera.setTranslation(glm::vec3(0.0f, 0.0f, -10.0f));
buffer.value->projection = camera.matrices.perspective;
buffer.value->view = camera.matrices.view;
buffer.value->model = glm::mat4(1.0f);
projectionView = camera.matrices.perspective*camera.matrices.view;
}