You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

54 lines
1.2 KiB

#pragma once
#include "application.hpp"
#include "constraints.hpp"
#include <glm/vec3.hpp>
class SoftBody;
class Buffer;
class Simulation : public Application {
public:
Simulation();
~Simulation();
private:
unique_ptr<Buffer> vertexBuffer;
unique_ptr<Buffer> faceBuffer;
unique_ptr<Buffer> edgeBuffer;
unique_ptr<Buffer> triangleBuffer;
unique_ptr<Buffer> tetrahedronBuffer;
void createMeshBuffers();
struct SizeInformation {
uint32_t vertexCount;
uint32_t faceCount;
uint32_t edgeCount;
uint32_t triangleCount;
uint32_t tetrahedronCount;
};
unique_ptr<Buffer> sizeInformationBuffer;
struct Properties {
glm::vec3 gravity;
float dt;
uint32_t k;
};
unique_ptr<Buffer> propertiesBuffer;
Properties properties {};
struct PBDPushData {
uint32_t state;
ConstraintData::Partition edgePartition;
ConstraintData::Partition tetrahedronPartition;
};
ConstraintData constraintData {};
unique_ptr<ComputePipeline> pbdPipeline;
unique_ptr<ComputePipeline> normalPipeline;
void createComputePipelines();
vector<unique_ptr<SoftBody>> softBodies;
void recordDrawCommands() override;
void recordComputeCommands(VkCommandBuffer cmdBuffer) override;
};