feat(渲染): 实现NPC和地图层的渲染优化
重构NPC渲染逻辑,将交互高亮同步移至Render方法 为NpcAnimation添加帧激活检查以避免无效纹理刷新 为GameMapLayer添加调试覆盖层画布,优化可行区域和移动区域渲染 更新测试场景地图路径和相机控制器设置
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <frostbite2D/2d/canvas_actor.h>
|
||||
#include <frostbite2D/2d/actor.h>
|
||||
#include <vector>
|
||||
|
||||
@@ -18,15 +19,29 @@ public:
|
||||
void AddObject(RefPtr<Actor> obj);
|
||||
|
||||
private:
|
||||
void EnsureDebugOverlayCanvases();
|
||||
void RefreshFeasibleAreaOverlay();
|
||||
void RefreshMoveAreaOverlay();
|
||||
Rect ComputeFeasibleAreaOverlayBounds() const;
|
||||
Rect ComputeMoveAreaOverlayBounds() const;
|
||||
void DrawFeasibleAreaOverlay() const;
|
||||
void DrawMoveAreaOverlay() const;
|
||||
|
||||
struct DebugMoveAreaInfo {
|
||||
Rect rect;
|
||||
size_t index = kInvalidMoveAreaIndex;
|
||||
};
|
||||
|
||||
RefPtr<CanvasActor> feasibleAreaOverlayCanvas_ = nullptr;
|
||||
RefPtr<CanvasActor> moveAreaOverlayCanvas_ = nullptr;
|
||||
std::vector<Vec2> feasibleAreaPolygon_;
|
||||
std::vector<Rect> feasibleAreaFillRects_;
|
||||
std::vector<DebugMoveAreaInfo> moveAreaInfoList_;
|
||||
size_t highlightedMoveAreaIndex_ = kInvalidMoveAreaIndex;
|
||||
Rect feasibleAreaOverlayBounds_;
|
||||
Rect moveAreaOverlayBounds_;
|
||||
bool feasibleAreaOverlayDirty_ = true;
|
||||
bool moveAreaOverlayDirty_ = true;
|
||||
};
|
||||
|
||||
} // namespace frostbite2D
|
||||
|
||||
Reference in New Issue
Block a user