|
|
|
@ -273,17 +273,23 @@ void Application::addSoftBody(const std::string &modelFile, size_t count) { |
|
|
|
|
newVertexBuffers[0] = make_unique<Buffer>( |
|
|
|
|
newVertices.size() * sizeof(Vertex), |
|
|
|
|
bufferUsageFlags | VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, |
|
|
|
|
memoryUsage, 0, "Vertices 0" |
|
|
|
|
memoryUsage, |
|
|
|
|
0, |
|
|
|
|
"Vertices 0" |
|
|
|
|
); |
|
|
|
|
newVertexBuffers[1] = make_unique<Buffer>( |
|
|
|
|
newVertices.size() * sizeof(Vertex), |
|
|
|
|
bufferUsageFlags | VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, |
|
|
|
|
memoryUsage, 0, "Vertices 1" |
|
|
|
|
memoryUsage, |
|
|
|
|
0, |
|
|
|
|
"Vertices 1" |
|
|
|
|
); |
|
|
|
|
newFaceBuffer = make_unique<Buffer>( |
|
|
|
|
newFaces.size() * sizeof(Face), |
|
|
|
|
bufferUsageFlags | VK_BUFFER_USAGE_INDEX_BUFFER_BIT, |
|
|
|
|
memoryUsage, 0, "Faces" |
|
|
|
|
memoryUsage, |
|
|
|
|
0, |
|
|
|
|
"Faces" |
|
|
|
|
); |
|
|
|
|
newEdgeBuffer = make_unique<Buffer>( |
|
|
|
|
constraintData.edges.size() * sizeof(Edge), |
|
|
|
@ -293,7 +299,10 @@ void Application::addSoftBody(const std::string &modelFile, size_t count) { |
|
|
|
|
"Edges" |
|
|
|
|
); |
|
|
|
|
newTetrahedronBuffer = make_unique<Buffer>( |
|
|
|
|
constraintData.tetrahedra.size() * sizeof(Tetrahedron), bufferUsageFlags, memoryUsage, 0, |
|
|
|
|
constraintData.tetrahedra.size() * sizeof(Tetrahedron), |
|
|
|
|
bufferUsageFlags, |
|
|
|
|
memoryUsage, |
|
|
|
|
0, |
|
|
|
|
"Tetrahedra" |
|
|
|
|
); |
|
|
|
|
|
|
|
|
@ -304,17 +313,29 @@ void Application::addSoftBody(const std::string &modelFile, size_t count) { |
|
|
|
|
newTetrahedronBuffer->setData(constraintData.tetrahedra.data(), 0, newTetrahedronBuffer->size, commandBuffer); |
|
|
|
|
} else { |
|
|
|
|
newVertexBuffers[0] = vertexBuffers[0]->appended( |
|
|
|
|
newVertices.data(), newVertices.size() * sizeof(Vertex), commandBuffer |
|
|
|
|
newVertices.data(), |
|
|
|
|
newVertices.size() * sizeof(Vertex), |
|
|
|
|
commandBuffer |
|
|
|
|
); |
|
|
|
|
newVertexBuffers[1] = vertexBuffers[1]->appended( |
|
|
|
|
newVertices.data(), newVertices.size() * sizeof(Vertex), commandBuffer |
|
|
|
|
newVertices.data(), |
|
|
|
|
newVertices.size() * sizeof(Vertex), |
|
|
|
|
commandBuffer |
|
|
|
|
); |
|
|
|
|
newFaceBuffer = faceBuffer->appended( |
|
|
|
|
newFaces.data(), |
|
|
|
|
newFaces.size() * sizeof(Face), |
|
|
|
|
commandBuffer |
|
|
|
|
); |
|
|
|
|
newFaceBuffer = faceBuffer->appended(newFaces.data(), newFaces.size() * sizeof(Face), commandBuffer); |
|
|
|
|
newEdgeBuffer = edgeBuffer->replaced( |
|
|
|
|
constraintData.edges.data(), constraintData.edges.size() * sizeof(Edge), commandBuffer |
|
|
|
|
constraintData.edges.data(), |
|
|
|
|
constraintData.edges.size() * sizeof(Edge), |
|
|
|
|
commandBuffer |
|
|
|
|
); |
|
|
|
|
newTetrahedronBuffer = tetrahedronBuffer->replaced( |
|
|
|
|
constraintData.tetrahedra.data(), constraintData.tetrahedra.size() * sizeof(Tetrahedron), commandBuffer |
|
|
|
|
constraintData.tetrahedra.data(), |
|
|
|
|
constraintData.tetrahedra.size() * sizeof(Tetrahedron), |
|
|
|
|
commandBuffer |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -327,9 +348,7 @@ void Application::addSoftBody(const std::string &modelFile, size_t count) { |
|
|
|
|
edgeBuffer = std::move(newEdgeBuffer); |
|
|
|
|
tetrahedronBuffer = std::move(newTetrahedronBuffer); |
|
|
|
|
|
|
|
|
|
descriptorPool->bindBuffer( |
|
|
|
|
*vertexBuffers[1 - currentDrawVertexBuffer], VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, DescriptorSet::MESH, 0 |
|
|
|
|
); |
|
|
|
|
descriptorPool->bindBuffer(*vertexBuffers[1 - currentDrawVertexBuffer], VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, DescriptorSet::MESH, 0); |
|
|
|
|
descriptorPool->bindBuffer(*faceBuffer, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, DescriptorSet::MESH, 1); |
|
|
|
|
descriptorPool->bindBuffer(*edgeBuffer, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, DescriptorSet::MESH, 2); |
|
|
|
|
descriptorPool->bindBuffer(*tetrahedronBuffer, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, DescriptorSet::MESH, 4); |
|
|
|
|