mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-06 21:45:35 +00:00
Make sure areas size is 2 for rectangle
This commit is contained in:
parent
671e1e5424
commit
5972520b1a
1 changed files with 7 additions and 7 deletions
|
@ -198,7 +198,7 @@ namespace
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rasterizeTriangles(rcContext& context, const Rectangle& rectangle, const rcConfig& config,
|
bool rasterizeTriangles(rcContext& context, const Rectangle& rectangle, const rcConfig& config,
|
||||||
const unsigned char* areas, std::size_t areasSize, rcHeightfield& solid)
|
AreaType areaType, rcHeightfield& solid)
|
||||||
{
|
{
|
||||||
const osg::Vec2f tileBoundsMin(
|
const osg::Vec2f tileBoundsMin(
|
||||||
std::clamp(rectangle.mBounds.mMin.x(), config.bmin[0], config.bmax[0]),
|
std::clamp(rectangle.mBounds.mMin.x(), config.bmin[0], config.bmax[0]),
|
||||||
|
@ -224,13 +224,15 @@ namespace
|
||||||
0, 2, 3,
|
0, 2, 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const std::array<unsigned char, 2> areas {areaType, areaType};
|
||||||
|
|
||||||
return rcRasterizeTriangles(
|
return rcRasterizeTriangles(
|
||||||
&context,
|
&context,
|
||||||
vertices.data(),
|
vertices.data(),
|
||||||
static_cast<int>(vertices.size() / 3),
|
static_cast<int>(vertices.size() / 3),
|
||||||
indices.data(),
|
indices.data(),
|
||||||
areas,
|
areas.data(),
|
||||||
static_cast<int>(areasSize),
|
static_cast<int>(areas.size()),
|
||||||
solid,
|
solid,
|
||||||
config.walkableClimb
|
config.walkableClimb
|
||||||
);
|
);
|
||||||
|
@ -239,11 +241,10 @@ namespace
|
||||||
bool rasterizeTriangles(rcContext& context, const osg::Vec3f& agentHalfExtents, const std::vector<Cell>& cells,
|
bool rasterizeTriangles(rcContext& context, const osg::Vec3f& agentHalfExtents, const std::vector<Cell>& cells,
|
||||||
const Settings& settings, const rcConfig& config, rcHeightfield& solid)
|
const Settings& settings, const rcConfig& config, rcHeightfield& solid)
|
||||||
{
|
{
|
||||||
const std::array<unsigned char, 2> areas {{AreaType_water, AreaType_water}};
|
|
||||||
for (const Cell& cell : cells)
|
for (const Cell& cell : cells)
|
||||||
{
|
{
|
||||||
const Rectangle rectangle = getSwimRectangle(cell, settings, agentHalfExtents);
|
const Rectangle rectangle = getSwimRectangle(cell, settings, agentHalfExtents);
|
||||||
if (!rasterizeTriangles(context, rectangle, config, areas.data(), areas.size(), solid))
|
if (!rasterizeTriangles(context, rectangle, config, AreaType_water, solid))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -254,9 +255,8 @@ namespace
|
||||||
{
|
{
|
||||||
for (const FlatHeightfield& heightfield : heightfields)
|
for (const FlatHeightfield& heightfield : heightfields)
|
||||||
{
|
{
|
||||||
const std::array<unsigned char, 2> areas {{AreaType_ground, AreaType_ground}};
|
|
||||||
const Rectangle rectangle {heightfield.mBounds, toNavMeshCoordinates(settings, heightfield.mHeight)};
|
const Rectangle rectangle {heightfield.mBounds, toNavMeshCoordinates(settings, heightfield.mHeight)};
|
||||||
if (!rasterizeTriangles(context, rectangle, config, areas.data(), areas.size(), solid))
|
if (!rasterizeTriangles(context, rectangle, config, AreaType_ground, solid))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue