working crafter math
This commit is contained in:
parent
84099f07ed
commit
809617e6c4
4 changed files with 21 additions and 20 deletions
|
|
@ -11,19 +11,19 @@ import Crafter.Component;
|
|||
import :Mesh;
|
||||
import :Camera;
|
||||
import :VulkanPipeline;
|
||||
|
||||
import Crafter.Math;
|
||||
|
||||
namespace Crafter {
|
||||
export template <typename VertexType>
|
||||
class MeshShader {
|
||||
public:
|
||||
//glm::mat4 transform;
|
||||
MatrixRowMajor<float, 4, 4, 1> transform;
|
||||
ComponentRefOwning<Mesh<VertexType>> mesh;
|
||||
ComponentRefOwning<Camera> camera;
|
||||
Buffer<float> mvp;
|
||||
Buffer<MatrixRowMajor<float, 4, 4, 1>> 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) {
|
||||
|
||||
transform = MatrixRowMajor<float, 4, 4, 1>::Identity();
|
||||
}
|
||||
void WriteDescriptors(DescriptorSet& set) {
|
||||
set.Write(0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 0, &mvp.descriptor);
|
||||
|
|
@ -31,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 = camera.component->projectionView*transform;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue