public PathGraph(string continent, ChunkedTriangleCollection triangles, TriangleCollection paint) { this.Continent = continent; this.triangleWorld = triangles; this.paint = paint; Clear(); }
private void GetChunkData(TriangleCollection triangles, int chunk_x, int chunk_y, SparseMatrix3D<WMO> instances) { if (chunk_x < 0) return; if (chunk_y < 0) return; if (chunk_x > 63) return; if (chunk_y > 63) return; if (triangles == null) return; if (wdtf == null) return; if (wdt == null) return; wdtf.LoadMapTile(chunk_x, chunk_y); MapTile t = wdt.maptiles[chunk_x, chunk_y]; if (t != null) { //Console.Write(" render"); // Map tiles for (int ci = 0; ci < 16; ci++) { for (int cj = 0; cj < 16; cj++) { MapChunk c = t.chunks[ci, cj]; if (c != null) AddTriangles(triangles, c); } } // World objects foreach (WMOInstance wi in t.wmois) { if (wi != null && wi.wmo != null) { String fn = wi.wmo.fileName; int last = fn.LastIndexOf('\\'); fn = fn.Substring(last + 1); // Console.WriteLine(" wmo: " + fn + " at " + wi.pos); if (fn != null) { WMO old = instances.Get((int)wi.pos.x, (int)wi.pos.y, (int)wi.pos.z); if (old == wi.wmo) { //Console.WriteLine("Already got " + fn); } else { instances.Set((int)wi.pos.x, (int)wi.pos.y, (int)wi.pos.z, wi.wmo); AddTriangles(triangles, wi); } } } } foreach (ModelInstance mi in t.modelis) { if (mi != null && mi.model != null) { String fn = mi.model.fileName; int last = fn.LastIndexOf('\\'); // fn = fn.Substring(last + 1); //Console.WriteLine(" wmi: " + fn + " at " + mi.pos); AddTriangles(triangles, mi); //Console.WriteLine(" model: " + fn); } } Console.WriteLine("wee"); /*Console.WriteLine( String.Format(" Triangles - Map: {0,6} Objects: {1,6} Models: {2,6}", map_triangles.GetNumberOfTriangles(), obj_triangles.GetNumberOfTriangles(), model_triangles.GetNumberOfTriangles())); */ } Console.WriteLine(" done"); wdt.maptiles[chunk_x, chunk_y] = null; // clear it atain //myChunk.triangles.ClearVertexMatrix(); // not needed anymore //return myChunk; }
void AddTrianglesGroupDoodads(TriangleCollection s, ModelInstance mi, Vec3D world_dir, Vec3D world_off, float rot) { float dx = mi.pos.x; float dy = mi.pos.y; float dz = mi.pos.z; rotate(dx, dz, rot + 90f, out dx, out dz); dx += world_off.x; dy += world_off.y; dz += world_off.z; Quaternion q; q.x = mi.dir.z; q.y = mi.dir.x; q.z = mi.dir.y; q.w = mi.w; Matrix4 rotMatrix = new Matrix4(); rotMatrix.makeQuaternionRotate(q); Model m = mi.model; if (m.boundingTriangles == null) { } else { // We got boiuding stuff, that is better int nBoundingVertices = m.boundingVertices.Length / 3; int[] vertices = new int[nBoundingVertices]; for (uint i = 0; i < nBoundingVertices; i++) { uint off = i * 3; float x = m.boundingVertices[off]; float y = m.boundingVertices[off + 2]; float z = m.boundingVertices[off + 1]; x *= mi.sc; y *= mi.sc; z *= -mi.sc; Vector pos; pos.x = x; pos.y = y; pos.z = z; Vector new_pos = rotMatrix.mutiply(pos); x = pos.x; y = pos.y; z = pos.z; float dir_x = world_dir.z; float dir_y = world_dir.y - 90; float dir_z = -world_dir.x; rotate(z, y, dir_x, out z, out y); rotate(x, y, dir_z, out x, out y); rotate(x, z, dir_y, out x, out z); float xx = x + dx; float yy = y + dy; float zz = -z + dz; float finalx = ChunkReader.ZEROPOINT - zz; float finaly = ChunkReader.ZEROPOINT - xx; float finalz = yy; vertices[i] = s.AddVertex(finalx, finaly, finalz); } int nBoundingTriangles = m.boundingTriangles.Length / 3; for (uint i = 0; i < nBoundingTriangles; i++) { uint off = i * 3; int v0 = vertices[m.boundingTriangles[off]]; int v1 = vertices[m.boundingTriangles[off + 1]]; int v2 = vertices[m.boundingTriangles[off + 2]]; s.AddTriangle(v0, v2, v1, ChunkedTriangleCollection.TriangleFlagModel); } } }
void AddTriangles(TriangleCollection s, ModelInstance mi) { float dx = mi.pos.x; float dy = mi.pos.y; float dz = mi.pos.z; float dir_x = mi.dir.z; float dir_y = mi.dir.y - 90; float dir_z = -mi.dir.x; Model m = mi.model; if (m == null) return; if (m.boundingTriangles == null) { // /cry no bouding info, revert to normal vertives /* ModelView mv = m.view[0]; // View number 1 ?!?! if (mv == null) return; int[] vertices = new int[m.vertices.Length / 3]; for (uint i = 0; i < m.vertices.Length / 3; i++) { float x = m.vertices[i * 3]; float y = m.vertices[i * 3 + 2]; float z = m.vertices[i * 3 + 1]; x *= mi.sc; y *= mi.sc; z *= mi.sc; rotate(y, z, dir_x, out y, out z); rotate(x, y, dir_z, out x, out y); rotate(x, z, dir_y, out x, out z); float xx = x + dx; float yy = y + dy; float zz = -z + dz; float finalx = ChunkReader.ZEROPOINT - zz; float finaly = ChunkReader.ZEROPOINT - xx; float finalz = yy; vertices[i] = s.AddVertex(finalx, finaly, finalz); } for (int i = 0; i < mv.triangleList.Length / 3; i++) { int off = i * 3; UInt16 vi0 = mv.triangleList[off]; UInt16 vi1 = mv.triangleList[off + 1]; UInt16 vi2 = mv.triangleList[off + 2]; int ind0 = mv.indexList[vi0]; int ind1 = mv.indexList[vi1]; int ind2 = mv.indexList[vi2]; int v0 = vertices[ind0]; int v1 = vertices[ind1]; int v2 = vertices[ind2]; s.AddTriangle(v0, v1, v2, ChunkedTriangleCollection.TriangleFlagModel); } */ } else { // We got boiuding stuff, that is better int nBoundingVertices = m.boundingVertices.Length / 3; int[] vertices = new int[nBoundingVertices]; for (uint i = 0; i < nBoundingVertices; i++) { uint off = i * 3; float x = m.boundingVertices[off]; float y = m.boundingVertices[off + 2]; float z = m.boundingVertices[off + 1]; rotate(z, y, dir_x, out z, out y); rotate(x, y, dir_z, out x, out y); rotate(x, z, dir_y, out x, out z); x *= mi.sc; y *= mi.sc; z *= mi.sc; float xx = x + dx; float yy = y + dy; float zz = -z + dz; float finalx = ChunkReader.ZEROPOINT - zz; float finaly = ChunkReader.ZEROPOINT - xx; float finalz = yy; vertices[i] = s.AddVertex(finalx, finaly, finalz); } int nBoundingTriangles = m.boundingTriangles.Length / 3; for (uint i = 0; i < nBoundingTriangles; i++) { uint off = i * 3; int v0 = vertices[m.boundingTriangles[off]]; int v1 = vertices[m.boundingTriangles[off + 1]]; int v2 = vertices[m.boundingTriangles[off + 2]]; s.AddTriangle(v0, v1, v2, ChunkedTriangleCollection.TriangleFlagModel); } } }
void AddTriangles(TriangleCollection s, WMOInstance wi) { float dx = wi.pos.x; float dy = wi.pos.y; float dz = wi.pos.z; float dir_x = wi.dir.z; float dir_y = wi.dir.y - 90; float dir_z = -wi.dir.x; Console.WriteLine("modeli: " + dir_x + " " + dir_y + " " + dir_z); WMO wmo = wi.wmo; foreach (WMOGroup g in wmo.groups) { int[] vertices = new int[g.nVertices]; for (int i = 0; i < g.nVertices; i++) { int off = i * 3; float x = g.vertices[off]; float y = g.vertices[off + 2]; float z = g.vertices[off + 1]; rotate(z, y, dir_x, out z, out y); rotate(x, y, dir_z, out x, out y); rotate(x, z, dir_y, out x, out z); float xx = x + dx; float yy = y + dy; float zz = -z + dz; float finalx = ChunkReader.ZEROPOINT - zz; float finaly = ChunkReader.ZEROPOINT - xx; float finalz = yy; vertices[i] = s.AddVertex(finalx, finaly, finalz); } // Console.WriteLine("nTriangles: " + g.nTriangles); for (int i = 0; i < g.nTriangles; i++) { //if ((g.materials[i] & 0x1000) != 0) { int off = i * 3; int i0 = vertices[g.triangles[off]]; int i1 = vertices[g.triangles[off + 1]]; int i2 = vertices[g.triangles[off + 2]]; int t = s.AddTriangle(i0, i1, i2, ChunkedTriangleCollection.TriangleFlagObject); //if(t != -1) s.SetTriangleExtra(t, g.materials[0], 0, 0); } } } int doodadset = wi.doodadset; if (doodadset < wmo.nDoodadSets) { uint firstDoodad = wmo.doodads[doodadset].firstInstance; uint nDoodads = wmo.doodads[doodadset].nInstances; for (uint i = 0; i < nDoodads; i++) { uint d = firstDoodad + i; ModelInstance mi = wmo.doodadInstances[d]; if (mi != null) { //Console.WriteLine("I got model " + mi.model.fileName + " at " + mi.pos); //AddTrianglesGroupDoodads(s, mi, wi.dir, wi.pos, 0.0f); // DOes not work :( } } } }
void AddTriangles(TriangleCollection s, MapChunk c) { int[,] vertices = new int[9, 9]; int[,] verticesMid = new int[8, 8]; for (int row = 0; row < 9; row++) for (int col = 0; col < 9; col++) { float x, y, z; ChunkGetCoordForPoint(c, row, col, out x, out y, out z); int index = s.AddVertex(x, y, z); vertices[row, col] = index; } for (int row = 0; row < 8; row++) for (int col = 0; col < 8; col++) { float x, y, z; ChunkGetCoordForMiddlePoint(c, row, col, out x, out y, out z); int index = s.AddVertex(x, y, z); verticesMid[row, col] = index; } for (int row = 0; row < 8; row++) { for (int col = 0; col < 8; col++) { if (!c.isHole(col, row)) { int v0 = vertices[row, col]; int v1 = vertices[row + 1, col]; int v2 = vertices[row + 1, col + 1]; int v3 = vertices[row, col + 1]; int vMid = verticesMid[row, col]; s.AddTriangle(v0, v1, vMid); s.AddTriangle(v1, v2, vMid); s.AddTriangle(v2, v3, vMid); s.AddTriangle(v3, v0, vMid); } } } if (c.haswater) { // paint the water for (int row = 0; row < 9; row++) for (int col = 0; col < 9; col++) { float x, y, z; ChunkGetCoordForPoint(c, row, col, out x, out y, out z); float height = c.water_height[row, col] - 1.5f; int index = s.AddVertex(x, y, height); vertices[row, col] = index; } for (int row = 0; row < 8; row++) { for (int col = 0; col < 8; col++) { if (c.water_flags[row, col] != 0xf) { int v0 = vertices[row, col]; int v1 = vertices[row + 1, col]; int v2 = vertices[row + 1, col + 1]; int v3 = vertices[row, col + 1]; s.AddTriangle(v0, v1, v3, ChunkedTriangleCollection.TriangleFlagDeepWater); s.AddTriangle(v1, v2, v3, ChunkedTriangleCollection.TriangleFlagDeepWater); } } } } }
public override void GetTriangles(TriangleCollection to, float min_x, float min_y, float max_x, float max_y) { //Console.WriteLine("TotalMemory " + System.GC.GetTotalMemory(false)/(1024*1024) + " MB"); foreach (WMOInstance wi in wdt.gwmois) { AddTriangles(to, wi); } SparseMatrix3D<WMO> instances = new SparseMatrix3D<WMO>(); for (float x = min_x; x < max_x; x += ChunkReader.TILESIZE) { for (float y = min_y; y < max_y; y += ChunkReader.TILESIZE) { int chunk_x, chunk_y; GetChunkCoord(x, y, out chunk_x, out chunk_y); /*ChunkData d = */ GetChunkData(to, chunk_x, chunk_y, instances); //to.AddAllTrianglesFrom(d.triangles); } } }
private void GetChunkData(TriangleCollection triangles, int chunk_x, int chunk_y, SparseMatrix3D<WMO> instances) { if (chunk_x < 0) return; if (chunk_y < 0) return; if (chunk_x > 63) return; if (chunk_y > 63) return; /* if (chunkCache[chunk_x, chunk_y] != null) { chunkCache[chunk_x, chunk_y].LRU = NOW++; return chunkCache[chunk_x, chunk_y]; } else { EvictFromChunkCache(); } float max_x = ChunkReader.ZEROPOINT - (float)(chunk_y) * ChunkReader.TILESIZE; float max_y = ChunkReader.ZEROPOINT - (float)(chunk_x) * ChunkReader.TILESIZE; float min_x = max_x - ChunkReader.TILESIZE; float min_y = max_y - ChunkReader.TILESIZE; ChunkData myChunk = new ChunkData(); myChunk.LRU = NOW++; chunkCache[chunk_x, chunk_y] = myChunk; chunkCacheItems++; TriangleCollection triangles = new TriangleCollection(); myChunk.triangles = triangles; triangles.SetLimits(min_x, min_y, -1E30f, max_x, max_y, 1E30f); */ //Console.WriteLine("x " + max_x + " y " + max_y); // Console.Write(String.Format(" Tile {0,2} {1,2}", chunk_x, chunk_y)); // Console.Write(" load"); if (triangles == null) return; if (wdtf == null) return; if (wdt == null) return; wdtf.LoadMapTile(chunk_x, chunk_y); MapTile t = wdt.maptiles[chunk_x, chunk_y]; if (t != null) { //Console.Write(" render"); // Map tiles for (int ci = 0; ci < 16; ci++) { for (int cj = 0; cj < 16; cj++) { MapChunk c = t.chunks[ci, cj]; if(c != null) AddTriangles(triangles, c); } } // World objects foreach (WMOInstance wi in t.wmois) { if (wi != null && wi.wmo != null) { String fn = wi.wmo.fileName; int last = fn.LastIndexOf('\\'); fn = fn.Substring(last + 1); // Console.WriteLine(" wmo: " + fn + " at " + wi.pos); if(fn != null) { WMO old = instances.Get((int)wi.pos.x, (int)wi.pos.y, (int)wi.pos.z); if (old == wi.wmo) { //Console.WriteLine("Already got " + fn); } else { instances.Set((int)wi.pos.x, (int)wi.pos.y, (int)wi.pos.z, wi.wmo); AddTriangles(triangles, wi); } } } } foreach (ModelInstance mi in t.modelis) { if (mi != null && mi.model != null) { String fn = mi.model.fileName; int last = fn.LastIndexOf('\\'); // fn = fn.Substring(last + 1); //Console.WriteLine(" wmi: " + fn + " at " + mi.pos); AddTriangles(triangles, mi); //Console.WriteLine(" model: " + fn); } } Console.WriteLine("wee"); /*Console.WriteLine( String.Format(" Triangles - Map: {0,6} Objects: {1,6} Models: {2,6}", map_triangles.GetNumberOfTriangles(), obj_triangles.GetNumberOfTriangles(), model_triangles.GetNumberOfTriangles())); */ } Console.WriteLine(" done"); wdt.maptiles[chunk_x, chunk_y] = null; // clear it atain //myChunk.triangles.ClearVertexMatrix(); // not needed anymore //return myChunk; }
void AddTrianglesGroupDoodads(TriangleCollection s, ModelInstance mi, Vec3D world_dir, Vec3D world_off, float rot) { float dx = mi.pos.x; float dy = mi.pos.y; float dz = mi.pos.z; rotate(dx, dz, rot +90f, out dx, out dz); dx += world_off.x; dy += world_off.y; dz += world_off.z; Quaternion q; q.x = -mi.dir.z; q.y = mi.dir.x; q.z = mi.dir.y; q.w = mi.w; Matrix4 rotMatrix = new Matrix4(); rotMatrix.makeQuaternionRotate(q); Model m = mi.model; if (m.boundingTriangles == null) { /* // /cry no bouding info, revert to normal vertices ModelView mv = m.view[0]; // View number 1 ?!?! int[] vertices = new int[m.vertices.Length / 3]; for (uint i = 0; i < m.vertices.Length / 3; i++) { float x = m.vertices[i * 3]; float y = m.vertices[i * 3 + 2]; float z = m.vertices[i * 3 + 1]; x *= mi.sc; y *= mi.sc; z *= -mi.sc; Vector pos; pos.x = x; pos.y = y; pos.z = z; Vector new_pos = rotMatrix.mutiply(pos); x = pos.x; y = pos.y; z = pos.z; rotate(x, z, (world_dir.y - 90), out x, out z); rotate(y, z, -world_dir.x, out y, out z); rotate(x, y, world_dir.z, out x, out y); float xx = x + dx; float yy = y + dy; float zz = -z + dz; float finalx = ChunkReader.ZEROPOINT - zz; float finaly = ChunkReader.ZEROPOINT - xx; float finalz = yy; vertices[i] = s.AddVertex(finalx, finaly, finalz); } for (int i = 0; i < mv.triangleList.Length / 3; i++) { int off = i * 3; UInt16 vi0 = mv.triangleList[off]; UInt16 vi1 = mv.triangleList[off + 1]; UInt16 vi2 = mv.triangleList[off + 2]; int ind0 = mv.indexList[vi0]; int ind1 = mv.indexList[vi1]; int ind2 = mv.indexList[vi2]; int v0 = vertices[ind0]; int v1 = vertices[ind1]; int v2 = vertices[ind2]; s.AddTriangle(v0, v1, v2, ChunkedTriangleCollection.TriangleFlagModel); } */ } else { // We got boiuding stuff, that is better int nBoundingVertices = m.boundingVertices.Length / 3; int[] vertices = new int[nBoundingVertices]; for (uint i = 0; i < nBoundingVertices; i++) { uint off = i * 3; float x = m.boundingVertices[off]; float y = m.boundingVertices[off + 2]; float z = m.boundingVertices[off + 1]; x *= mi.sc; y *= mi.sc; z *= -mi.sc; Vector pos; pos.x = x; pos.y = y; pos.z = z; Vector new_pos = rotMatrix.mutiply(pos); x = pos.x; y = pos.y; z = pos.z; rotate(x, z, (world_dir.y - 90), out x, out z); rotate(y, z, -world_dir.x, out y, out z); rotate(x, y, world_dir.z, out x, out y); float xx = x + dx; float yy = y + dy; float zz = -z + dz; float finalx = ChunkReader.ZEROPOINT - zz; float finaly = ChunkReader.ZEROPOINT - xx; float finalz = yy; vertices[i] = s.AddVertex(finalx, finaly, finalz); } int nBoundingTriangles = m.boundingTriangles.Length / 3; for (uint i = 0; i < nBoundingTriangles; i++) { uint off = i * 3; int v0 = vertices[m.boundingTriangles[off]]; int v1 = vertices[m.boundingTriangles[off + 1]]; int v2 = vertices[m.boundingTriangles[off + 2]]; s.AddTriangle(v0, v1, v2, ChunkedTriangleCollection.TriangleFlagModel); } } }
public static TriangleCollection CreateRectGeometry(float width, float height) { float halfWidth = width * 0.5f; float halfHeight = height * 0.5f; var tri1 = new Triangle( new Vector3(-halfWidth, -halfHeight, 0f), new Vector3(-halfWidth, halfHeight, 0f), new Vector3(halfWidth, halfHeight, 0f)); var tri2 = new Triangle( new Vector3(-halfWidth, -halfHeight, 0f), new Vector3(halfWidth, halfHeight, 0f), new Vector3(halfWidth, -halfHeight, 0f)); var result = new TriangleCollection(); result.Add(tri1); result.Add(tri2); return result; }
public TerrainRenderer(int id, IEnumerable<FileInfo> files, ZoneType type, ClientDataWrapper wrapper) : base(id, files, type, wrapper) { // Init Terrain Height Calculator TerrainHeightCache = TerrainHeightCalculator; AddNifCache(TerrainNifs); AddNifInstancesYZSwapped(TerrainFixtures); // Store Terrain var terrain = TerrainHeightMap; var vertices = new List<Vector3>(); var indices = new List<TriangleIndex>(); for (int x = 0 ; x < terrain.Length ; x++) { var yLength = terrain[x].Length; for (int y = 0 ; y < yLength ; y++) { var height = terrain[x][y]; vertices.Add(new Vector3(x, height, y)); } } var width = terrain.Length; for (int x = 0 ; x < terrain.Length - 1 ; x++) { var yLength = terrain[x].Length; for (int y = 0 ; y < yLength - 1 ; y++) { var tri1 = new TriangleIndex { A = (uint)((x + 1) * width + (y + 1)), B = (uint)((x + 1) * width + y), C = (uint)(x * width + y), }; var tri2 = new TriangleIndex { A = (uint)((x + 1) * width + (y + 1)), B = (uint)(x * width + y), C = (uint)(x * width + (y + 1)), }; indices.Add(tri1); indices.Add(tri2); } } // Build Terrain object as a Primitive Nif var Terrain = new TriangleCollection { Vertices = vertices.ToArray(), Indices = indices.ToArray(), }; // Add Terrain like a Nif var insertid = 0; if (NifCache.Count > 0) insertid = NifCache.Max(kv => kv.Key) + 1; NifCache.Add(insertid, new ClientMesh("terrain", Terrain, Terrain, Terrain)); InstancesMatrix = InstancesMatrix.Concat(new [] { new KeyValuePair<int, Matrix>(insertid, Matrix.Identity) }).ToArray(); }
/// <summary> /// Initializes a new instance of the <see cref="ClientMesh"/> class with predefined Mesh. /// </summary> /// <param name="nifName">Name of the Nif File</param> /// <param name="pickee">pickee Mesh</param> /// <param name="collidee">collidee Mesh</param> /// <param name="visible">visible Mesh</param> public ClientMesh(string nifName, TriangleCollection pickee, TriangleCollection collidee, TriangleCollection visible) : this(nifName) { Pickee = pickee; Collidee = collidee; Visible = visible; }
private Spot Search(Spot fromSpot, Spot destinationSpot, float minHowClose, ILocationHeuristics locationHeuristics) { var searchDuration = new Stopwatch(); searchDuration.Start(); var timeSinceProgress = new Stopwatch(); timeSinceProgress.Start(); var closest = 99999f; ClosestSpot = null; currentSearchStartSpot = fromSpot; searchID++; int currentSearchID = searchID; //searchProgress = new SearchProgress(fromSpot, destinationSpot, searchID); // lowest first queue PriorityQueue <Spot, float> prioritySpotQueue = new PriorityQueue <Spot, float>(); // (new SpotSearchComparer(dst, score)); ; prioritySpotQueue.Enqueue(fromSpot, -fromSpot.GetDistanceTo(destinationSpot) * heuristicsFactor); fromSpot.SearchScoreSet(currentSearchID, 0.0f); fromSpot.traceBack = null; fromSpot.traceBackDistance = 0; // A* -ish algorithm while (prioritySpotQueue.Count != 0 && SearchEnabled) { if (sleepMSBetweenSpots != 0) { Thread.Sleep(sleepMSBetweenSpots); } // slow down the pathing float prio; currentSearchSpot = prioritySpotQueue.Dequeue(out prio); // .Value; // force the world to be loaded TriangleCollection tc = triangleWorld.GetChunkAt(currentSearchSpot.X, currentSearchSpot.Y); if (currentSearchSpot.SearchIsClosed(currentSearchID)) { continue; } currentSearchSpot.SearchClose(currentSearchID); //update status //if (!searchProgress.CheckProgress(currentSearchSpot)) { break; } // are we there? var distance = currentSearchSpot.location.GetDistanceTo(destinationSpot.location); if (distance <= minHowClose) { return(currentSearchSpot); // got there } if (distance < closest) { logger.WriteLine($"Closet spot is {distance} from the target"); closest = distance; ClosestSpot = currentSearchSpot; timeSinceProgress.Reset(); timeSinceProgress.Start(); } if (timeSinceProgress.Elapsed.TotalSeconds > ProgressTimeoutSeconds || searchDuration.Elapsed.TotalSeconds > TimeoutSeconds) { logger.WriteLine("search failed, 10 seconds since last progress, returning the closest spot."); return(ClosestSpot); } //Find spots to link to CreateSpotsAroundSpot(currentSearchSpot); //score each spot around the current search spot and add them to the queue foreach (Spot spotLinkedToCurrent in currentSearchSpot.GetPathsToSpots(this)) { if (spotLinkedToCurrent != null && !spotLinkedToCurrent.IsBlocked() && !spotLinkedToCurrent.SearchIsClosed(currentSearchID)) { ScoreSpot(spotLinkedToCurrent, destinationSpot, currentSearchID, locationHeuristics, prioritySpotQueue); } } } //we ran out of spots to search //searchProgress.LogStatus(" search failed. "); if (ClosestSpot != null && closest < MaximumAllowedRangeFromTarget) { logger.WriteLine("search failed, returning the closest spot."); return(ClosestSpot); } return(null); }
public ChunkAddedEventArgs(TriangleCollection triangles) { Triangles = triangles; }