copy -> operator=

This commit is contained in:
ikpil 2023-04-29 19:32:20 +09:00
parent 5592f82192
commit 67cbf7ffd1
9 changed files with 19 additions and 43 deletions

View File

@ -426,7 +426,7 @@ public class CrowdProfilingTool
public AgentData(AgentType type, Vector3f home)
{
this.type = type;
RecastVectors.copy(ref this.home, home);
this.home = home;
}
}

View File

@ -52,8 +52,8 @@ namespace DotRecast.Recast
this.tileX = tileX;
this.tileZ = tileZ;
this.cfg = cfg;
copy(ref this.bmin, bmin);
copy(ref this.bmax, bmax);
this.bmin = bmin;
this.bmax = bmax;
if (cfg.useTiles)
{
float tsx = cfg.tileSizeX * cfg.cs;

View File

@ -56,8 +56,8 @@ namespace DotRecast.Recast
chf.walkableHeight = walkableHeight;
chf.walkableClimb = walkableClimb;
chf.maxRegions = 0;
copy(ref chf.bmin, hf.bmin);
copy(ref chf.bmax, hf.bmax);
chf.bmin = hf.bmin;
chf.bmax = hf.bmax;
chf.bmax.y += walkableHeight * hf.ch;
chf.cs = hf.cs;
chf.ch = hf.ch;

View File

@ -780,8 +780,8 @@ namespace DotRecast.Recast
ContourSet cset = new ContourSet();
ctx.startTimer("CONTOURS");
RecastVectors.copy(ref cset.bmin, chf.bmin, 0);
RecastVectors.copy(ref cset.bmax, chf.bmax, 0);
cset.bmin = chf.bmin;
cset.bmax = chf.bmax;
if (borderSize > 0)
{
// If the heightfield was build with bordersize, remove the offset.

View File

@ -428,10 +428,8 @@ namespace DotRecast.Recast
int lh = h - borderSize * 2;
// Build contracted bbox for layers.
Vector3f bmin = new Vector3f();
Vector3f bmax = new Vector3f();
copy(ref bmin, chf.bmin);
copy(ref bmax, chf.bmax);
Vector3f bmin = chf.bmin;
Vector3f bmax = chf.bmax;
bmin.x += borderSize * chf.cs;
bmin.z += borderSize * chf.cs;
bmax.x -= borderSize * chf.cs;
@ -475,8 +473,8 @@ namespace DotRecast.Recast
layer.ch = chf.ch;
// Adjust the bbox to fit the heightfield.
copy(ref layer.bmin, bmin);
copy(ref layer.bmax, bmax);
layer.bmin = bmin;
layer.bmax = bmax;
layer.bmin.y = bmin.y + hmin * chf.ch;
layer.bmax.y = bmin.y + hmax * chf.ch;
layer.hmin = hmin;

View File

@ -976,8 +976,8 @@ namespace DotRecast.Recast
{
ctx.startTimer("POLYMESH");
PolyMesh mesh = new PolyMesh();
RecastVectors.copy(ref mesh.bmin, cset.bmin, 0);
RecastVectors.copy(ref mesh.bmax, cset.bmax, 0);
mesh.bmin = cset.bmin;
mesh.bmax = cset.bmax;
mesh.cs = cset.cs;
mesh.ch = cset.ch;
mesh.borderSize = cset.borderSize;
@ -1231,8 +1231,8 @@ namespace DotRecast.Recast
mesh.nvp = meshes[0].nvp;
mesh.cs = meshes[0].cs;
mesh.ch = meshes[0].ch;
RecastVectors.copy(ref mesh.bmin, meshes[0].bmin, 0);
RecastVectors.copy(ref mesh.bmax, meshes[0].bmax, 0);
mesh.bmin = meshes[0].bmin;
mesh.bmax = meshes[0].bmax;
int maxVerts = 0;
int maxPolys = 0;
@ -1361,8 +1361,8 @@ namespace DotRecast.Recast
dst.npolys = src.npolys;
dst.maxpolys = src.npolys;
dst.nvp = src.nvp;
RecastVectors.copy(ref dst.bmin, src.bmin, 0);
RecastVectors.copy(ref dst.bmax, src.bmax, 0);
dst.bmin = src.bmin;
dst.bmax = src.bmax;
dst.cs = src.cs;
dst.ch = src.ch;
dst.borderSize = src.borderSize;

View File

@ -58,18 +58,6 @@ namespace DotRecast.Recast
copy(ref @out, 0, @in, i);
}
public static void copy(ref Vector3f @out, Vector3f @in, int i)
{
copy(ref @out, 0, @in, i);
}
public static void copy(ref Vector3f @out, Vector3f @in)
{
@out = @in;
}
public static void copy(float[] @out, int n, float[] @in, int m)
{
@out[n] = @in[m];
@ -84,8 +72,6 @@ namespace DotRecast.Recast
@out[n + 2] = @in[m + 2];
}
public static void copy(ref Vector3f @out, int n, float[] @in, int m)
{
@out[n] = @in[m];
@ -93,14 +79,6 @@ namespace DotRecast.Recast
@out[n + 2] = @in[m + 2];
}
public static void copy(ref Vector3f @out, int n, Vector3f @in, int m)
{
@out[n] = @in[m];
@out[n + 1] = @in[m + 1];
@out[n + 2] = @in[m + 2];
}
public static void add(ref Vector3f e0, Vector3f a, float[] verts, int i)
{
e0.x = a.x + verts[i];

View File

@ -59,7 +59,7 @@ public class TestTiledNavMeshBuilder
{
// Create empty nav mesh
NavMeshParams navMeshParams = new NavMeshParams();
copy(ref navMeshParams.orig, m_geom.getMeshBoundsMin());
navMeshParams.orig = m_geom.getMeshBoundsMin();
navMeshParams.tileWidth = m_tileSize * m_cellSize;
navMeshParams.tileHeight = m_tileSize * m_cellSize;
navMeshParams.maxTiles = 128;

View File

@ -66,7 +66,7 @@ public class AbstractTileCacheTest
option.maxTiles = twh[0] * twh[1] * EXPECTED_LAYERS_PER_TILE;
option.maxObstacles = 128;
NavMeshParams navMeshParams = new NavMeshParams();
copy(ref navMeshParams.orig, geom.getMeshBoundsMin());
navMeshParams.orig = geom.getMeshBoundsMin();
navMeshParams.tileWidth = m_tileSize * m_cellSize;
navMeshParams.tileHeight = m_tileSize * m_cellSize;
navMeshParams.maxTiles = 256;