动画编码完成
This commit is contained in:
+9
-9
@@ -460,16 +460,16 @@ void FaceApp::setup_descriptor_pool()
|
||||
{
|
||||
// 保守估计:假设每个描述符集可能有多个绑定
|
||||
const uint32_t setsCount = kMaxTexture;
|
||||
const uint32_t multiplier = 3; // 安全系数
|
||||
//const uint32_t multiplier = 3; // 安全系数
|
||||
|
||||
std::vector<VkDescriptorPoolSize> pool_sizes = {
|
||||
{
|
||||
.type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
|
||||
.descriptorCount = setsCount * multiplier
|
||||
.descriptorCount = 3
|
||||
},
|
||||
{
|
||||
.type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
|
||||
.descriptorCount = setsCount * multiplier
|
||||
.descriptorCount = setsCount + 4
|
||||
},
|
||||
// 如果需要其他类型的描述符,在这里添加
|
||||
};
|
||||
@@ -478,7 +478,7 @@ void FaceApp::setup_descriptor_pool()
|
||||
descriptor_pool_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
|
||||
descriptor_pool_info.poolSizeCount = static_cast<uint32_t>(pool_sizes.size());
|
||||
descriptor_pool_info.pPoolSizes = pool_sizes.data();
|
||||
descriptor_pool_info.maxSets = setsCount * 2; // 额外预留一些集合
|
||||
descriptor_pool_info.maxSets = setsCount + 7; // 额外预留一些集合
|
||||
descriptor_pool_info.flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT;
|
||||
|
||||
VK_CHECK(vkCreateDescriptorPool(device, &descriptor_pool_info, nullptr, &descriptor_pool));
|
||||
@@ -652,7 +652,7 @@ void FaceApp::render(VkCommandBuffer commandBuffer, long long frameTime)
|
||||
if (game_time > actionTime)
|
||||
{
|
||||
_curTexIndex++;
|
||||
if (_curTexIndex >= _curMotion.png_num)
|
||||
if (_curTexIndex >= _curMotion.png_names.size())
|
||||
{
|
||||
_curTexIndex = 0;
|
||||
}
|
||||
@@ -1151,23 +1151,23 @@ void FaceApp::changeMotion(Motion& motion)
|
||||
return;
|
||||
}
|
||||
_curMotion = motion;
|
||||
for (int i = 0; i < _curMotion.png_num; ++i)
|
||||
for (int i = 0; i < _curMotion.png_names.size(); ++i)
|
||||
{
|
||||
|
||||
#ifdef _WIN32
|
||||
//string path = _curMotion.type + "/" + _curMotion.technique + "/" + _curMotion.step + "/" + _curMotion.show_type;
|
||||
string path = "pic";
|
||||
string path_name = path + "/" + _curMotion.png_name;// +std::to_string(i) + ".png";
|
||||
string path_name = path + "/" + _curMotion.type + "/" + _curMotion.png_names[i];// +std::to_string(i) + ".png";
|
||||
loadTextureExample(UTF8ToWideString(path_name), m_texs[i], true);
|
||||
if (kThick)
|
||||
{
|
||||
string path_name_ex = path + "/" + _curMotion.png_name + std::to_string(i) + "_thick.png";
|
||||
string path_name_ex = path + "/" + _curMotion.type + "/" + _curMotion.png_names[i] + std::to_string(i) + "_thick.png";
|
||||
loadTextureExample(UTF8ToWideString(path_name_ex), m_texs_ex[i], true);
|
||||
}
|
||||
#else
|
||||
//string path = _curMotion.type + "/" + _curMotion.technique + "/" + _curMotion.step + "/" + _curMotion.show_type;
|
||||
string path = "pic";
|
||||
string path_name = path + "/" + _curMotion.png_name;// +std::to_string(i) + ".png";
|
||||
string path_name = path + "/" + _curMotion.type + "/" + _curMotion.png_names[i];// +std::to_string(i) + ".png";
|
||||
loadTexture(path_name, m_texs[i], true);
|
||||
if (kThick)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user