diff --git a/Assets/Shaders/ShadowMapAnim_VS.glsl b/Assets/Shaders/ShadowMapAnim_VS.glsl index f5f9ab4e..17b135e0 100644 --- a/Assets/Shaders/ShadowMapAnim_VS.glsl +++ b/Assets/Shaders/ShadowMapAnim_VS.glsl @@ -26,12 +26,12 @@ layout (std430, set = 2, binding = 1) buffer AnimBoneMatrices void main() { // // Compute bone matrix - // mat4 boneMatrix = BoneMatrices.data[firstBoneIndex + aBoneIndices[0]] * aBoneWeights[0]; - // boneMatrix += BoneMatrices.data[firstBoneIndex + aBoneIndices[1]] * aBoneWeights[1]; - // boneMatrix += BoneMatrices.data[firstBoneIndex + aBoneIndices[2]] * aBoneWeights[2]; - // boneMatrix += BoneMatrices.data[firstBoneIndex + aBoneIndices[3]] * aBoneWeights[3]; + mat4 boneMatrix = BoneMatrices.data[firstBoneIndex + aBoneIndices[0]] * aBoneWeights[0]; + boneMatrix += BoneMatrices.data[firstBoneIndex + aBoneIndices[1]] * aBoneWeights[1]; + boneMatrix += BoneMatrices.data[firstBoneIndex + aBoneIndices[2]] * aBoneWeights[2]; + boneMatrix += BoneMatrices.data[firstBoneIndex + aBoneIndices[3]] * aBoneWeights[3]; // clip space for rendering - gl_Position = cameraData.vpMat * worldTransform * vec4 (aVertexPos, 1.0f); - // gl_Position = cameraData.vpMat * worldTransform * boneMatrix * vec4 (aVertexPos, 1.0f); + // gl_Position = cameraData.vpMat * worldTransform * vec4 (aVertexPos, 1.0f); + gl_Position = cameraData.vpMat * worldTransform * boneMatrix * vec4 (aVertexPos, 1.0f); } \ No newline at end of file diff --git a/Assets/Shaders/ShadowMapAnim_VS.shshaderb b/Assets/Shaders/ShadowMapAnim_VS.shshaderb index 96c45e47..047f485b 100644 Binary files a/Assets/Shaders/ShadowMapAnim_VS.shshaderb and b/Assets/Shaders/ShadowMapAnim_VS.shshaderb differ diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Batching/SHBatch.cpp b/SHADE_Engine/src/Graphics/MiddleEnd/Batching/SHBatch.cpp index 32a4fa76..4aa33de5 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Batching/SHBatch.cpp +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Batching/SHBatch.cpp @@ -726,16 +726,34 @@ namespace SHADE cmdBuffer->BindVertexBuffer(SHGraphicsConstants::VertexBufferBindings::BONE_MATRIX_FIRST_INDEX, transformDataBuffer[frameIndex], 0); } - auto const& descMappings = SHGraphicsPredefinedData::GetMappings(SHGraphicsPredefinedData::SystemType::BATCHING); - if (instanceDataDescSet[frameIndex]) + if (IsAnimated()) { - cmdBuffer->BindDescriptorSet - ( - instanceDataDescSet[frameIndex], - SH_PIPELINE_TYPE::GRAPHICS, - descMappings.at(SHPredefinedDescriptorTypes::PER_INSTANCE_BATCH), - dynamicOffset - ); + auto const& descMappings = SHGraphicsPredefinedData::GetMappings(SHGraphicsPredefinedData::SystemType::BATCHING_ANIM); + if (instanceDataDescSet[frameIndex]) + { + cmdBuffer->BindDescriptorSet + ( + instanceDataDescSet[frameIndex], + SH_PIPELINE_TYPE::GRAPHICS, + descMappings.at(SHPredefinedDescriptorTypes::PER_INSTANCE_ANIM_BATCH), + dynamicOffset + ); + } + } + else + { + auto const& descMappings = SHGraphicsPredefinedData::GetMappings(SHGraphicsPredefinedData::SystemType::BATCHING); + if (instanceDataDescSet[frameIndex]) + { + cmdBuffer->BindDescriptorSet + ( + instanceDataDescSet[frameIndex], + SH_PIPELINE_TYPE::GRAPHICS, + descMappings.at(SHPredefinedDescriptorTypes::PER_INSTANCE_BATCH), + dynamicOffset + ); + } + } cmdBuffer->DrawMultiIndirect(drawDataBuffer[frameIndex], static_cast(drawData.size())); cmdBuffer->EndLabeledSegment(); diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/GlobalData/SHGraphicsPredefinedData.cpp b/SHADE_Engine/src/Graphics/MiddleEnd/GlobalData/SHGraphicsPredefinedData.cpp index 3f312532..76d34ff7 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/GlobalData/SHGraphicsPredefinedData.cpp +++ b/SHADE_Engine/src/Graphics/MiddleEnd/GlobalData/SHGraphicsPredefinedData.cpp @@ -37,7 +37,8 @@ namespace SHADE {SHPredefinedDescriptorTypes::STATIC_DATA, 0}, {SHPredefinedDescriptorTypes::CAMERA, 1}, {SHPredefinedDescriptorTypes::PER_INSTANCE_ANIM_BATCH, 2}, - }); + {SHPredefinedDescriptorTypes::RENDER_GRAPH_RESOURCE, 3}, + }); perSystemData[SHUtilities::ConvertEnum(SystemType::TEXT_RENDERING)].descMappings.AddMappings ({ diff --git a/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraph.cpp b/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraph.cpp index c44c9464..b9ca9d56 100644 --- a/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraph.cpp +++ b/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraph.cpp @@ -497,7 +497,7 @@ namespace SHADE } // get target node - auto targetNode = nodes.begin() + nodeIndexing.at(nodeToAddAfter); + auto targetNode = nodes.begin() + nodeIndexing.at(nodeToAddAfter) + 1; auto node = nodes.insert(targetNode, renderGraphStorage->resourceHub->Create(nodeName, renderGraphStorage, std::move(descInitParams), std::vector>(), true)); ReindexNodes ();