update
This commit is contained in:
parent
809617e6c4
commit
cb848e7109
7 changed files with 16 additions and 19 deletions
|
|
@ -15,14 +15,19 @@ import Crafter.Math;
|
|||
|
||||
namespace Crafter {
|
||||
export template <typename VertexType>
|
||||
class MeshShader {
|
||||
class MeshShader : public Component {
|
||||
public:
|
||||
MatrixRowMajor<float, 4, 4, 1> transform;
|
||||
ComponentRefOwning<Mesh<VertexType>> mesh;
|
||||
ComponentRefOwning<Camera> camera;
|
||||
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) {
|
||||
EventListener<void> cameraUpdate;
|
||||
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), cameraUpdate(
|
||||
&camera->onUpdate, [this](){
|
||||
Update();
|
||||
}
|
||||
) {
|
||||
transform = MatrixRowMajor<float, 4, 4, 1>::Identity();
|
||||
}
|
||||
void WriteDescriptors(DescriptorSet& set) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue