Added skeletal animations and other fixes

This commit is contained in:
2026-03-16 12:57:53 +01:00
parent 2cc18b3329
commit 28c6703892
51 changed files with 1964 additions and 602 deletions
@@ -1,6 +1,9 @@
#include <destrum/Graphics/Pipelines/MeshPipeline.h>
#include <destrum/FS/AssetFS.h>
#include "destrum/Graphics/Frustum.h"
#include "spdlog/spdlog.h"
MeshPipeline::MeshPipeline(): m_pipelineLayout{nullptr} {
}
@@ -68,6 +71,8 @@ void MeshPipeline::draw(VkCommandBuffer cmd,
m_pipeline->bind(cmd);
gfxDevice.bindBindlessDescSet(cmd, m_pipelineLayout);
int ActualDrawCalls = 0;
const auto viewport = VkViewport{
.x = 0,
.y = 0,
@@ -86,16 +91,17 @@ void MeshPipeline::draw(VkCommandBuffer cmd,
auto prevMeshId = NULL_MESH_ID;
// const auto frustum = edge::createFrustumFromCamera(camera);
const auto frustum = edge::createFrustumFromCamera(camera);
for (const auto& dcIdx : drawCommands) {
// const auto& dc = drawCommands[dcIdx];
const auto& dc = dcIdx;
// if (!edge::isInFrustum(frustum, dc.worldBoundingSphere)) {
// continue;
// continue;
// }
ActualDrawCalls++;
const auto& mesh = meshCache.getMesh(dc.meshId);
if (dc.meshId != prevMeshId) {
prevMeshId = dc.meshId;
@@ -106,7 +112,7 @@ void MeshPipeline::draw(VkCommandBuffer cmd,
const auto pushConstants = PushConstants{
.transform = dc.transformMatrix,
.sceneDataBuffer = sceneDataBuffer.address,
.vertexBuffer = mesh.vertexBuffer.address,
.vertexBuffer = dc.skinnedMesh != nullptr ? dc.skinnedMesh->skinnedVertexBuffer.address : mesh.vertexBuffer.address,
.materialId = dc.materialId,
};
vkCmdPushConstants(