renamed to JointID/JointWeight instead of BoneID/BoneWeight

This commit is contained in:
2023-05-13 03:14:38 +08:00
parent aa217c6fc5
commit 8340209697
7 changed files with 34 additions and 31 deletions

View File

@@ -65,13 +65,13 @@ constexpr const ShaderBufferSource SBS_MaterialInstance=
"MaterialInstance mi[256];"
};
constexpr const ShaderBufferSource SBS_BoneInfo=
constexpr const ShaderBufferSource SBS_JointInfo=
{
"BoneInfo",
"bone",
"JointInfo",
"joint",
R"(
mat4 bone_mats[];
mat4 mats[];
)"
};
@@ -87,13 +87,13 @@ mat4 GetLocalToWorld()
}
)";
constexpr const char GetBoneMatrix[]=R"(
mat4 GetBoneMatrix()
constexpr const char GetJointMatrix[]=R"(
mat4 GetJointMatrix()
{
return bone_mats[BoneID.x]*BoneWeight.x+
bone_mats[BoneID.y]*BoneWeight.y+
bone_mats[BoneID.z]*BoneWeight.z+
bone_mats[BoneID.w]*BoneWeight.w;
return joint.mats[JointID.x]*JointWeight.x+
joint.mats[JointID.y]*JointWeight.y+
joint.mats[JointID.z]*JointWeight.z+
joint.mats[JointID.w]*JointWeight.w;
}
)";

View File

@@ -26,13 +26,13 @@ namespace hgl
AddInput(vat,VAN::MaterialInstanceID,VK_VERTEX_INPUT_RATE_VERTEX,VertexInputGroup::MaterialInstanceID);
}
void AddBone()
void AddJoint()
{
constexpr const VAT id {VertexAttribType::BaseType::UInt,4}; //使用uint8[4]
constexpr const VAT weight {VertexAttribType::BaseType::Float,4}; //使用uint8[4]
AddInput(id, VAN::BoneID, VK_VERTEX_INPUT_RATE_VERTEX,VertexInputGroup::BoneID);
AddInput(weight,VAN::BoneWeight,VK_VERTEX_INPUT_RATE_VERTEX,VertexInputGroup::BoneWeight);
AddInput(id, VAN::JointID, VK_VERTEX_INPUT_RATE_VERTEX,VertexInputGroup::JointID);
AddInput(weight,VAN::JointWeight,VK_VERTEX_INPUT_RATE_VERTEX,VertexInputGroup::JointWeight);
}
void AddLocalToWorld()