修改底层渲染为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

@@ -67,20 +67,20 @@ void Animation::Init(std::string AniPath)
// TODO 染色
// 判断是否有Als
// if (Asset_Script::GetInstance().GetFileInfo(AniPath + ".als"))
// {
// AniScriptParser::AlsInfo Info = AssetManager::GetInstance().StructAlsInfo(AniPath + ".als");
// if (Info.AniList.size() > 0)
// {
// std::string Dir = AniPath.substr(0, AniPath.find_last_of("/") + 1);
// for (auto &Ani : Info.AniList)
// {
// RefPtr<Animation> AlsAniObj = new Animation(Dir + Ani.second.path);
// AlsAniObj->SetRenderZOrder(Ani.second.layer[1]);
// AddChild(AlsAniObj);
// }
// }
// }
if (Asset_Script::GetInstance().GetFileInfo(AniPath + ".als"))
{
AniScriptParser::AlsInfo Info = AssetManager::GetInstance().StructAlsInfo(AniPath + ".als");
if (Info.AniList.size() > 0)
{
std::string Dir = AniPath.substr(0, AniPath.find_last_of("/") + 1);
for (auto &Ani : Info.AniList)
{
RefPtr<Animation> AlsAniObj = new Animation(Dir + Ani.second.path);
AlsAniObj->SetRenderZOrder(Ani.second.layer[1]);
AddChild(AlsAniObj);
}
}
}
FlushFrame(0);
}
@@ -133,20 +133,7 @@ void Animation::Update(float deltaTime)
void Animation::Render()
{
if (!Visible)
return;
// 是否裁切
if (CropFlag)
{
SDL_Renderer *renderer = Game::GetInstance().GetRenderer();
SDL_RenderSetClipRect(renderer, &CropRect);
Actor::Render();
SDL_RenderSetClipRect(renderer, NULL);
}
else
{
Actor::Render();
}
Actor::Render();
}
void Animation::OnAdded(BaseNode *node)
@@ -210,7 +197,7 @@ void Animation::FlushFrame(int Index)
// 线性减淡
if (FlagBuf.count("GRAPHIC_EFFECT_LINEARDODGE"))
{
CurrentFrame->SetBlendMode(SDL_BLENDMODE_ADD);
CurrentFrame->SetBlendMode(LINEARDODGE);
}
// 旋转
if (FlagBuf.count("IMAGE_ROTATE"))
@@ -328,22 +315,3 @@ void Animation::InterpolationLogic()
CurrentFrame->SetRotation(OldAngleData + (NewAngleData - OldAngleData) * InterRate);
}
}
void Animation::SetClipRect(SDL_Rect clipRect)
{
CropFlag = true;
CropRect = clipRect;
}
void Animation::UnsetClipRect()
{
CropFlag = false;
}
void Animation::SetShadow()
{
for (auto &Sp : SpriteArr)
{
Sp->SetShadow();
}
}