public Zone(MacroMap mesh, MacroMap.CellMesh.Submesh cells, int id, BiomeSettings biome, TriRunner settings) { _mesh = mesh; Submesh = cells; Id = id; Biome = biome; Influence = new Influence(id); }
//public static readonly IdComparer IdIncComparer = new IdComparer(); //public static readonly CellEqualityComparer CellComparer = new CellEqualityComparer(); /* * public Cell this[Sides side] * { * get { return _neighbors[(int) side]; } * //set { _neighbors[(int) side] = value; } * } */ public Cell(MacroMap map, Coord coords, MacroMap.CellMesh.Face face, IEnumerable <MacroVert> vertices, IEnumerable <MacroEdge> edges) { Assert.IsTrue(face.Vertices.Count() == MaxNeighborsCount); Assert.IsTrue(face.Edges.Count() == MaxNeighborsCount); _face = face; _vertices = vertices.ToArray(); _edges = edges.ToArray(); Map = map; Coords = coords; }
/// <summary> /// Vertex of macro map /// </summary> /// <param name="map"></param> /// <param name="id"></param> public MacroVert(MacroMap map, MacroMap.CellMesh mesh2, MacroMap.CellMesh.Vertex vertex, TriRunner settings) { Assert.IsTrue(vertex.AdjacentEdges.Count >= 1 && vertex.AdjacentEdges.Count <= 3); Assert.IsTrue(vertex.AdjacentFaces.Count >= 1 && vertex.AdjacentFaces.Count <= 3); _map = map; _mesh2 = mesh2; _vertex = vertex; _biomes = settings.Biomes; //_vertex.Data = this; }
public MacroEdge([NotNull] MacroMap map, MacroMap.CellMesh mesh, MacroMap.CellMesh.Edge edge, MacroVert vertex1, MacroVert vertex2) { if (map == null) { throw new ArgumentNullException(nameof(map)); } _edge = edge; _map = map; _mesh = mesh; Vertex1 = vertex1; Vertex2 = vertex2; }
/// <summary> /// Generate micro-presentation for given macro zone and place it to Micromap /// </summary> /// <param name="zone"></param> /// <param name="outputMap"></param> public void GenerateMicroZone(MacroMap inputMap, Zone zone, MicroMap outputMap) { //Get generator for this zone var mainGenerator = inputMap.Generators.Find(g => g.Zone == zone); var additionalGeneratorsCache = new List <BaseZoneGenerator> (); foreach (var cell in zone.Cells) { var microcell = outputMap.Cells.First(c => c.Macro == cell); //Prepare buffers for microcell var bufferSize = microcell.Bounds; var cellMixBuffer = new CellMixVertex[bufferSize.Size.X + 1, bufferSize.Size.Z + 1]; var heightBuffer = new List <Heights>(microcell.VertexPositions.Length); var blockBuffer = new (Blocks, Heights)[bufferSize.Size.X, bufferSize.Size.Z];
public MacroMap CreateMacroMap(TriRunner settings) { var timer = Stopwatch.StartNew(); var result = new MacroMap(settings, _random); var zoneGenerators = RandomClusterZonesDivider(result, settings); foreach (var generator in zoneGenerators) { result.Generators.Add(generator); var zone = generator.GenerateMacroZone(); result.Zones.Add(zone); } timer.Stop(); Debug.LogFormat("Created macromap in {0} msec", timer.ElapsedMilliseconds); CheckMacroHeightFunctionQuality(result); return(result); }