Added support for rendering bone-less models using the animated shader

This commit is contained in:
Kah Wei 2023-01-13 21:26:05 +08:00
parent d1a41ea194
commit 7ecb8b11ad
5 changed files with 7 additions and 3 deletions

View File

@ -71,5 +71,5 @@ void main()
boneMatrix += BoneMatrices.data[aBoneIndices[3]] * aBoneWeights[3]; boneMatrix += BoneMatrices.data[aBoneIndices[3]] * aBoneWeights[3];
// clip space for rendering // clip space for rendering
gl_Position = cameraData.vpMat * worldTransform * vec4 (aVertexPos, 1.0f); gl_Position = cameraData.vpMat * worldTransform * boneMatrix * vec4 (aVertexPos, 1.0f);
} }

Binary file not shown.

View File

@ -86,7 +86,7 @@ namespace SHADE
currClip = newClip; currClip = newClip;
secsPerTick = 1.0f / currClip->GetTicksPerSecond(); secsPerTick = 1.0f / currClip->GetTicksPerSecond();
if (!rig) if (rig)
{ {
updatePoseWithClip(0.0f); updatePoseWithClip(0.0f);
} }

View File

@ -185,7 +185,9 @@ namespace SHADE
} }
else else
{ {
const auto OG_SIZE = vertBoneWeightStorage.size();
vertBoneWeightStorage.resize(vertBoneWeightStorage.size() + addJob.VertexCount); vertBoneWeightStorage.resize(vertBoneWeightStorage.size() + addJob.VertexCount);
std::fill_n(vertBoneWeightStorage.begin() + OG_SIZE, addJob.VertexCount, SHVec4(1.0f, 0.0f, 0.0f, 0.0f));
} }
indexStorage.insert indexStorage.insert
( (

View File

@ -211,7 +211,9 @@ namespace SHADE
assetData.VertexTangents.data(), assetData.VertexTangents.data(),
assetData.VertexNormals.data(), assetData.VertexNormals.data(),
assetData.Indices.size(), assetData.Indices.size(),
assetData.Indices.data() assetData.Indices.data(),
assetData.VertexBoneIndices.empty() ? nullptr : assetData.VertexBoneIndices.data(),
assetData.VertexBoneWeights.empty() ? nullptr : assetData.VertexBoneWeights.data()
); );
} }
// Textures // Textures