public static extern bool handleBuild(ref Config cfg, float[] verts, int nverts, int[] tris, int ntris);
public static void ShowRecastNavmesh(DbgRenderMesh renderMesh, PolyMeshAsset.PolyMeshData pmesh, Pathfinding.Config config) { renderMesh.Clear(); UnityEngine.Random.seed = c_RandomSeed; int npolys = pmesh.npolys; int nvp = pmesh.nvp; int[] tri = new int[3]; Vector3[] verts = new Vector3[3]; for (int i = 0; i < npolys; ++i) { int pIndex = i * nvp * 2; Color col = new Color(UnityEngine.Random.value, UnityEngine.Random.value, UnityEngine.Random.value); for (int j = 2; j < nvp; ++j) { if (pmesh.polys[pIndex + j] == RC_MESH_NULL_IDX) { break; } tri[0] = pmesh.polys[pIndex]; tri[1] = pmesh.polys[pIndex + j - 1]; tri[2] = pmesh.polys[pIndex + j]; for (int k = 0; k < 3; ++k) { int vIndex = tri[k] * 3; verts[k].x = config.bmin[0] + pmesh.verts[vIndex + 0] * pmesh.cs; verts[k].y = config.bmin[1] + (pmesh.verts[vIndex + 1] + 1) * pmesh.ch + 0.1f; verts[k].z = config.bmin[2] + pmesh.verts[vIndex + 2] * pmesh.cs; } col = VaryColor(col); renderMesh.AddTriangle(new DbgRenderTriangle(verts[0], verts[1], verts[2], col)); } } renderMesh.Rebuild(); }
public static extern bool createNavmesh(ref Config cfg, ref PolyMesh pmesh, ref PolyMeshDetail dmesh, ref IntPtr navData, ref int dataSize);