feat(渲染): 实现NPC和地图层的渲染优化
重构NPC渲染逻辑,将交互高亮同步移至Render方法 为NpcAnimation添加帧激活检查以避免无效纹理刷新 为GameMapLayer添加调试覆盖层画布,优化可行区域和移动区域渲染 更新测试场景地图路径和相机控制器设置
This commit is contained in:
@@ -93,9 +93,9 @@ private:
|
||||
int backgroundRepeatWidth_ = 0;
|
||||
/// 地图配置里的整体 Y 偏移;既影响层位置,也影响地板校准。
|
||||
int mapOffsetY_ = 0;
|
||||
bool debugMode_ = true;
|
||||
bool debugMode_ = false;
|
||||
/// 硬编码调试开关:关闭后忽略可行走区域检测,允许角色自由移动。
|
||||
bool movableAreaCheckEnabled_ = false;
|
||||
bool movableAreaCheckEnabled_ = true;
|
||||
/// 当前地图正在播放的背景音乐。
|
||||
Ptr<Music> currentMusic_;
|
||||
};
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -42,6 +42,7 @@ public:
|
||||
}
|
||||
|
||||
void Update(float deltaTime) override;
|
||||
void Render() override;
|
||||
|
||||
private:
|
||||
void EnsureInteractionHighlight();
|
||||
|
||||
Reference in New Issue
Block a user