将游戏层和UI层分开渲染 并提高了缩放质量

This commit is contained in:
2025-10-26 14:38:14 +08:00
parent 585724b512
commit dc0213dc16
5 changed files with 56 additions and 24 deletions

View File

@@ -31,8 +31,12 @@ private:
// 窗口尺寸
int _windowWidth;
int _windowHeight;
// 正交投影矩阵
glm::mat4 _orthoMatrix;
// 游戏正交投影矩阵
glm::mat4 _GameOrthoMatrix;
// UI的正交投影矩阵
glm::mat4 _UIOrthoMatrix;
// 渲染的正交投影矩阵
glm::mat4 _OrthoMatrix;
// 渲染器上下文
SDL_GLContext _ctx;
@@ -46,6 +50,9 @@ private:
// 当前使用渲染参数
GL_RenderParams _currentRenderParams;
public:
// 单帧渲染调用次数
int _frameRenderCount = 0;
public:
RenderManager(SDL_Window *window);
~RenderManager();
@@ -69,6 +76,9 @@ public:
void CloseClipRect();
// 绘制纹理
void DrawTexture(RefPtr<Texture> texture, const SDL_Rect *srcrect, const SDL_FRect *dstrect, const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip, void *userdata = nullptr);
// 设置正交投影矩阵类型
void SetOrthoMatrixType(int type);
private:
// 编译着色器