feature/softbody-runtime-control
Benjamin Kraft 4 months ago
parent 8b239ddf33
commit f19ff38009
  1. 10
      src/simulation.cpp

@ -53,14 +53,14 @@ void Simulation::createMeshBuffers() {
auto body = std::make_unique<SoftBody>(&sphere, 0.3f); auto body = std::make_unique<SoftBody>(&sphere, 0.3f);
for (size_t i = 0; i < 3; i++){ for (size_t i = 0; i < 40; i++){
auto copy = std::make_unique<SoftBody>(*body.get()); auto copy = std::make_unique<SoftBody>(*body.get());
copy->applyVertexOffset({i * 2, 0, 0}); copy->applyVertexOffset({i * 2, 0, 0});
softBodies.push_back(std::move(copy)); softBodies.push_back(std::move(copy));
} }
body = std::make_unique<SoftBody>(&bunny, 0.3f); body = std::make_unique<SoftBody>(&bunny, 0.3f);
for (size_t i = 0; i < 3; i++){ for (size_t i = 0; i < 80; i++){
auto copy = std::make_unique<SoftBody>(*body.get()); auto copy = std::make_unique<SoftBody>(*body.get());
copy->applyVertexOffset({i * 2, 2, 0}); copy->applyVertexOffset({i * 2, 2, 0});
softBodies.push_back(std::move(copy)); softBodies.push_back(std::move(copy));
@ -142,6 +142,12 @@ void Simulation::createMeshBuffers() {
constraintData.tetrahedra.insert(constraintData.tetrahedra.end(), currentSoftBody->constraintData.tetrahedra.begin(), currentSoftBody->constraintData.tetrahedra.end()); constraintData.tetrahedra.insert(constraintData.tetrahedra.end(), currentSoftBody->constraintData.tetrahedra.begin(), currentSoftBody->constraintData.tetrahedra.end());
} }
printf("Vertices: %zu\nFaces: %zu\nEdges: %zu\nTriangles: %zu\nTetrahedra: %zu\nTotal Constraints: %zu\n",
vertices.size(), faces.size(), constraintData.edges.size(), constraintData.triangles.size(), constraintData.tetrahedra.size(),
constraintData.edges.size() + constraintData.tetrahedra.size());
printf("Partitions: %u\n", constraintData.partitionCount);
class SimulationBuffer : public Buffer { class SimulationBuffer : public Buffer {
public: public:
SimulationBuffer(void* data, VkDeviceSize size, VkBufferUsageFlags additionalUsageFlags=0) SimulationBuffer(void* data, VkDeviceSize size, VkBufferUsageFlags additionalUsageFlags=0)

Loading…
Cancel
Save