Fixed shadows with animations #419
|
@ -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);
|
||||
}
|
Binary file not shown.
|
@ -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<uint32_t>(drawData.size()));
|
||||
cmdBuffer->EndLabeledSegment();
|
||||
|
|
|
@ -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
|
||||
({
|
||||
|
|
|
@ -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<SHRenderGraphNode>(nodeName, renderGraphStorage, std::move(descInitParams), std::vector<Handle<SHRenderGraphNode>>(), true));
|
||||
ReindexNodes ();
|
||||
|
|
Loading…
Reference in New Issue