添加了动画,资源也改为英文名了

This commit is contained in:
xsl
2025-10-26 21:54:34 +08:00
parent b2da84f903
commit 57b7c40835
16 changed files with 66 additions and 37 deletions
+27 -5
View File
@@ -4,7 +4,6 @@
FaceApp* FaceApp::faceIns = nullptr;
FaceApp::FaceApp(/* args */)
@@ -515,8 +514,21 @@ void FaceApp::setup_descriptor_set()
}
void FaceApp::render(VkCommandBuffer commandBuffer)
void FaceApp::render(VkCommandBuffer commandBuffer, long long frameTime)
{
static long long game_time = 0;
game_time += frameTime;
long long actionTime = (1000 / _initArg.action_fps);
if (game_time > actionTime)
{
_curTexIndex++;
if (_curTexIndex >= _curMotion.png_num)
{
_curTexIndex = 0;
}
game_time = game_time - actionTime;
}
std::unique_lock<std::mutex> lock(mtx);
std::unique_lock<std::mutex> lock_point(mtx_point);
//Application::render(commandBuffer);
@@ -527,7 +539,8 @@ void FaceApp::render(VkCommandBuffer commandBuffer)
vkCmdPushConstants(commandBuffer, m_pipelineLayout_bg, VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof(float), &myFloatValue);
//vkCmdDraw(commandBuffer, 6, 1, 0, 0);
vkCmdDraw(commandBuffer, 6, 1, 0, 0);
vkCmdBindDescriptorSets(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, m_pipelineLayout, 0, 1, &m_descriptor_sets[_curTexIndex], 0, NULL);
@@ -604,8 +617,9 @@ void FaceApp::initVulkan()
uploadVertexData();
last_update_time = getCurrentTimeMillis();
faceAppInited = true;
changeMotion(_initArg.motion);
faceAppInited = true;
#if _WIN32
std::vector<float> floatArray;
std::string& str = HardCodeData::Get().face_result_point_str;
@@ -616,6 +630,7 @@ void FaceApp::initVulkan()
}
//ReceiveFacePoint(floatArray.data(), floatArray.size() / 3, 480, 480);
#endif
}
@@ -1003,8 +1018,15 @@ void FaceApp::changeMotion(Motion& motion)
{
string path = _curMotion.type + "/" + _curMotion.technique + "/" + _curMotion.step + "/" + _curMotion.show_type;
string path_name = path + "/" + _curMotion.png_name + std::to_string(i) + ".png";
loadTexture(path_name, m_texs[i], true);
string path_name_ex = path + "/" + _curMotion.png_name + std::to_string(i) + "_thick.png";
#ifdef _WIN32
loadTextureExample(path_name, m_texs[i], true);
loadTextureExample(path_name_ex, m_texs_ex[i], true);
#else
loadTexture(path_name, m_texs[i], true);
loadTexture(path_name, path_name_ex[i], true);
#endif // _WIN32
}
}