renamed to JointID/JointWeight instead of BoneID/BoneWeight

This commit is contained in:
hyzboy 2023-05-13 03:14:38 +08:00
parent aa217c6fc5
commit 8340209697
No known key found for this signature in database
GPG Key ID: 067EE4525D4FB6D3
7 changed files with 34 additions and 31 deletions

@ -1 +1 @@
Subproject commit 1251e2a735c87995b57c0e7fa3bd41981dee086f
Subproject commit f57401620a52eaf3fdaaf5410beb9528aadaa49a

View File

@ -106,12 +106,9 @@ int main(int,char **)
char olb[]="[ ]";
if(fp.optimalTilingFeatures&VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT)
olb[1]='O';
if(fp.linearTilingFeatures&VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT)
olb[2]='L';
if(fp.bufferFeatures&VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT)
olb[2]='B';
if(fp.optimalTilingFeatures&VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT )olb[1]='O';
if(fp.linearTilingFeatures&VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT )olb[2]='L';
if(fp.bufferFeatures&VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT )olb[2]='B';
std::cout<<olb;
}

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()

View File

@ -329,28 +329,28 @@ namespace hgl
}
}
if(count<binding_count) //Bone组,暂未支持
if(count<binding_count) //Joint组,暂未支持
{
const uint boneId_binding_count=vil->GetCount(VertexInputGroup::BoneID);
const uint joint_id_binding_count=vil->GetCount(VertexInputGroup::JointID);
if(boneId_binding_count>0) //有骨骼矩阵信息
if(joint_id_binding_count>0) //有矩阵信息
{
count+=boneId_binding_count;
count+=joint_id_binding_count;
if(count<binding_count) //BoneWeight组
if(count<binding_count) //JointWeight组
{
const uint boneWeight_binding_count=vil->GetCount(VertexInputGroup::BoneWeight);
const uint joing_weight_binding_count=vil->GetCount(VertexInputGroup::JointWeight);
if(boneWeight_binding_count!=1)
if(joing_weight_binding_count!=1)
{
++count;
}
else //BoneWieght不为1是个bug除非未来支持8骨骼权重
else //JointWieght不为1是个bug除非未来支持8权重
{
return(false);
}
}
else //有BoneID没有BoneWeight? 这是个BUG
else //有JointID没有JointWeight? 这是个BUG
{
return(false);
}

View File

@ -47,7 +47,7 @@ bool GPUDevice::Resize(const VkExtent2D &extent)
swapchainRT=CreateSwapchainRenderTarget();
return(true);
return(swapchainRT);
}
VkCommandBuffer GPUDevice::CreateCommandBuffer()

View File

@ -60,10 +60,16 @@ namespace
}
VkSwapchainKHR swap_chain;
VkResult result;
if(vkCreateSwapchainKHR(dev_attr->device,&swapchain_ci,nullptr,&swap_chain)==VK_SUCCESS)
result=vkCreateSwapchainKHR(dev_attr->device,&swapchain_ci,nullptr,&swap_chain);
if(result==VK_SUCCESS)
return(swap_chain);
//LOG_ERROR(OS_TEXT("vkCreateSwapchainKHR failed, result = ")+OSString(result));
os_err<<"vkCreateSwapchainKHR failed, result="<<result<<std::endl;
return(VK_NULL_HANDLE);
}
}//namespace