WIP crafter.math

This commit is contained in:
Jorijn van der Graaf 2025-05-04 05:15:31 +02:00
commit 84099f07ed
11 changed files with 139 additions and 310 deletions

View file

@ -1,26 +1,15 @@
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;
import Crafter.Math;
using namespace Crafter;
Camera::Camera() {
old::Camera camera;
camera.type = old::Camera::CameraType::firstperson;
camera.setPerspective(90.0f, 16 / 9, 0.1f, 512.0f);
camera.setRotation(glm::vec3(180.0f, 150, 0));
camera.setTranslation(glm::vec3(-100.0f, -130.0f, -100.0f));
Camera::Camera(float fov, float aspectRatio, float near, float far) {
projection = Matrix<float, 4, 4, 1>::Projection(fov, aspectRatio, near, far);
view = Matrix<float, 4, 4, 1>::Idenity();
projectionView = camera.matrices.perspective*camera.matrices.view;
}