Recast: remove invert parameter from rdCalcEdgeNormal*

Extraneous parameter.
This commit is contained in:
Kawe Mazidjatari 2024-09-02 17:26:16 +02:00
parent 603878d413
commit 652d8f9da0
5 changed files with 12 additions and 23 deletions

View File

@ -579,10 +579,10 @@ static bool traverseLinkOffsetIntersectsGeom(const InputGeom* geom, const float*
static bool traverseLinkInLOS(const InputGeom* geom, const float* lowPos, const float* highPos, const float* lowDir, const float* highDir, const float offsetAmount)
{
float lowNormal[3];
rdCalcEdgeNormal2D(lowDir, false, lowNormal);
rdCalcEdgeNormal2D(lowDir, lowNormal);
float highNormal[3];
rdCalcEdgeNormal2D(highDir, false, highNormal);
rdCalcEdgeNormal2D(highDir, highNormal);
// Detect overhangs to avoid links like these:
//

View File

@ -175,7 +175,7 @@ static void drawPolyBoundaries(duDebugDraw* dd, const dtMeshTile* tile,
if (!inner && flags & DU_DRAWNAVMESH_LEDGE_SPANS)
{
float normal[3];
rdCalcEdgeNormalPt2D(v0, v1, false, normal);
rdCalcEdgeNormalPt2D(v0, v1, normal);
float mid[3];
rdVsad(mid, v0, v1, 0.5f);

View File

@ -2381,7 +2381,7 @@ dtStatus dtNavMeshQuery::getEdgeNormal(dtPolyRef from, dtPolyRef to, float* norm
return DT_FAILURE | DT_INVALID_PARAM;
float dir[3];
rdVsub(dir, right,left);
rdCalcEdgeNormal2D(dir, false, norm);
rdCalcEdgeNormal2D(dir, norm);
return DT_SUCCESS;
}
@ -2394,7 +2394,7 @@ dtStatus dtNavMeshQuery::getEdgeNormal(dtPolyRef from, const dtPoly* fromPoly, c
return DT_FAILURE | DT_INVALID_PARAM;
float dir[3];
rdVsub(dir, right,left);
rdCalcEdgeNormal2D(dir, false, norm);
rdCalcEdgeNormal2D(dir, norm);
return DT_SUCCESS;
}

View File

@ -479,16 +479,14 @@ float rdDistancePtLine2D(const float* pt, const float* p, const float* q);
/// Derives the normal of an edge
/// @param[in] dir The direction of the edge. [(x, y, z)]
/// @param[in] invert Whether to invert the results.
/// @param[out] out The resulting normal. [(x, y)]
void rdCalcEdgeNormal2D(const float* dir, const bool inner, float* out);
void rdCalcEdgeNormal2D(const float* dir, float* out);
/// Derives the normal of an edge
/// @param[in] v1 First vert of the polygon edge. [(x, y, z)]
/// @param[in] v2 Second vert of the polygon edge. [(x, y, z)]
/// @param[in] invert Whether to invert the results.
/// @param[out] out The resulting normal. [(x, y)]
void rdCalcEdgeNormalPt2D(const float* v1, const float* v2, const bool inner, float* out);
void rdCalcEdgeNormalPt2D(const float* v1, const float* v2, float* out);
/// @param[in] edgeStart First vert of the polygon edge. [(x, y, z)]
/// @param[in] edgeEnd Second vert of the polygon edge. [(x, y, z)]

View File

@ -409,27 +409,18 @@ float rdDistancePtLine2D(const float* pt, const float* p, const float* q)
return dx * dx + dy * dy;
}
void rdCalcEdgeNormal2D(const float* dir, const bool invert, float* out)
void rdCalcEdgeNormal2D(const float* dir, float* out)
{
if (invert)
{
out[0] = -dir[1];
out[1] = dir[0];
}
else
{
out[0] = dir[1];
out[1] = -dir[0];
}
out[0] = dir[1];
out[1] = -dir[0];
rdVnormalize2D(out);
}
void rdCalcEdgeNormalPt2D(const float* v1, const float* v2, const bool invert, float* out)
void rdCalcEdgeNormalPt2D(const float* v1, const float* v2, float* out)
{
float dir[3];
rdVsub(dir, v2, v1);
rdCalcEdgeNormal2D(dir, invert, out);
rdCalcEdgeNormal2D(dir, out);
}
bool rdCalcSubEdgeArea2D(const float* edgeStart, const float* edgeEnd, const float* subEdgeStart,