forked from mirror/DotRecast
reduced memory usage of DtLink.
This commit is contained in:
parent
c3208f7968
commit
886afd20cd
|
@ -27,12 +27,11 @@ namespace DotRecast.Detour
|
||||||
/// @see dtMeshTile
|
/// @see dtMeshTile
|
||||||
public class DtLink
|
public class DtLink
|
||||||
{
|
{
|
||||||
public readonly int index; // DtMeshTile.links array index
|
|
||||||
public long refs; //< Neighbour reference. (The neighbor that is linked to.)
|
public long refs; //< Neighbour reference. (The neighbor that is linked to.)
|
||||||
public int next; //< Index of the next link.
|
public int next; //< Index of the next link.
|
||||||
public int edge; //< Index of the polygon edge that owns this link.
|
public byte edge; //< Index of the polygon edge that owns this link.
|
||||||
public int side; //< If a boundary link, defines on which side the link is.
|
public byte side; //< If a boundary link, defines on which side the link is.
|
||||||
public int bmin; //< If a boundary link, defines the minimum sub-edge area.
|
public byte bmin; //< If a boundary link, defines the minimum sub-edge area.
|
||||||
public int bmax; //< If a boundary link, defines the maximum sub-edge area.
|
public byte bmax; //< If a boundary link, defines the maximum sub-edge area.
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -587,7 +587,7 @@ namespace DotRecast.Detour
|
||||||
int idx = AllocLink(tile);
|
int idx = AllocLink(tile);
|
||||||
DtLink link = tile.links[idx];
|
DtLink link = tile.links[idx];
|
||||||
link.refs = @base | (long)(poly.neis[j] - 1);
|
link.refs = @base | (long)(poly.neis[j] - 1);
|
||||||
link.edge = j;
|
link.edge = (byte)j;
|
||||||
link.side = 0xff;
|
link.side = 0xff;
|
||||||
link.bmin = link.bmax = 0;
|
link.bmin = link.bmax = 0;
|
||||||
// Add to linked list.
|
// Add to linked list.
|
||||||
|
@ -684,8 +684,8 @@ namespace DotRecast.Detour
|
||||||
{
|
{
|
||||||
DtLink link = tile.links[idx];
|
DtLink link = tile.links[idx];
|
||||||
link.refs = connectPoly.refs;
|
link.refs = connectPoly.refs;
|
||||||
link.edge = j;
|
link.edge = (byte)j;
|
||||||
link.side = dir;
|
link.side = (byte)dir;
|
||||||
|
|
||||||
link.next = poly.firstLink;
|
link.next = poly.firstLink;
|
||||||
poly.firstLink = idx;
|
poly.firstLink = idx;
|
||||||
|
@ -704,8 +704,8 @@ namespace DotRecast.Detour
|
||||||
tmax = temp;
|
tmax = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
link.bmin = (int)MathF.Round(Math.Clamp(tmin, 0.0f, 1.0f) * 255.0f);
|
link.bmin = (byte)MathF.Round(Math.Clamp(tmin, 0.0f, 1.0f) * 255.0f);
|
||||||
link.bmax = (int)MathF.Round(Math.Clamp(tmax, 0.0f, 1.0f) * 255.0f);
|
link.bmax = (byte)MathF.Round(Math.Clamp(tmax, 0.0f, 1.0f) * 255.0f);
|
||||||
}
|
}
|
||||||
else if (dir == 2 || dir == 6)
|
else if (dir == 2 || dir == 6)
|
||||||
{
|
{
|
||||||
|
@ -720,8 +720,8 @@ namespace DotRecast.Detour
|
||||||
tmax = temp;
|
tmax = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
link.bmin = (int)MathF.Round(Math.Clamp(tmin, 0.0f, 1.0f) * 255.0f);
|
link.bmin = (byte)MathF.Round(Math.Clamp(tmin, 0.0f, 1.0f) * 255.0f);
|
||||||
link.bmax = (int)MathF.Round(Math.Clamp(tmax, 0.0f, 1.0f) * 255.0f);
|
link.bmax = (byte)MathF.Round(Math.Clamp(tmax, 0.0f, 1.0f) * 255.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -790,7 +790,7 @@ namespace DotRecast.Detour
|
||||||
DtLink link = target.links[idx];
|
DtLink link = target.links[idx];
|
||||||
link.refs = refs;
|
link.refs = refs;
|
||||||
link.edge = 1;
|
link.edge = 1;
|
||||||
link.side = oppositeSide;
|
link.side = (byte)oppositeSide;
|
||||||
link.bmin = link.bmax = 0;
|
link.bmin = link.bmax = 0;
|
||||||
// Add to linked list.
|
// Add to linked list.
|
||||||
link.next = targetPoly.firstLink;
|
link.next = targetPoly.firstLink;
|
||||||
|
@ -805,7 +805,7 @@ namespace DotRecast.Detour
|
||||||
link = tile.links[tidx];
|
link = tile.links[tidx];
|
||||||
link.refs = GetPolyRefBase(target) | (long)targetCon.poly;
|
link.refs = GetPolyRefBase(target) | (long)targetCon.poly;
|
||||||
link.edge = 0xff;
|
link.edge = 0xff;
|
||||||
link.side = (side == -1 ? 0xff : side);
|
link.side = (byte)(side == -1 ? 0xff : side);
|
||||||
link.bmin = link.bmax = 0;
|
link.bmin = link.bmax = 0;
|
||||||
// Add to linked list.
|
// Add to linked list.
|
||||||
link.next = landPoly.firstLink;
|
link.next = landPoly.firstLink;
|
||||||
|
|
Loading…
Reference in New Issue