debug_fix_screen_change #2

Merged
xsl merged 35 commits from debug_fix_screen_change into main 2026-04-26 10:58:01 +08:00
3 changed files with 41 additions and 8 deletions
Showing only changes of commit c83f36c976 - Show all commits
+9 -5
View File
@@ -692,10 +692,12 @@ void FaceApp::render(VkCommandBuffer commandBuffer, long long frameTime)
return;
}
string curMotionName = _curMotions[_curMotionIndex].name;
int loadMotionIndex = motion_list_map[curMotionName];
//if (cur_left)
{
vkCmdBindDescriptorSets(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, m_pipelineLayout, 0, 1, &m_descriptor_sets_left[_curMotionIndex], 0, NULL);
}
//{
vkCmdBindDescriptorSets(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, m_pipelineLayout, 0, 1, &m_descriptor_sets_left[loadMotionIndex], 0, NULL);
//}
//else
//{
// vkCmdBindDescriptorSets(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, m_pipelineLayout, 0, 1, &m_descriptor_sets_right[_curMotionIndex], 0, NULL);
@@ -1478,8 +1480,10 @@ void FaceApp::loadMotionThread()
string path_name = path + "/" + _loadMotions[i].name + "ex.png";
loadTexture(path_name, pre_texs[i], true, commandPool_ex);
#endif // _WIN32
motion_list_map[_loadMotions[i].name] = i;
}
update_descriptor_set(m_texs_left, m_descriptor_sets_left);
_isLoadMotion = false;
_callback_loadfinish();
}
@@ -1532,7 +1536,7 @@ void FaceApp::changeMotionList(vector<string> motions, AnimationFinishedCallback
//}
//else
//{
update_descriptor_set(m_texs_left, m_descriptor_sets_left);
// update_descriptor_set(m_texs_left, m_descriptor_sets_left);
// cur_left = true;
//}
+4
View File
@@ -120,6 +120,10 @@ private:
const uint32_t kTextureInit = 1;
const uint32_t kTextureMax = 20;
vector<Texture> m_texs_left;
map<string, int> motion_list_map;
//vector<Texture> m_texs_right;
//bool cur_left = true;
+28 -3
View File
@@ -49,7 +49,7 @@ void CppAnimationFinishedCallback()
void CppCallback()
{
vector<string> motions = {"4", "11", "13"};
vector<string> motions = {"4"};
g_app->changeMotionList(motions, CppAnimationFinishedCallback, true);
}
@@ -88,6 +88,27 @@ void loadMotions(const std::string& filePath, std::map<std::string, Motion>& mot
}
}
bool threadRun = false;
// 线程要执行的函数
void threadFunction() {
int startTime = 0;
for (int i = 0; i < 500; ++i)
{
if (!threadRun)
{
break;
}
startTime += 100;
if (startTime == 10 * 1000)
{
vector<string> motions = { "5" };
g_app->changeMotionList(motions, CppAnimationFinishedCallback, true);
}
std::this_thread::sleep_for(std::chrono::milliseconds(100)); // 暂停200ms
}
}
int main() {
@@ -143,13 +164,17 @@ int main() {
MotionList s_motions;
s_motions.motions.push_back(motions["4"]);
s_motions.motions.push_back(motions["11"]);
s_motions.motions.push_back(motions["13"]);
s_motions.motions.push_back(motions["5"]);
//s_motions.motions.push_back(motions["13"]);
json j = s_motions;
auto s = j.dump();
app.preLoadMotionList(s, CppCallback);
threadRun = true;
std::thread t(threadFunction);
app.mainLoop();
threadRun = false;
t.join();
//try {
// app.mainLoop();
//} catch (const std::exception& e) {