修改OpenGl渲染底层之前

This commit is contained in:
2025-10-20 20:50:12 +08:00
parent 1b011b9b68
commit 2b888aae5b
61 changed files with 1609 additions and 680 deletions

View File

@@ -11,67 +11,47 @@ class Game;
class Sprite : public RenderBase
{
protected:
/* data */
RefPtr<Texture> m_texture = nullptr;
public:
/**
* @brief Sprite类的默认构造函数
*/
Sprite(/* args */);
/**
* @brief Sprite类的带参数构造函数
* @param imgPath 纹理图片路径
* @param Index 索引值
*/
Sprite() = default;
Sprite(std::string imgPath, int Index);
/**
* @brief Sprite类的带参数构造函数
* @param imgPath 纹理图片文件路径
*/
Sprite(std::string PngPath);
/**
* @brief Sprite类的析构函数
*/
~Sprite();
/**
* @brief 处理事件
* @param e SDL事件指针
*/
void HandleEvents(SDL_Event *e) override;
/**
* @brief 更新组件状态
* @param deltaTime 时间增量
*/
void Update(float deltaTime) override;
/**
* @brief 渲染组件
* @param deltaTime 时间增量
*/
void Render() override;
/**
* @brief 清理组件资源
*/
void PreRender() override;
void Clear() override;
void Init() override;
/**
* @brief 获取纹理
* @return SDL_Texture* 纹理指针
*/
RefPtr<Texture> GetTexture();
void SetIterationPos(VecFPos pos) override;
public:
// 渲染信息
RenderGuidanceInfo _RenderGuidanceInfo;
// 裁切数据
SDL_Rect CropRect = {0, 0, 0, 0};
// 裁切Flag
bool CropFlag = false;
// 阴影数据
std::array<SDL_Vertex, 4> vertices;
// 阴影Flag
bool ShadowFlag = false;
std::string imgPath;
int Index;
public:
// 计算渲染信息
void CalcRenderInfoLogic();
// 设置裁切区域
void SetClipRect(SDL_Rect clipRect);
// 取消裁切区域
void UnsetClipRect();
// 设置混合模式
void SetBlendMode(SDL_BlendMode blendMode);
// 获取混合模式
SDL_BlendMode GetBlendMode();
// 设置阴影
void SetShadow();
// 计算阴影数据
void CalculateShadowData();
};