save code

This commit is contained in:
xsl
2025-12-24 10:55:30 +08:00
parent 4c5a05ae21
commit f5b2d490c0
5 changed files with 81 additions and 63 deletions
+46 -42
View File
@@ -778,60 +778,64 @@ void FaceApp::initVulkan()
{
Application::initVulkan();
createVmaAllocator();
LoadOBJ("face_picture_3dmax.obj", obj_vertices, obj_indices);
//m_texs_left.resize(kTextureMax);
//m_texs_right.resize(kTextureMax);
if (kThick)
if (!_faceAppInited)
{
m_texs_thick.resize(kTextureMax);
}
std::vector<unsigned char> data = readFileUnsignedChar("dummy.png", false);
unsigned error = lodepng::decode(dummy_data, dummy_w, dummy_h, data, LCT_RGBA, 8);
for (int i = 0; i < kTextureInit; ++i)
{
//string id_str = std::to_string(i);
//loadTexture(dummy_data, dummy_data.size(), dummy_w, dummy_h, m_texs_left[i], true, commandPool, "dummy.png_left_" + id_str);
//loadTexture(dummy_data, dummy_data.size(), dummy_w, dummy_h, m_texs_right[i], true, commandPool, "dummy.png_right_" + id_str);
createVmaAllocator();
LoadOBJ("face_picture_3dmax.obj", obj_vertices, obj_indices);
//m_texs_left.resize(kTextureMax);
//m_texs_right.resize(kTextureMax);
if (kThick)
{
//loadTexture(dummy_data, dummy_data.size(), dummy_w, dummy_h, m_texs_thick[i], true, commandPool, "dummy.png_thick_" + id_str);
m_texs_thick.resize(kTextureMax);
}
}
loadTexture("out.png", tex_bg, true, commandPool);
createVertexBuffer();
createUniformBuffer();
setup_descriptor_pool();
setup_descriptor_set_layout();
setup_descriptor_set();
create_face_pipelines();
std::vector<unsigned char> data = readFileUnsignedChar("dummy.png", false);
unsigned error = lodepng::decode(dummy_data, dummy_w, dummy_h, data, LCT_RGBA, 8);
setup_descriptor_set_layout_bg();
setup_descriptor_set_bg();
create_pipelines_bg();
for (int i = 0; i < kTextureInit; ++i)
{
//string id_str = std::to_string(i);
//loadTexture(dummy_data, dummy_data.size(), dummy_w, dummy_h, m_texs_left[i], true, commandPool, "dummy.png_left_" + id_str);
//loadTexture(dummy_data, dummy_data.size(), dummy_w, dummy_h, m_texs_right[i], true, commandPool, "dummy.png_right_" + id_str);
if (kThick)
{
//loadTexture(dummy_data, dummy_data.size(), dummy_w, dummy_h, m_texs_thick[i], true, commandPool, "dummy.png_thick_" + id_str);
}
}
uploadVertexData();
last_update_time = getCurrentTimeMillis();
loadTexture("out.png", tex_bg, true, commandPool);
createVertexBuffer();
createUniformBuffer();
setup_descriptor_pool();
//changeMotion(_initArg.motion);
Start();
setup_descriptor_set_layout();
setup_descriptor_set();
create_face_pipelines();
setup_descriptor_set_layout_bg();
setup_descriptor_set_bg();
create_pipelines_bg();
uploadVertexData();
last_update_time = getCurrentTimeMillis();
//changeMotion(_initArg.motion);
Start();
_faceAppInited = true;
#if _WIN32
std::vector<float> floatArray;
std::string& str = HardCodeData::Get().face_result_point_str;
std::stringstream ss(str);
std::string token;
while (std::getline(ss, token, ',')) {
floatArray.push_back(std::stof(token));
}
std::vector<float> floatArray;
std::string& str = HardCodeData::Get().face_result_point_str;
std::stringstream ss(str);
std::string token;
while (std::getline(ss, token, ',')) {
floatArray.push_back(std::stof(token));
}
//ReceiveFacePoint(floatArray.data(), floatArray.size() / 3, 480, 480);
//ReceiveFacePoint(floatArray.data(), floatArray.size() / 3, 480, 480);
#endif
}
}
void FaceApp::Start()
@@ -1470,7 +1474,7 @@ string FaceApp::preLoadMotionList(string motion_list_str, Callback callback)
void FaceApp::loadMotionThread()
{
while (!_running)
while (!isInited())
{
std::this_thread::sleep_for(std::chrono::milliseconds(50));
}