WIP crafter.math
This commit is contained in:
parent
98b775e33e
commit
84099f07ed
11 changed files with 139 additions and 310 deletions
|
|
@ -4,13 +4,7 @@ module;
|
|||
#include <vulkan/vulkan.h>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#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 <cmath>
|
||||
|
||||
export module Crafter.Graphics:MeshShader;
|
||||
import Crafter.Component;
|
||||
|
|
@ -23,10 +17,10 @@ namespace Crafter {
|
|||
export template <typename VertexType>
|
||||
class MeshShader {
|
||||
public:
|
||||
glm::mat4 transform;
|
||||
//glm::mat4 transform;
|
||||
ComponentRefOwning<Mesh<VertexType>> mesh;
|
||||
ComponentRefOwning<Camera> camera;
|
||||
Buffer<glm::mat4> mvp;
|
||||
Buffer<float> mvp;
|
||||
std::uint32_t threadCount;
|
||||
MeshShader(Mesh<VertexType>* mesh, Camera* camera) : threadCount(std::ceil(static_cast<double>(mesh->indexCount)/64/3)), mvp(VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT), mesh(mesh), camera(camera) {
|
||||
|
||||
|
|
@ -37,7 +31,7 @@ namespace Crafter {
|
|||
set.Write(0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 2, &mesh.component->indicies.descriptor);
|
||||
}
|
||||
void Update() {
|
||||
mvp.value[0] = camera.component->projectionView*transform;
|
||||
//mvp.value[0] = camera.component->projectionView*transform;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue