Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/helpers/HierarchicalPathfinder.h
Show First 20 Lines • Show All 300 Lines • ▼ Show 20 Lines | public: | ||||
HierarchicalOverlay(HierarchicalPathfinder& pathfinderHier) : | HierarchicalOverlay(HierarchicalPathfinder& pathfinderHier) : | ||||
TerrainTextureOverlay(Pathfinding::NAVCELLS_PER_TILE), m_PathfinderHier(pathfinderHier) | TerrainTextureOverlay(Pathfinding::NAVCELLS_PER_TILE), m_PathfinderHier(pathfinderHier) | ||||
{ | { | ||||
} | } | ||||
virtual void BuildTextureRGBA(u8* data, size_t w, size_t h) | virtual void BuildTextureRGBA(u8* data, size_t w, size_t h) | ||||
{ | { | ||||
ENSURE(h <= std::numeric_limits<u16>::max() && w <= std::numeric_limits<u16>::max()); | |||||
u16 height = static_cast<u16>(h); | |||||
u16 width = static_cast<u16>(w); | |||||
pass_class_t passClass = m_PathfinderHier.GetPassabilityClass("default"); | pass_class_t passClass = m_PathfinderHier.GetPassabilityClass("default"); | ||||
for (size_t j = 0; j < h; ++j) | for (u16 j = 0; j < height; ++j) | ||||
{ | { | ||||
for (size_t i = 0; i < w; ++i) | for (u16 i = 0; i < width; ++i) | ||||
{ | { | ||||
SColor4ub color; | SColor4ub color; | ||||
HierarchicalPathfinder::RegionID rid = m_PathfinderHier.Get(i, j, passClass); | HierarchicalPathfinder::RegionID rid = m_PathfinderHier.Get(i, j, passClass); | ||||
if (rid.r == 0) | if (rid.r == 0) | ||||
color = SColor4ub(0, 0, 0, 0); | color = SColor4ub(0, 0, 0, 0); | ||||
else if (rid.r == 0xFFFF) | else if (rid.r == 0xFFFF) | ||||
color = SColor4ub(255, 0, 255, 255); | color = SColor4ub(255, 0, 255, 255); | ||||
Show All 14 Lines |
Wildfire Games · Phabricator