private List <RasterizationMesh> CollectMeshes(Bounds bounds) { List <RasterizationMesh> list = ListPool <RasterizationMesh> .Claim(); RecastMeshGatherer recastMeshGatherer = new RecastMeshGatherer(bounds, this.terrainSampleSize, this.mask, this.tagMask, this.colliderRasterizeDetail); if (this.rasterizeMeshes) { recastMeshGatherer.CollectSceneMeshes(list); } recastMeshGatherer.CollectRecastMeshObjs(list); if (this.rasterizeTerrain) { float desiredChunkSize = this.cellSize * (float)Math.Max(this.tileSizeX, this.tileSizeZ); recastMeshGatherer.CollectTerrainMeshes(this.rasterizeTrees, desiredChunkSize, list); } if (this.rasterizeColliders) { recastMeshGatherer.CollectColliderMeshes(list); } if (list.Count == 0) { Debug.LogWarning("No MeshFilters were found contained in the layers specified by the 'mask' variables"); } return(list); }
List <RasterizationMesh> CollectMeshes(Bounds bounds) { var result = ListPool <RasterizationMesh> .Claim(); var meshGatherer = new RecastMeshGatherer(bounds, terrainSampleSize, mask, tagMask, colliderRasterizeDetail); if (rasterizeMeshes) { meshGatherer.CollectSceneMeshes(result); } meshGatherer.CollectRecastMeshObjs(result); if (rasterizeTerrain) { // Split terrains up into meshes approximately the size of a single chunk var desiredTerrainChunkSize = cellSize * Math.Max(tileSizeX, tileSizeZ); meshGatherer.CollectTerrainMeshes(rasterizeTrees, desiredTerrainChunkSize, result); } if (rasterizeColliders) { meshGatherer.CollectColliderMeshes(result); } if (result.Count == 0) { Debug.LogWarning("No MeshFilters were found contained in the layers specified by the 'mask' variables"); } return(result); }
public static List <RasterizationMesh> CollectMeshes(this RecastGraph self, Bounds bounds) { Profiler.BeginSample("Find Meshes for rasterization"); var result = ListPool <RasterizationMesh> .Claim(); var meshGatherer = new RecastMeshGatherer(bounds, self.terrainSampleSize, self.mask, self.tagMask, self.colliderRasterizeDetail); if (self.rasterizeMeshes) { Profiler.BeginSample("Find meshes"); meshGatherer.CollectSceneMeshes(result); Profiler.EndSample(); } Profiler.BeginSample("Find RecastMeshObj components"); meshGatherer.CollectRecastMeshObjs(result); Profiler.EndSample(); if (self.rasterizeTerrain) { Profiler.BeginSample("Find terrains"); // Split terrains up into meshes approximately the size of a single chunk var desiredTerrainChunkSize = self.cellSize * Math.Max(self.tileSizeX, self.tileSizeZ); meshGatherer.CollectTerrainMeshes(self.rasterizeTrees, desiredTerrainChunkSize, result); Profiler.EndSample(); } if (self.rasterizeColliders) { Profiler.BeginSample("Find colliders"); meshGatherer.CollectColliderMeshes(result); Profiler.EndSample(); } if (result.Count == 0) { Debug.LogWarning("No MeshFilters were found contained in the layers specified by the 'mask' variables"); } Profiler.EndSample(); return(result); }