mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Recast: delay sub-edge area calculation
Optimization by only calulcating it when its used to avoid calculating it for nothing when we end up moving to the next edge. This is only used when the link is established.
This commit is contained in:
parent
427860e6e9
commit
0806b10f79
@ -858,16 +858,6 @@ dtStatus dtNavMesh::connectTraverseLinks(const dtTileRef tileRef, const dtTraver
|
||||
rdDistancePtLine2D(baseTriVerts[l], basePolySpos, basePolyEpos) >= detailEdgeAlignThresh)
|
||||
continue;
|
||||
|
||||
const float* baseDetailPolyEdgeSpos = baseTriVerts[m];
|
||||
const float* baseDetailPolyEdgeEpos = baseTriVerts[l];
|
||||
|
||||
float baseTmin;
|
||||
float baseTmax;
|
||||
rdCalcSubEdgeArea2D(basePolySpos, basePolyEpos, baseDetailPolyEdgeSpos, baseDetailPolyEdgeEpos, baseTmin, baseTmax);
|
||||
|
||||
float basePolyEdgeMid[3];
|
||||
rdVsad(basePolyEdgeMid, baseDetailPolyEdgeSpos, baseDetailPolyEdgeEpos, 0.5f);
|
||||
|
||||
const int MAX_NEIS = 32; // Max neighbors
|
||||
dtMeshTile* neis[MAX_NEIS];
|
||||
|
||||
@ -899,12 +889,22 @@ dtStatus dtNavMesh::connectTraverseLinks(const dtTileRef tileRef, const dtTraver
|
||||
neis[0] = baseTile;
|
||||
}
|
||||
|
||||
const float* baseDetailPolyEdgeSpos = baseTriVerts[m];
|
||||
const float* baseDetailPolyEdgeEpos = baseTriVerts[l];
|
||||
|
||||
float basePolyEdgeMid[3];
|
||||
rdVsad(basePolyEdgeMid, baseDetailPolyEdgeSpos, baseDetailPolyEdgeEpos, 0.5f);
|
||||
|
||||
float baseEdgeDir[3];
|
||||
rdVsub(baseEdgeDir, baseDetailPolyEdgeEpos, baseDetailPolyEdgeSpos);
|
||||
|
||||
float baseEdgeNorm[3];
|
||||
rdCalcEdgeNormal2D(baseEdgeDir, baseEdgeNorm);
|
||||
|
||||
float baseTmin;
|
||||
float baseTmax;
|
||||
rdCalcSubEdgeArea2D(basePolySpos, basePolyEpos, baseDetailPolyEdgeSpos, baseDetailPolyEdgeEpos, baseTmin, baseTmax);
|
||||
|
||||
for (int n = nneis - 1; n >= 0; --n)
|
||||
{
|
||||
dtMeshTile* landTile = neis[n];
|
||||
@ -999,10 +999,6 @@ dtStatus dtNavMesh::connectTraverseLinks(const dtTileRef tileRef, const dtTraver
|
||||
const float* landDetailPolyEdgeSpos = landTriVerts[s];
|
||||
const float* landDetailPolyEdgeEpos = landTriVerts[r];
|
||||
|
||||
float landTmin;
|
||||
float landTmax;
|
||||
rdCalcSubEdgeArea2D(landPolySpos, landPolyEpos, landDetailPolyEdgeSpos, landDetailPolyEdgeEpos, landTmin, landTmax);
|
||||
|
||||
float landPolyEdgeMid[3];
|
||||
rdVsad(landPolyEdgeMid, landDetailPolyEdgeSpos, landDetailPolyEdgeEpos, 0.5f);
|
||||
|
||||
@ -1054,14 +1050,18 @@ dtStatus dtNavMesh::connectTraverseLinks(const dtTileRef tileRef, const dtTraver
|
||||
: rdClassifyPointInsideBounds(landPolyEdgeMid, landHeader->bmin, landHeader->bmax);
|
||||
const unsigned char baseSide = rdOppositeTile(landSide);
|
||||
|
||||
float newBaseTmin;
|
||||
float newBaseTmax;
|
||||
alignPortalLimits(basePolyEdgeMid, baseEdgeNorm, landPolyEdgeMid, baseTmin, baseTmax, newBaseTmin, newBaseTmax, params.maxPortalAlign);
|
||||
float landTmin;
|
||||
float landTmax;
|
||||
rdCalcSubEdgeArea2D(landPolySpos, landPolyEpos, landDetailPolyEdgeSpos, landDetailPolyEdgeEpos, landTmin, landTmax);
|
||||
|
||||
float newLandTmin;
|
||||
float newLandTmax;
|
||||
alignPortalLimits(landPolyEdgeMid, landEdgeNorm, basePolyEdgeMid, landTmin, landTmax, newLandTmin, newLandTmax, params.maxPortalAlign);
|
||||
|
||||
float newBaseTmin;
|
||||
float newBaseTmax;
|
||||
alignPortalLimits(basePolyEdgeMid, baseEdgeNorm, landPolyEdgeMid, baseTmin, baseTmax, newBaseTmin, newBaseTmax, params.maxPortalAlign);
|
||||
|
||||
const unsigned int forwardIdx = baseTile->allocLink();
|
||||
const unsigned int reverseIdx = landTile->allocLink();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user