wip
This commit is contained in:
parent
abc1d7da9f
commit
0c6934023b
4 changed files with 59 additions and 64 deletions
|
|
@ -37,11 +37,11 @@ import Crafter.Math;
|
|||
|
||||
namespace Crafter {
|
||||
export template <typename VertexType>
|
||||
class MeshShader : public Component {
|
||||
class MeshShader {
|
||||
public:
|
||||
MatrixRowMajor<float, 4, 4, 1> transform;
|
||||
ComponentRefOwning<Mesh<VertexType>> mesh;
|
||||
ComponentRefOwning<Camera> camera;
|
||||
Mesh<VertexType>* mesh;
|
||||
Camera* camera;
|
||||
Buffer<MatrixRowMajor<float, 4, 4, 1>> mvp;
|
||||
std::uint32_t threadCount;
|
||||
EventListener<void> cameraUpdate;
|
||||
|
|
@ -55,13 +55,13 @@ namespace Crafter {
|
|||
void WriteDescriptors(VkDescriptorSet* set) {
|
||||
VkWriteDescriptorSet write[3] = {
|
||||
vks::initializers::writeDescriptorSet(set[0], VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 0, &mvp.descriptor),
|
||||
vks::initializers::writeDescriptorSet(set[0], VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, &mesh.component->verticies.descriptor),
|
||||
vks::initializers::writeDescriptorSet(set[0], VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 2, &mesh.component->indicies.descriptor)
|
||||
vks::initializers::writeDescriptorSet(set[0], VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, &mesh->verticies.descriptor),
|
||||
vks::initializers::writeDescriptorSet(set[0], VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 2, &mesh->indicies.descriptor)
|
||||
};
|
||||
vkUpdateDescriptorSets(VulkanDevice::device, 3, &write[0], 0, nullptr);
|
||||
}
|
||||
void Update() {
|
||||
*mvp.value = camera.component->projectionView*transform;
|
||||
*mvp.value = camera->projectionView*transform;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue