forked from mirror/DotRecast
Changed vertCount and triCount to byte in DtPolyDetail
This commit is contained in:
parent
ba6815769a
commit
a282a80356
|
@ -20,6 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
- Changed to consolidate vector-related functions into one place.
|
- Changed to consolidate vector-related functions into one place.
|
||||||
- Changed stack handling from List to a fixed-size array with manual index management for optimization in `RcLayers.BuildHeightfieldLayers()`
|
- Changed stack handling from List to a fixed-size array with manual index management for optimization in `RcLayers.BuildHeightfieldLayers()`
|
||||||
- Changed to use Span<byte> and stackalloc for improved performance and memory management in `RcLayers.BuildHeightfieldLayers()`
|
- Changed to use Span<byte> and stackalloc for improved performance and memory management in `RcLayers.BuildHeightfieldLayers()`
|
||||||
|
- Changed vertCount and triCount to byte in `DtPolyDetail`
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
- Removed RcMeshDetails.VdistSq2(float[], float[])
|
- Removed RcMeshDetails.VdistSq2(float[], float[])
|
||||||
|
|
|
@ -101,9 +101,9 @@ namespace DotRecast.Detour.Extras.Unity.Astar
|
||||||
ymax = Math.Max(ymax, verts[nodes[i].verts[1] * 3 + 1]);
|
ymax = Math.Max(ymax, verts[nodes[i].verts[1] * 3 + 1]);
|
||||||
ymax = Math.Max(ymax, verts[nodes[i].verts[2] * 3 + 1]);
|
ymax = Math.Max(ymax, verts[nodes[i].verts[2] * 3 + 1]);
|
||||||
int vertBase = 0;
|
int vertBase = 0;
|
||||||
int vertCount = 0;
|
byte vertCount = 0;
|
||||||
int triBase = i;
|
int triBase = i;
|
||||||
int triCount = 1;
|
byte triCount = 1;
|
||||||
detailNodes[i] = new DtPolyDetail(vertBase, triBase, vertCount, triCount);
|
detailNodes[i] = new DtPolyDetail(vertBase, triBase, vertCount, triCount);
|
||||||
detailTris[4 * i] = 0;
|
detailTris[4 * i] = 0;
|
||||||
detailTris[4 * i + 1] = 1;
|
detailTris[4 * i + 1] = 1;
|
||||||
|
|
|
@ -556,9 +556,9 @@ namespace DotRecast.Detour
|
||||||
int ndv = option.detailMeshes[i * 4 + 1];
|
int ndv = option.detailMeshes[i * 4 + 1];
|
||||||
int nv = navPolys[i].vertCount;
|
int nv = navPolys[i].vertCount;
|
||||||
int vertBase = vbase;
|
int vertBase = vbase;
|
||||||
int vertCount = (ndv - nv);
|
byte vertCount = (byte)(ndv - nv);
|
||||||
int triBase = option.detailMeshes[i * 4 + 2];
|
int triBase = option.detailMeshes[i * 4 + 2];
|
||||||
int triCount = option.detailMeshes[i * 4 + 3];
|
byte triCount = (byte)option.detailMeshes[i * 4 + 3];
|
||||||
navDMeshes[i] = new DtPolyDetail(vertBase, triBase, vertCount, triCount);
|
navDMeshes[i] = new DtPolyDetail(vertBase, triBase, vertCount, triCount);
|
||||||
// Copy vertices except the first 'nv' verts which are equal to
|
// Copy vertices except the first 'nv' verts which are equal to
|
||||||
// nav poly verts.
|
// nav poly verts.
|
||||||
|
@ -580,9 +580,9 @@ namespace DotRecast.Detour
|
||||||
{
|
{
|
||||||
int nv = navPolys[i].vertCount;
|
int nv = navPolys[i].vertCount;
|
||||||
int vertBase = 0;
|
int vertBase = 0;
|
||||||
int vertCount = 0;
|
byte vertCount = 0;
|
||||||
int triBase = tbase;
|
int triBase = tbase;
|
||||||
int triCount = (nv - 2);
|
byte triCount = (byte)(nv - 2);
|
||||||
navDMeshes[i] = new DtPolyDetail(vertBase, triBase, vertCount, triCount);
|
navDMeshes[i] = new DtPolyDetail(vertBase, triBase, vertCount, triCount);
|
||||||
// Triangulate polygon (local indices).
|
// Triangulate polygon (local indices).
|
||||||
for (int j = 2; j < nv; ++j)
|
for (int j = 2; j < nv; ++j)
|
||||||
|
|
|
@ -25,10 +25,10 @@ namespace DotRecast.Detour
|
||||||
{
|
{
|
||||||
public readonly int vertBase; //< The offset of the vertices in the dtMeshTile::detailVerts array.
|
public readonly int vertBase; //< The offset of the vertices in the dtMeshTile::detailVerts array.
|
||||||
public readonly int triBase; //< The offset of the triangles in the dtMeshTile::detailTris array.
|
public readonly int triBase; //< The offset of the triangles in the dtMeshTile::detailTris array.
|
||||||
public readonly int vertCount; //< The number of vertices in the sub-mesh.
|
public readonly byte vertCount; //< The number of vertices in the sub-mesh.
|
||||||
public readonly int triCount; //< The number of triangles in the sub-mesh.
|
public readonly byte triCount; //< The number of triangles in the sub-mesh.
|
||||||
|
|
||||||
public DtPolyDetail(int vertBase, int triBase, int vertCount, int triCount)
|
public DtPolyDetail(int vertBase, int triBase, byte vertCount, byte triCount)
|
||||||
{
|
{
|
||||||
this.vertBase = vertBase;
|
this.vertBase = vertBase;
|
||||||
this.triBase = triBase;
|
this.triBase = triBase;
|
||||||
|
|
|
@ -173,8 +173,8 @@ namespace DotRecast.Detour.Io
|
||||||
{
|
{
|
||||||
int vertBase = buf.GetInt();
|
int vertBase = buf.GetInt();
|
||||||
int triBase = buf.GetInt();
|
int triBase = buf.GetInt();
|
||||||
int vertCount = buf.Get() & 0xFF;
|
byte vertCount = (byte)(buf.Get() & 0xFF);
|
||||||
int triCount = buf.Get() & 0xFF;
|
byte triCount = (byte)(buf.Get() & 0xFF);
|
||||||
polys[i] = new DtPolyDetail(vertBase, triBase, vertCount, triCount);
|
polys[i] = new DtPolyDetail(vertBase, triBase, vertCount, triCount);
|
||||||
if (cCompatibility)
|
if (cCompatibility)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue