Crafter.Graphics/Crafter.Graphics-Camera.cpp

21 lines
574 B
C++
Raw Normal View History

2025-04-26 23:05:11 +02:00
module;
#include <cstdint>
#include "VulkanBuffer.h"
#include <vulkan/vulkan.h>
2025-05-05 05:14:47 +02:00
#include <iostream>
#include <format>
2025-04-26 23:05:11 +02:00
module Crafter.Graphics;
2025-05-04 05:15:31 +02:00
import Crafter.Math;
2025-04-26 23:05:11 +02:00
using namespace Crafter;
2025-05-04 05:15:31 +02:00
Camera::Camera(float fov, float aspectRatio, float near, float far) {
2025-05-05 05:14:47 +02:00
projection = MatrixRowMajor<float, 4, 4, 1>::Perspective(fov, aspectRatio, near, far);
view = MatrixRowMajor<float, 4, 4, 1>::Rotation(0, 0, ToRadian(180.0f))*MatrixRowMajor<float, 4, 4, 1>::Translation(1.0f, 0.0f, -10.0f);
Update();
}
void Camera::Update() {
projectionView = projection*view;
2025-04-26 23:05:11 +02:00
}