private void SingleLayerCalculationStart(BaseLayer layer) { switch (layer.LayerType) { // Elevation Layers case Layer.Height: HeightLayer heightLayer = layer as HeightLayer; heightLayer.StartHeight(TerrainSize, TerrainHeights); break; case Layer.Slope: SlopeLayer slopeLayer = layer as SlopeLayer; slopeLayer.StartSlope(TerrainSize, TerrainHeights); break; case Layer.Island: IslandLayer islandLayer = layer as IslandLayer; islandLayer.StartIsland(TerrainSize, TerrainHeights); break; case Layer.OpenSimplex: OpenSimplexNoiseLayer OSNLayer = layer as OpenSimplexNoiseLayer; OSNLayer.StartOpenSimplexNoise(TerrainSize, TerrainHeights); break; case Layer.CellNoise: CellNoiseLayer CellNoiseLayer = layer as CellNoiseLayer; CellNoiseLayer.StartCellNoise(TerrainSize, TerrainHeights); break; // Erosion Layers case Layer.Hydraulic: HydraulicErosionLayer hydraulicErosionLayer = layer as HydraulicErosionLayer; hydraulicErosionLayer.StartErosion(TerrainSize, TerrainHeights); break; // Colorization Layers case Layer.DetailColorization: DetailColorizationLayer detailColorizationLayer = layer as DetailColorizationLayer; detailColorizationLayer.StartColorization(TerrainSize, TerrainHeights); break; case Layer.HeightColorization: HeightColorizationLayer heightColorizationLayer = layer as HeightColorizationLayer; heightColorizationLayer.StartColorization(TerrainSize, TerrainHeights, PreviousTerrainColors); break; } }
protected virtual StatelessGenLayer CreateGenLayers(int seed) { StatelessGenLayer addIsland0 = new IslandLayer(seed, null); StatelessGenLayer zoomed0 = new ZoomLayer(seed, addIsland0); StatelessGenLayer biomesAdded = new BiomeLayer(seed, zoomed0); StatelessGenLayer addIsland1 = new AddIslandLayer(2, biomesAdded); StatelessGenLayer zoomed1 = new ZoomLayer(seed, addIsland1); StatelessGenLayer addIsland2 = new AddIslandLayer(50, zoomed1); // GenLayer zoomed2 = new GenLayerZoom(seed, zoomed0); StatelessGenLayer zoomed2 = ZoomLayer.Magnify(seed, addIsland2, 4); StatelessGenLayer addBeach = new AddBeachLayer(50, zoomed2); StatelessGenLayer zoomed3 = new ZoomLayer(seed, addBeach); StatelessGenLayer addRiver = new AddRiverLayer(1000, zoomed3); StatelessGenLayer result = ZoomLayer.Magnify(seed, addRiver, 2); // GenLayer biomesAdded = new GenLayerBiome(seed, zoomed0); // GenLayer zoomed2 = new GenLayerZoom(seed, zoomed1); return(result); }
public void AddNewLayer(Layer layerType) { BaseLayer newLayer = null; switch (layerType) { case Layer.Height: HeightLayer newHeightLayer = new HeightLayer(this, terrainEngine); newHeightLayer.Name = GetName(Layer.Height, Layers.Count); newHeightLayer.ImagePath = "pack://application:,,,/Topographer3D;component/Assets/Icons/RaiseIcon.png"; newHeightLayer.Position = Layers.Count; Layers.Add(newHeightLayer); ShowLayerDetails(newHeightLayer); newLayer = newHeightLayer; break; case Layer.Slope: SlopeLayer newSlopeLayer = new SlopeLayer(this, terrainEngine); newSlopeLayer.Name = GetName(Layer.Slope, Layers.Count); newSlopeLayer.ImagePath = "pack://application:,,,/Topographer3D;component/Assets/Icons/RaiseIcon.png"; newSlopeLayer.Position = Layers.Count; Layers.Add(newSlopeLayer); ShowLayerDetails(newSlopeLayer); newLayer = newSlopeLayer; break; case Layer.Island: IslandLayer newIslandLayer = new IslandLayer(this, terrainEngine); newIslandLayer.Name = GetName(Layer.Island, Layers.Count); newIslandLayer.ImagePath = "pack://application:,,,/Topographer3D;component/Assets/Icons/RaiseIcon.png"; newIslandLayer.Position = Layers.Count; Layers.Add(newIslandLayer); ShowLayerDetails(newIslandLayer); newLayer = newIslandLayer; break; case Layer.OpenSimplex: OpenSimplexNoiseLayer newOSNLayer = new OpenSimplexNoiseLayer(this, terrainEngine); newOSNLayer.Name = GetName(Layer.OpenSimplex, Layers.Count); newOSNLayer.ImagePath = "pack://application:,,,/Topographer3D;component/Assets/Icons/RaiseIcon.png"; newOSNLayer.Position = Layers.Count; Layers.Add(newOSNLayer); ShowLayerDetails(newOSNLayer); newLayer = newOSNLayer; break; case Layer.CellNoise: CellNoiseLayer newCellNoiseLayer = new CellNoiseLayer(this, terrainEngine); newCellNoiseLayer.Name = GetName(Layer.CellNoise, Layers.Count); newCellNoiseLayer.ImagePath = "pack://application:,,,/Topographer3D;component/Assets/Icons/RaiseIcon.png"; newCellNoiseLayer.Position = Layers.Count; Layers.Add(newCellNoiseLayer); ShowLayerDetails(newCellNoiseLayer); newLayer = newCellNoiseLayer; break; case Layer.Hydraulic: HydraulicErosionLayer newHydrauliceErosionLayer = new HydraulicErosionLayer(this, terrainEngine); newHydrauliceErosionLayer.Name = GetName(Layer.Hydraulic, Layers.Count); newHydrauliceErosionLayer.ImagePath = "pack://application:,,,/Topographer3D;component/Assets/Icons/ErodeIcon.png"; newHydrauliceErosionLayer.Position = Layers.Count; Layers.Add(newHydrauliceErosionLayer); ShowLayerDetails(newHydrauliceErosionLayer); newLayer = newHydrauliceErosionLayer; break; case Layer.DetailColorization: DetailColorizationLayer newDetailColorizationLayer = new DetailColorizationLayer(this, terrainEngine); newDetailColorizationLayer.Name = GetName(Layer.DetailColorization, Layers.Count); newDetailColorizationLayer.ImagePath = "pack://application:,,,/Topographer3D;component/Assets/Icons/ColorizeIcon.png"; newDetailColorizationLayer.Position = Layers.Count; Layers.Add(newDetailColorizationLayer); ShowLayerDetails(newDetailColorizationLayer); newLayer = newDetailColorizationLayer; break; case Layer.HeightColorization: HeightColorizationLayer newHeightColorizationLayer = new HeightColorizationLayer(this, terrainEngine); newHeightColorizationLayer.Name = GetName(Layer.HeightColorization, Layers.Count); newHeightColorizationLayer.ImagePath = "pack://application:,,,/Topographer3D;component/Assets/Icons/ColorizeIcon.png"; newHeightColorizationLayer.Position = Layers.Count; Layers.Add(newHeightColorizationLayer); ShowLayerDetails(newHeightColorizationLayer); newLayer = newHeightColorizationLayer; break; } if (newLayer.Position == 0) { newLayer.HasApplicationMode = Visibility.Hidden; newLayer.CurrentApplicationMode = (ApplicationMode)100; } }