基本调通 回调

This commit is contained in:
xsl
2025-11-29 23:44:22 +08:00
parent 1859706412
commit 835f768a4a
8 changed files with 311 additions and 76 deletions
+24 -6
View File
@@ -2,6 +2,7 @@
#define __FaceApp_H__
#include "Application.h"
#include <functional>
#include "../third_party/vma/include/vk_mem_alloc.h"
#include <map>
#include <glm/glm.hpp>
@@ -24,8 +25,8 @@ struct InitArg
{
int action_fps;
float zoom;
Motion motion;
NLOHMANN_DEFINE_TYPE_INTRUSIVE(InitArg, action_fps, zoom, motion);
//Motion motion;
NLOHMANN_DEFINE_TYPE_INTRUSIVE(InitArg, action_fps, zoom);
};
@@ -33,7 +34,7 @@ struct PushConstants {
float myValue;
};
using Callback = std::function<void(const std::string&)>;
class FaceApp :public Application
{
@@ -79,6 +80,7 @@ private:
void setup_descriptor_pool();
void setup_descriptor_set_layout();
void setup_descriptor_set();
void update_descriptor_set(vector<Texture>& texs);
const bool kThick = false;
void copyBuffer(VkBuffer srcBuffer, VkBuffer dstBuffer, VkDeviceSize size);
@@ -102,6 +104,7 @@ private:
vector<VkDescriptorSet> m_descriptor_sets;
const uint32_t kMaxTexture = 30;
vector<Texture> m_texs;
vector<Texture> m_texs_next;
vector<Texture> m_texs_ex;
@@ -135,10 +138,25 @@ private:
public:
void changeMotion(const char* json);
void changeMotion(Motion& motion);
Callback _callback;
string preReadyMotion(const std::string& json, Callback callback);
void changeMotion(const string motion_type);
//void changeMotion(Motion& motion);
InitArg _initArg;
Motion _curMotion;
//Motion _curMotion;
string _curMotion_type;
int _curMotion_png_size;
Motion _nextMotion;
int _nextMotionIndex;
enum MotionState {
ready,
loading_next_motion,
load_next_motion_finished,
};
MotionState _motionState = ready;
int _curTexIndex = 0;
void SetInitArg(const char* arg);