victory
This commit is contained in:
parent
27ba32cdf5
commit
05c19c3f94
11 changed files with 412 additions and 345 deletions
31
Crafter.Graphics-Camera.cpp
Normal file
31
Crafter.Graphics-Camera.cpp
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
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;
|
||||
|
||||
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));
|
||||
|
||||
VulkanDevice::CreateBuffer(VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, &buffer, sizeof(CameraBufferData));
|
||||
VulkanDevice::CHECK_VK_RESULT(buffer.map());
|
||||
data.projection = camera.matrices.perspective;
|
||||
data.view = camera.matrices.view;
|
||||
data.model = glm::mat4(1.0f);
|
||||
memcpy(buffer.mapped, &data, sizeof(CameraBufferData));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue