forked from a1928370421/Bongobs-Cat-Plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
VtuberDelegate.hpp
123 lines (82 loc) · 2.58 KB
/
VtuberDelegate.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/**
Created by Weng Y on 2020/05/25.
Copyright © 2020 Weng Y. Under GNU General Public License v2.0.
*/
#pragma once
#include <GL/glew.h>
#include "LAppAllocator.hpp"
#include <GLFW/glfw3.h>
#define MAXMODELCOUNT 1024
class View;
class LAppTextureManager;
class Hook;
/**
* @brief アプリケーションクラス。
* Cubism SDK の管理を行う。
*/
class VtuberDelegate {
struct RenderInfo {
bool isLoadResource;
//view
double viewPoint_x;
double viewPoint_y;
int windowWidth;
int windowHeight;
double Scale;
};
public:
static VtuberDelegate *GetInstance();
static void ReleaseInstance();
/*
*@breif 不处理opengl相关的初始化
*/
bool LoadResource(int id);
void ReleaseResource(int id);
bool Initialize(int id);
void Release();
bool isLoadResource(int id);
int getBufferWidth(int id);
int getBufferHeight(int id);
double getScale(int id);
double GetX(int id);
double GetY(int id);
void UpdataViewWindow(double _x,double _y,int _width, int _height,double _scale, int _id);
View* GetView() { return _view; }
LAppTextureManager* GetTextureManager() { return _textureManager; }
/**
* @brief 渲染一帧画面到指定缓冲
*/
void Reader(int targatid, char *data, int bufferWidth, int bufferheight);
void ChangeModel(const char *ModelName, int id);
void updataModelSetting(bool _randomMotion, double _delayTime, bool _breath,
bool _eyeBlink, bool _track,
bool _isMouseHorizontalFlip,bool _isMouseVerticalFlip,
int id);
const char ** GetModeDefine(int &size);
void ChangeMode(const char *_mode, bool _live2D,bool _isUseMask, int id);
void ChangeMouseMovement(bool _mouse);
GLuint CreateShader();
bool CheckShader(GLuint shaderId);
private:
/**
* @brief コンストラクタ
*/
VtuberDelegate();
/**
* @brief デストラクタ
*/
~VtuberDelegate();
/**
* @brief Cubism SDK の初期化
*/
void InitializeCubism();
LAppAllocator _cubismAllocator; ///< Cubism SDK Allocator
Csm::CubismFramework::Option _cubismOption; ///< Cubism SDK Option
GLFWwindow* _window; ///< OpenGL ウィンドウ
View* _view; ///< View情報
Hook *_hook;
LAppTextureManager* _textureManager; ///< テクスチャマネージャー
char *ModelFileName[MAXMODELCOUNT]; ///模型文件夹的名称集合
int ModelFileCount; ///模型数量
RenderInfo _renderInfo[MAXMODELCOUNT];
};