1. 抽离了LApp的部分内容,以解耦其对Qt的依赖,并且尝试了拓展多渲染后端支持。
This commit is contained in:
+26
-7
@@ -9,11 +9,12 @@
|
||||
|
||||
#include "LAppOpenGL.hpp"
|
||||
#include "LAppAllocator.hpp"
|
||||
#include "GLCore.h"
|
||||
#include "IRenderContext.hpp"
|
||||
#include <functional>
|
||||
|
||||
class LAppView;
|
||||
class LAppTextureManager;
|
||||
class GLCore;
|
||||
// class QWidget; // [Misaki] 已完全解耦Qt
|
||||
|
||||
/**
|
||||
* @brief アプリケーションクラス。
|
||||
@@ -37,17 +38,29 @@ public:
|
||||
static void ReleaseInstance();
|
||||
|
||||
// 新增
|
||||
// resize 由应用层(GLCore::resizeGL)调用,通知LApp窗口尺寸变更
|
||||
void resize(int width, int height);
|
||||
|
||||
// 新增
|
||||
void update();
|
||||
|
||||
IRenderContext* GetRenderContext() const { return _renderContext; }
|
||||
void SetRenderContext(IRenderContext* ctx) { _renderContext = ctx; }
|
||||
|
||||
// [Misaki] 窗口大小变更回调 — 解耦 AppContext/GLCore 依赖
|
||||
// 当模型加载后需要调整窗口大小时,LAppLive2DManager 通过此回调通知应用层
|
||||
using WindowResizeFunc = std::function<void(int width, int height)>;
|
||||
void SetWindowResizeCallback(WindowResizeFunc cb) { _onResizeWindow = std::move(cb); }
|
||||
void NotifyWindowResize(int width, int height) { if (_onResizeWindow) _onResizeWindow(width, height); }
|
||||
|
||||
/**
|
||||
* @brief APPに必要なものを初期化する。
|
||||
* @param windowWidth 窗口宽度(像素)
|
||||
* @param windowHeight 窗口高度(像素)
|
||||
*/
|
||||
//bool Initialize();
|
||||
bool Initialize(GLCore* window);
|
||||
// bool Initialize(GLCore* window); // [Misaki] 原
|
||||
// bool Initialize(QWidget* window); // [Misaki] 中间解耦版本
|
||||
bool Initialize(int windowWidth, int windowHeight); // [Misaki] 完全解耦Qt,仅传入尺寸
|
||||
|
||||
/**
|
||||
* @brief 解放する。
|
||||
@@ -86,9 +99,12 @@ public:
|
||||
GLuint CreateShader();
|
||||
|
||||
/**
|
||||
* @brief Window情報を取得する。
|
||||
* @brief Window尺寸を取得する。
|
||||
*/
|
||||
GLCore* GetWindow() { return _window; } // Misaki 修改
|
||||
// GLCore* GetWindow() { return _window; } // [Misaki] 原
|
||||
// QWidget* GetWindow() { return _window; } // [Misaki] 中间版本
|
||||
int GetWindowWidth() const { return _windowWidth; } // [Misaki] 完全解耦Qt
|
||||
int GetWindowHeight() const { return _windowHeight; } // [Misaki] 完全解耦Qt
|
||||
|
||||
/**
|
||||
* @brief View情報を取得する。
|
||||
@@ -128,10 +144,13 @@ private:
|
||||
*/
|
||||
bool CheckShader(GLuint shaderId);
|
||||
|
||||
IRenderContext* _renderContext = nullptr;
|
||||
WindowResizeFunc _onResizeWindow; ///< [Misaki] 窗口大小回调
|
||||
LAppAllocator _cubismAllocator; ///< Cubism SDK Allocator
|
||||
Csm::CubismFramework::Option _cubismOption; ///< Cubism SDK Option
|
||||
//GLFWwindow* _window; ///< OpenGL ウィンドウ
|
||||
GLCore* _window; ///< Misaki 修改
|
||||
// GLCore* _window; ///< Misaki 修改
|
||||
// QWidget* _window; ///< [Misaki] 使用QWidget基类,解耦GLCore
|
||||
LAppView* _view; ///< View情報
|
||||
bool _captured; ///< クリックしているか
|
||||
float _mouseX; ///< マウスX座標
|
||||
|
||||
Reference in New Issue
Block a user