修改底层渲染为OpenGL

This commit is contained in:
2025-10-23 15:21:12 +08:00
parent 1fe898e09c
commit f9a2300b5a
37 changed files with 2782 additions and 3761 deletions

View File

@@ -8,7 +8,7 @@ class Game;
/**
* @brief Sprite类继承自Component类用于表示游戏中的精灵组件
*/
class Sprite : public RenderBase
class Sprite : public RenderBase
{
protected:
RefPtr<Texture> m_texture = nullptr;
@@ -22,36 +22,26 @@ public:
void PreRender() override;
void Clear() override;
void Init() override;
void SetTexture(RefPtr<Texture> texture);
RefPtr<Texture> GetTexture();
public:
// 渲染信息
RenderGuidanceInfo _RenderGuidanceInfo;
// 裁切数据
SDL_Rect CropRect = {0, 0, 0, 0};
// 裁切Flag
bool CropFlag = false;
// 阴影数据
std::array<SDL_Vertex, 4> vertices;
// 阴影Flag
bool ShadowFlag = false;
// 混合模式
LE_BlEND_MODE _BlendMode = NONE;
std::string imgPath;
int Index;
public:
// 计算渲染信息
void CalcRenderInfoLogic();
// 设置裁切区域
void SetClipRect(SDL_Rect clipRect);
// 取消裁切区域
void UnsetClipRect();
// 设置混合模式
void SetBlendMode(SDL_BlendMode blendMode);
void SetBlendMode(LE_BlEND_MODE mode);
// 混合
void Blend();
// 获取混合模式
SDL_BlendMode GetBlendMode();
// 设置阴影
void SetShadow();
// 计算阴影数据
void CalculateShadowData();
LE_BlEND_MODE GetBlendMode();
};