Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/helpers/Rasterize.cpp
Show All 34 Lines | void SimRasterize::RasterizeRectWithClearance(Spans& spans, | ||||
// To fix this, we need to make sure that the short-range pathfinder is always mostly | // To fix this, we need to make sure that the short-range pathfinder is always mostly | ||||
// included in the rasterisation. The easiest way is to rasterise more, thus this variable | // included in the rasterisation. The easiest way is to rasterise more, thus this variable | ||||
// Since this is a very complicated subject, check out logs on 31/10/2015 for more detailled info. | // Since this is a very complicated subject, check out logs on 31/10/2015 for more detailled info. | ||||
// or ask wraitii about it. | // or ask wraitii about it. | ||||
// If the short-range pathfinder is sufficiently changed, this could become unnecessary and thus removed. | // If the short-range pathfinder is sufficiently changed, this could become unnecessary and thus removed. | ||||
// A side effect is that the basic clearance has been set to 0.8, so removing this constant should be done | // A side effect is that the basic clearance has been set to 0.8, so removing this constant should be done | ||||
// in parallel with setting clearance back to 1 for the default passability class (though this isn't strictly necessary). | // in parallel with setting clearance back to 1 for the default passability class (though this isn't strictly necessary). | ||||
// Also: the code detecting foundation obstruction in CcmpObstructionManager had to be changed similarly. | // Also: the code detecting foundation obstruction in CcmpObstructionManager had to be changed similarly. | ||||
// | |||||
// NB: because of this, if a entity wants to move very close to the actual obstruction of another entity | |||||
// it may never be able to get there, as there could be 1 extra navcell in between the actual square shape and the raster. | |||||
// So while this stands, max ranges should not be too small, or units might get stuck. | |||||
entity_pos_t rasterClearance = clearance + Pathfinding::CLEARANCE_EXTENSION_RADIUS; | entity_pos_t rasterClearance = clearance + Pathfinding::CLEARANCE_EXTENSION_RADIUS; | ||||
// Get the bounds of cells that might possibly be within the shape | // Get the bounds of cells that might possibly be within the shape | ||||
// (We'll then test each of those cells more precisely) | // (We'll then test each of those cells more precisely) | ||||
CFixedVector2D shapeHalfSize(CFixedVector2D(shape.hw, shape.hh)); | CFixedVector2D shapeHalfSize(CFixedVector2D(shape.hw, shape.hh)); | ||||
CFixedVector2D halfSize(shape.hw + rasterClearance, shape.hh + rasterClearance); | CFixedVector2D halfSize(shape.hw + rasterClearance, shape.hh + rasterClearance); | ||||
CFixedVector2D halfBound = Geometry::GetHalfBoundingBox(shape.u, shape.v, halfSize); | CFixedVector2D halfBound = Geometry::GetHalfBoundingBox(shape.u, shape.v, halfSize); | ||||
i16 i0 = ((shape.x - halfBound.X) / cellSize).ToInt_RoundToNegInfinity(); | i16 i0 = ((shape.x - halfBound.X) / cellSize).ToInt_RoundToNegInfinity(); | ||||
▲ Show 20 Lines • Show All 75 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator