public void RunNode() { var layer = (NodeVariables.Texture)GetValue(); if (layer == null) // Check for if the textures node is not connected. { return; } switch (layer.LandLayer) { case 0: MapManager.PaintLayer(LandLayers.Ground, TerrainSplat.TypeToIndex(layer.GroundTexture)); break; case 1: MapManager.PaintLayer(LandLayers.Biome, TerrainBiome.TypeToIndex(layer.BiomeTexture)); break; case 2: MapManager.PaintLayer(LandLayers.Alpha, layer.AlphaTexture); break; case 3: MapManager.PaintLayer(LandLayers.Topology, layer.TopologyTexture, layer.TopologyLayer); break; } }
private void LoadWorldContent() { //game data YieldFood = new YieldType("food", YieldManager); YieldProduction = new YieldType("production", YieldManager); YieldCommerce = new YieldType("commerce", YieldManager); WFeatureGlassland = new TerrainBiome("grassland", WFeatureBiome, YieldManager, YieldModifierType.Addition, new double[] { 2, 0, 0 }); WFeaturePlains = new TerrainBiome("plains", WFeatureBiome, YieldManager, YieldModifierType.Addition, new double[] { 1, 1, 0 }); WFeatureDesert = new TerrainBiome("desert", WFeatureBiome, YieldManager, YieldModifierType.Addition, new double[] { 0, 1, 0 }); WFeatureTundra = new TerrainBiome("tundra", WFeatureBiome, YieldManager, YieldModifierType.Addition, new double[] { 1, 0, 0 }); WFeatureIce = new TerrainBiome("ice", WFeatureBiome, YieldManager, YieldModifierType.Addition, new double[] { 0, 0, 0 }); WFeatureJungle = new TerrainVegetation("jungle", WFeatureVegetation, YieldManager, YieldModifierType.Addition, new double[] { 0, -1, -1 }); WFeatureForest = new TerrainVegetation("forest", WFeatureVegetation, YieldManager, YieldModifierType.Addition, new double[] { 0, 1, 0 }); WFeaturePineForest = new TerrainVegetation("pine forest", WFeatureVegetation, YieldManager, YieldModifierType.Addition, new double[] { 0, 1, 0 }); WFeatureFlatland = new TerrainLandform("flatland", WFeatureLandform, YieldManager, YieldModifierType.Addition, new double[] { 0, 0, 0 }); WFeatureHills = new TerrainLandform("hills", WFeatureLandform, YieldManager, YieldModifierType.Addition, new double[] { -1, 1, 0 }); WFeatureMountains = new TerrainLandform("mountains", WFeatureLandform, YieldManager, YieldModifierType.Addition, new double[] { -2, 1, 0 }); WFeatureHighMountains = new TerrainLandform("high mountains", WFeatureLandform, YieldManager, YieldModifierType.Addition, new double[] { -2, 0, -1 }); //civs CivilizationRome = new Civilization("Rome", CivilizationManager); CivilizationEgypt = new Civilization("Egypt", CivilizationManager); }
private float FindBlendParameters( Vector3 pos, out Climate.ClimateParameters src, out Climate.ClimateParameters dst) { if (this.climates == null) { this.climates = new Climate.ClimateParameters[4] { this.Arid, this.Temperate, this.Tundra, this.Arctic } } ; if (Object.op_Equality((Object)TerrainMeta.BiomeMap, (Object)null)) { src = (Climate.ClimateParameters)null; dst = (Climate.ClimateParameters)null; return(0.5f); } int biomeMaxType1 = TerrainMeta.BiomeMap.GetBiomeMaxType(pos, -1); int biomeMaxType2 = TerrainMeta.BiomeMap.GetBiomeMaxType(pos, ~biomeMaxType1); src = this.climates[TerrainBiome.TypeToIndex(biomeMaxType1)]; dst = this.climates[TerrainBiome.TypeToIndex(biomeMaxType2)]; return(TerrainMeta.BiomeMap.GetBiome(pos, biomeMaxType2)); }
public float FindBlendParameters(Vector3 pos, out T src, out T dst) { if (Object.op_Equality((Object)TerrainMeta.BiomeMap, (Object)null)) { src = this.Temperate; dst = this.Tundra; return(0.0f); } if (this.climates == null || this.climates.Length == 0) { this.climates = new T[4] { this.Arid, this.Temperate, this.Tundra, this.Arctic } } ; int biomeMaxType1 = TerrainMeta.BiomeMap.GetBiomeMaxType(pos, -1); int biomeMaxType2 = TerrainMeta.BiomeMap.GetBiomeMaxType(pos, ~biomeMaxType1); src = this.climates[TerrainBiome.TypeToIndex(biomeMaxType1)]; dst = this.climates[TerrainBiome.TypeToIndex(biomeMaxType2)]; return(TerrainMeta.BiomeMap.GetBiome(pos, biomeMaxType2)); }
public void RunNode() { var layer = (NodeVariables.Texture)GetValue(); if (layer == null) { return; } switch (layer.LandLayer) { case 0: MapManager.PaintConditional(LandLayers.Ground, TerrainSplat.TypeToIndex(layer.GroundTexture), conditions); break; case 1: MapManager.PaintConditional(LandLayers.Biome, TerrainBiome.TypeToIndex(layer.BiomeTexture), conditions); break; case 2: MapManager.PaintConditional(LandLayers.Alpha, layer.AlphaTexture, conditions); break; case 3: MapManager.PaintConditional(LandLayers.Topology, layer.TopologyTexture, conditions, layer.TopologyLayer); break; } }
private void OnGUI() { scrollPos = EditorGUILayout.BeginScrollView(scrollPos, false, false); GUIContent[] layersOptionsMenu = new GUIContent[4]; layersOptionsMenu[0] = new GUIContent("Ground"); layersOptionsMenu[1] = new GUIContent("Biome"); layersOptionsMenu[2] = new GUIContent("Alpha"); layersOptionsMenu[3] = new GUIContent("Topology"); EditorGUI.BeginChangeCheck(); layerIndex = GUILayout.Toolbar(layerIndex, layersOptionsMenu, EditorStyles.toolbarButton); if (EditorGUI.EndChangeCheck()) TerrainManager.ChangeLayer((TerrainManager.LayerType)layerIndex, TerrainTopology.TypeToIndex((int)layers.Topologies)); if (layerIndex != (int)TerrainManager.CurrentLayerType) layerIndex = (int)TerrainManager.CurrentLayerType; switch ((TerrainManager.LayerType)layerIndex) { case TerrainManager.LayerType.Ground: Functions.TextureSelect(TerrainManager.CurrentLayerType, ref layers); Functions.AreaSelect(); Functions.LayerTools(TerrainManager.CurrentLayerType, TerrainSplat.TypeToIndex((int)layers.Ground)); Functions.RotateTools(TerrainManager.CurrentLayerType); Functions.RiverTools(TerrainManager.CurrentLayerType, TerrainSplat.TypeToIndex((int)layers.Ground), ref aboveTerrain); Functions.SlopeTools(TerrainManager.CurrentLayerType, TerrainSplat.TypeToIndex((int)layers.Ground), ref slopesInfo); Functions.HeightTools(TerrainManager.CurrentLayerType, TerrainSplat.TypeToIndex((int)layers.Ground), ref heightsInfo); break; case TerrainManager.LayerType.Biome: Functions.TextureSelect(TerrainManager.CurrentLayerType, ref layers); Functions.AreaSelect(); Functions.LayerTools(TerrainManager.CurrentLayerType, TerrainBiome.TypeToIndex((int)layers.Biome)); Functions.RotateTools(TerrainManager.CurrentLayerType); Functions.RiverTools(TerrainManager.CurrentLayerType, TerrainBiome.TypeToIndex((int)layers.Biome), ref aboveTerrain); Functions.SlopeTools(TerrainManager.CurrentLayerType, TerrainBiome.TypeToIndex((int)layers.Biome), ref slopesInfo); Functions.HeightTools(TerrainManager.CurrentLayerType, TerrainBiome.TypeToIndex((int)layers.Biome), ref heightsInfo); break; case TerrainManager.LayerType.Alpha: Functions.LayerTools((TerrainManager.LayerType)layerIndex, 0, 1); Functions.AreaSelect(); Functions.RotateTools((TerrainManager.LayerType)layerIndex); Functions.RiverTools((TerrainManager.LayerType)layerIndex, 0, ref aboveTerrain, 1); Functions.SlopeTools((TerrainManager.LayerType)layerIndex, 0, ref slopesInfo, 1); Functions.HeightTools((TerrainManager.LayerType)layerIndex, 0, ref heightsInfo, 1); break; case TerrainManager.LayerType.Topology: Functions.TopologyLayerSelect(ref layers); Functions.AreaSelect(); Functions.LayerTools(TerrainManager.CurrentLayerType, 0, TerrainTopology.TypeToIndex((int)layers.Topologies)); Functions.RotateTools(TerrainManager.CurrentLayerType, TerrainTopology.TypeToIndex((int)layers.Topologies)); Functions.TopologyTools(); Functions.RiverTools(TerrainManager.CurrentLayerType, 0, ref aboveTerrain, 1, TerrainTopology.TypeToIndex((int)layers.Topologies)); Functions.SlopeTools(TerrainManager.CurrentLayerType, 0, ref slopesInfo, 1, TerrainTopology.TypeToIndex((int)layers.Topologies)); Functions.HeightTools(TerrainManager.CurrentLayerType, 0, ref heightsInfo, 1, TerrainTopology.TypeToIndex((int)layers.Topologies)); break; } EditorGUILayout.EndScrollView(); }
public static void ConditionalPaintLayerSelect(ref Conditions cnds, ref Layers layers, ref int texture) { Elements.MiniBoldLabel(ToolTips.textureToPaintLabel); Elements.BeginToolbarHorizontal(); Elements.ToolbarLabel(ToolTips.layerSelect); layers.LandLayer = (LandLayers)Elements.ToolbarEnumPopup(layers.LandLayer); Elements.EndToolbarHorizontal(); switch (layers.LandLayer) { case LandLayers.Ground: Elements.BeginToolbarHorizontal(); Elements.ToolbarLabel(ToolTips.textureSelect); layers.Ground = (TerrainSplat.Enum)Elements.ToolbarEnumPopup(layers.Ground); texture = TerrainSplat.TypeToIndex((int)layers.Ground); Elements.EndToolbarHorizontal(); break; case LandLayers.Biome: Elements.BeginToolbarHorizontal(); Elements.ToolbarLabel(ToolTips.textureSelect); layers.Biome = (TerrainBiome.Enum)Elements.ToolbarEnumPopup(layers.Biome); texture = TerrainBiome.TypeToIndex((int)layers.Biome); Elements.EndToolbarHorizontal(); break; case LandLayers.Alpha: Elements.BeginToolbarHorizontal(); Elements.ToolbarLabel(ToolTips.textureSelect); layers.AlphaTexture = (AlphaTextures)Elements.ToolbarEnumPopup(layers.AlphaTexture); texture = (int)layers.AlphaTexture; Elements.EndToolbarHorizontal(); break; case LandLayers.Topology: Elements.BeginToolbarHorizontal(); Elements.ToolbarLabel(ToolTips.topologyLayerSelect); layers.Topologies = (TerrainTopology.Enum)Elements.ToolbarEnumPopup(layers.Topologies); Elements.EndToolbarHorizontal(); Elements.BeginToolbarHorizontal(); Elements.ToolbarLabel(ToolTips.textureSelect); layers.TopologyTexture = (TopologyTextures)Elements.ToolbarEnumPopup(layers.TopologyTexture); texture = (int)layers.TopologyTexture; Elements.EndToolbarHorizontal(); break; } Elements.BeginToolbarHorizontal(); if (Elements.ToolbarButton(ToolTips.paintConditional)) { MapManager.PaintConditional(layers.LandLayer, texture, cnds, TerrainTopology.TypeToIndex((int)layers.Topologies)); } Elements.EndToolbarHorizontal(); }
// Use this for initialization void Awake() { terrainManager = ScriptableObject.CreateInstance <TerrainManager>(); terrainSettings = ScriptableObject.CreateInstance <TerrainSettings>(); terrainBiome = ScriptableObject.CreateInstance <TerrainBiome>(); if (gameMaster != this) { gameMaster = this; DontDestroyOnLoad(this); } GameObject NewTerrain = TerrainExtensions.CreateTerrain(new Vector3(0f, 0f, 0f)); }
public static MapInfo EmptyMap(int size, float landHeight, TerrainSplat.Enum ground = TerrainSplat.Enum.Grass, TerrainBiome.Enum biome = TerrainBiome.Enum.Temperate) { MapInfo terrains = new MapInfo(); int splatRes = Mathf.Clamp(Mathf.NextPowerOfTwo((int)(size * 0.50f)), 512, 2048); List <PathData> paths = new List <PathData>(); List <PrefabData> prefabs = new List <PrefabData>(); terrains.pathData = paths.ToArray(); terrains.prefabData = prefabs.ToArray(); terrains.terrainRes = Mathf.Clamp(Mathf.NextPowerOfTwo(size), 512, 4096) + 1; terrains.size = new Vector3(size, 1000, size); terrains.land.heights = SetValues(new float[terrains.terrainRes, terrains.terrainRes], landHeight / 1000f, new Area(0, terrains.terrainRes, 0, terrains.terrainRes)); terrains.water.heights = SetValues(new float[terrains.terrainRes, terrains.terrainRes], 500f / 1000f, new Area(0, terrains.terrainRes, 0, terrains.terrainRes)); terrains.splatRes = splatRes; terrains.splatMap = new float[splatRes, splatRes, 8]; int gndIdx = TerrainSplat.TypeToIndex((int)ground); Parallel.For(0, splatRes, i => { for (int j = 0; j < splatRes; j++) { terrains.splatMap[i, j, gndIdx] = 1f; } }); terrains.biomeMap = new float[splatRes, splatRes, 4]; int biomeIdx = TerrainBiome.TypeToIndex((int)biome); Parallel.For(0, splatRes, i => { for (int j = 0; j < splatRes; j++) { terrains.biomeMap[i, j, biomeIdx] = 1f; } }); terrains.alphaMap = new bool[splatRes, splatRes]; Parallel.For(0, splatRes, i => { for (int j = 0; j < splatRes; j++) { terrains.alphaMap[i, j] = true; } }); terrains.topology = new TerrainMap <int>(new byte[(int)Mathf.Pow(splatRes, 2) * 4 * 1], 1); return(terrains); }
public T FindBlendParameters(Vector3 pos) { if (TerrainMeta.BiomeMap == null) { return(this.Temperate); } if (this.climates == null || this.climates.Length == 0) { this.climates = new T[] { this.Arid, this.Temperate, this.Tundra, this.Arctic }; } int biomeMaxType = TerrainMeta.BiomeMap.GetBiomeMaxType(pos, -1); return(this.climates[TerrainBiome.TypeToIndex(biomeMaxType)]); }
// Use this for initialization void Awake() { terrainSettings = ScriptableObject.CreateInstance <TerrainSettings>(); ParticleSystemSelector = ScriptableObject.CreateInstance <ScriptableParticle>(); terrainBiome = ScriptableObject.CreateInstance <TerrainBiome>(); terrainManager = ScriptableObject.CreateInstance <TerrainManager>(); if (gameMaster != this) { gameMaster = this; } DontDestroyOnLoad(this); TerrainExtensions.CreateTerrain(new Vector3(0, 0, 0)); }
public void SetBiome(int x, int z, int id) { int index1 = TerrainBiome.TypeToIndex(id); for (int index2 = 0; index2 < this.num; ++index2) { if (index2 == index1) { this.dst[(index2 * this.res + z) * this.res + x] = byte.MaxValue; } else { this.dst[(index2 * this.res + z) * this.res + x] = (byte)0; } } }
public void SetBiome(int x, int z, int id) { int index = TerrainBiome.TypeToIndex(id); for (int i = 0; i < this.num; i++) { if (i != index) { this.dst[(i * this.res + z) * this.res + x] = 0; } else { this.dst[(i * this.res + z) * this.res + x] = 255; } } }
public T FindBlendParameters(Vector3 pos) { if (TerrainMeta.BiomeMap == null) { return(Temperate); } if (climates == null || climates.Length == 0) { climates = new T[4] { Arid, Temperate, Tundra, Arctic }; } int biomeMaxType = TerrainMeta.BiomeMap.GetBiomeMaxType(pos); return(climates[TerrainBiome.TypeToIndex(biomeMaxType)]); }
public float GetBiome(int x, int z, int mask) { if (Mathf.IsPowerOfTwo(mask)) { return(BitUtility.Byte2Float((int)this.src[(TerrainBiome.TypeToIndex(mask) * this.res + z) * this.res + x])); } int num = 0; for (int index = 0; index < this.num; ++index) { if ((TerrainBiome.IndexToType(index) & mask) != 0) { num += (int)this.src[(index * this.res + z) * this.res + x]; } } return(Mathf.Clamp01(BitUtility.Byte2Float(num))); }
public float GetBiomeMax(int x, int z, int mask = -1) { byte num = 0; for (int i = 0; i < this.num; i++) { if ((TerrainBiome.IndexToType(i) & mask) != 0) { byte num1 = this.src[(i * this.res + z) * this.res + x]; if (num1 >= num) { num = num1; } } } return((float)num); }
public float GetBiomeMax(int x, int z, int mask = -1) { byte num1 = 0; for (int index = 0; index < this.num; ++index) { if ((TerrainBiome.IndexToType(index) & mask) != 0) { byte num2 = this.src[(index * this.res + z) * this.res + x]; if ((int)num2 >= (int)num1) { num1 = num2; } } } return((float)num1); }
private float FindBlendParameters(Vector3 pos, out Climate.ClimateParameters src, out Climate.ClimateParameters dst) { if (this.climates == null) { this.climates = new Climate.ClimateParameters[] { this.Arid, this.Temperate, this.Tundra, this.Arctic }; } if (TerrainMeta.BiomeMap == null) { src = null; dst = null; return(0.5f); } int biomeMaxType = TerrainMeta.BiomeMap.GetBiomeMaxType(pos, -1); int num = TerrainMeta.BiomeMap.GetBiomeMaxType(pos, ~biomeMaxType); src = this.climates[TerrainBiome.TypeToIndex(biomeMaxType)]; dst = this.climates[TerrainBiome.TypeToIndex(num)]; return(TerrainMeta.BiomeMap.GetBiome(pos, num)); }
public int GetBiomeMaxIndex(int x, int z, int mask = -1) { byte num1 = 0; int num2 = 0; for (int index = 0; index < this.num; ++index) { if ((TerrainBiome.IndexToType(index) & mask) != 0) { byte num3 = this.src[(index * this.res + z) * this.res + x]; if ((int)num3 >= (int)num1) { num1 = num3; num2 = index; } } } return(num2); }
public int GetBiomeMaxIndex(int x, int z, int mask = -1) { byte num = 0; int num1 = 0; for (int i = 0; i < this.num; i++) { if ((TerrainBiome.IndexToType(i) & mask) != 0) { byte num2 = this.src[(i * this.res + z) * this.res + x]; if (num2 >= num) { num = num2; num1 = i; } } } return(num1); }
public float FindBlendParameters(Vector3 pos, out T src, out T dst) { if (TerrainMeta.BiomeMap == null) { src = this.Temperate; dst = this.Tundra; return(0f); } if (this.climates == null || this.climates.Length == 0) { this.climates = new T[] { this.Arid, this.Temperate, this.Tundra, this.Arctic }; } int biomeMaxType = TerrainMeta.BiomeMap.GetBiomeMaxType(pos, -1); int num = TerrainMeta.BiomeMap.GetBiomeMaxType(pos, ~biomeMaxType); src = this.climates[TerrainBiome.TypeToIndex(biomeMaxType)]; dst = this.climates[TerrainBiome.TypeToIndex(num)]; return(TerrainMeta.BiomeMap.GetBiome(pos, num)); }
public T FindBlendParameters(Vector3 pos) { if (Object.op_Equality((Object)TerrainMeta.BiomeMap, (Object)null)) { return(this.Temperate); } if (this.climates == null || this.climates.Length == 0) { this.climates = new T[4] { this.Arid, this.Temperate, this.Tundra, this.Arctic } } ; return(this.climates[TerrainBiome.TypeToIndex(TerrainMeta.BiomeMap.GetBiomeMaxType(pos, -1))]); } }
private float FindBlendParameters(Vector3 pos, out ClimateParameters src, out ClimateParameters dst) { if (climateLookup == null) { climateLookup = new ClimateParameters[4] { Arid, Temperate, Tundra, Arctic }; } if (TerrainMeta.BiomeMap == null) { src = Temperate; dst = Temperate; return(0.5f); } int biomeMaxType = TerrainMeta.BiomeMap.GetBiomeMaxType(pos); int biomeMaxType2 = TerrainMeta.BiomeMap.GetBiomeMaxType(pos, ~biomeMaxType); src = climateLookup[TerrainBiome.TypeToIndex(biomeMaxType)]; dst = climateLookup[TerrainBiome.TypeToIndex(biomeMaxType2)]; return(TerrainMeta.BiomeMap.GetBiome(pos, biomeMaxType2)); }
public float FindBlendParameters(Vector3 pos, out T src, out T dst) { if (TerrainMeta.BiomeMap == null) { src = Temperate; dst = Tundra; return(0f); } if (climates == null || climates.Length == 0) { climates = new T[4] { Arid, Temperate, Tundra, Arctic }; } int biomeMaxType = TerrainMeta.BiomeMap.GetBiomeMaxType(pos); int biomeMaxType2 = TerrainMeta.BiomeMap.GetBiomeMaxType(pos, ~biomeMaxType); src = climates[TerrainBiome.TypeToIndex(biomeMaxType)]; dst = climates[TerrainBiome.TypeToIndex(biomeMaxType2)]; return(TerrainMeta.BiomeMap.GetBiome(pos, biomeMaxType2)); }
private void SetBiome(int x, int z, int id, float old_val, float new_val) { int index = TerrainBiome.TypeToIndex(id); if (old_val >= 1f) { return; } float newVal = (1f - new_val) / (1f - old_val); for (int i = 0; i < this.num; i++) { if (i != index) { this.dst[(i * this.res + z) * this.res + x] = BitUtility.Float2Byte(newVal * BitUtility.Byte2Float(this.dst[(i * this.res + z) * this.res + x])); } else { this.dst[(i * this.res + z) * this.res + x] = BitUtility.Float2Byte(new_val); } } }
private void SetBiome(int x, int z, int id, float old_val, float new_val) { int index1 = TerrainBiome.TypeToIndex(id); if ((double)old_val >= 1.0) { return; } float num = (float)((1.0 - (double)new_val) / (1.0 - (double)old_val)); for (int index2 = 0; index2 < this.num; ++index2) { if (index2 == index1) { this.dst[(index2 * this.res + z) * this.res + x] = BitUtility.Float2Byte(new_val); } else { this.dst[(index2 * this.res + z) * this.res + x] = BitUtility.Float2Byte(num * BitUtility.Byte2Float((int)this.dst[(index2 * this.res + z) * this.res + x])); } } }
public void RunNode() { var layer = (NodeVariables.Texture)GetValue(); switch (layer.LandLayer) { case 0: MapManager.PaintRiver(LandLayers.Ground, aboveTerrain, TerrainSplat.TypeToIndex(layer.GroundTexture)); break; case 1: MapManager.PaintRiver(LandLayers.Biome, aboveTerrain, TerrainBiome.TypeToIndex(layer.BiomeTexture)); break; case 2: MapManager.PaintRiver(LandLayers.Alpha, aboveTerrain, layer.AlphaTexture); break; case 3: MapManager.PaintRiver(LandLayers.Topology, aboveTerrain, layer.TopologyTexture, layer.TopologyLayer); break; } }
public void OnGUI() { scrollPos = EditorGUILayout.BeginScrollView(scrollPos, false, false); GUIContent[] mainMenu = new GUIContent[6]; mainMenu[0] = new GUIContent("File"); mainMenu[1] = new GUIContent("Settings"); mainMenu[2] = new GUIContent("Prefabs"); mainMenu[3] = new GUIContent("Layers"); mainMenu[4] = new GUIContent("Generator"); mainMenu[5] = new GUIContent("Advanced"); mainMenuOptions = GUILayout.Toolbar(mainMenuOptions, mainMenu, EditorStyles.toolbarButton); Functions.SaveSettings(); #region Menu switch (mainMenuOptions) { #region File case 0: Functions.EditorIO(); Functions.NewMapOptions(ref mapSize, ref landHeight, ref layers); Functions.MapInfo(); break; #endregion #region Prefabs case 1: Functions.EditorSettings(); Functions.EditorInfo(); Functions.EditorLinks(); break; case 2: Functions.Replacer(ref replacer, ref replacerPresetIndex, ref replacerList); break; #endregion case 3: GUIContent[] layersMenu = new GUIContent[4]; layersMenu[0] = new GUIContent("Ground"); layersMenu[1] = new GUIContent("Biome"); layersMenu[2] = new GUIContent("Alpha"); layersMenu[3] = new GUIContent("Topology"); EditorGUI.BeginChangeCheck(); layerIndex = GUILayout.Toolbar(layerIndex, layersMenu, EditorStyles.toolbarButton); if (EditorGUI.EndChangeCheck()) { Functions.SetLandLayer((LandLayers)layerIndex, TerrainTopology.TypeToIndex((int)layers.Topologies)); } switch (TerrainManager.LandLayer) { case LandLayers.Ground: Functions.TextureSelect((LandLayers)layerIndex, ref layers); Functions.LayerTools(TerrainManager.LandLayer, TerrainSplat.TypeToIndex((int)layers.Ground)); crazing = SettingsManager.crazing; crazing.splatLayer = TerrainTopology.TypeToIndex((int)layers.Ground); Functions.Crazing(ref crazing); perlinSplat = SettingsManager.perlinSplat; perlinSplat.splatLayer = TerrainTopology.TypeToIndex((int)layers.Ground); Functions.PerlinSplat(ref perlinSplat); Functions.HeightTools(TerrainManager.LandLayer, TerrainSplat.TypeToIndex((int)layers.Ground), ref heightsInfo); Functions.SlopeTools(TerrainManager.LandLayer, TerrainSplat.TypeToIndex((int)layers.Ground), ref slopesInfo); Functions.RiverTools(TerrainManager.LandLayer, TerrainSplat.TypeToIndex((int)layers.Ground), ref aboveTerrain); break; case LandLayers.Biome: Functions.TextureSelect((LandLayers)layerIndex, ref layers); Functions.LayerTools(TerrainManager.LandLayer, TerrainBiome.TypeToIndex((int)layers.Biome)); Functions.HeightTools(TerrainManager.LandLayer, TerrainBiome.TypeToIndex((int)layers.Biome), ref heightsInfo); Functions.SlopeTools(TerrainManager.LandLayer, TerrainBiome.TypeToIndex((int)layers.Biome), ref slopesInfo); break; case LandLayers.Alpha: Functions.LayerTools(TerrainManager.LandLayer, 0, 1); break; case LandLayers.Topology: Functions.TopologyTools(); Functions.TopologyLayerSelect(ref layers); Functions.LayerTools(TerrainManager.LandLayer, 0, 1, TerrainTopology.TypeToIndex((int)layers.Topologies)); Functions.HeightTools(TerrainManager.LandLayer, 0, ref heightsInfo, 1, TerrainTopology.TypeToIndex((int)layers.Topologies)); Functions.SlopeTools(TerrainManager.LandLayer, 0, ref slopesInfo, 1, TerrainTopology.TypeToIndex((int)layers.Topologies)); Functions.Combinator(ref layers, ref sourceLayers, ref tttWeight, ref thicc); Functions.RiverTools(TerrainManager.LandLayer, 0, ref aboveTerrain, 1, TerrainTopology.TypeToIndex((int)layers.Topologies)); Functions.LakeOcean(ref layers); break; } switch (mapToolsOptions) { /* #region HeightMap * case 0: * GUIContent[] heightMapMenu = new GUIContent[2]; * heightMapMenu[0] = new GUIContent("Heights"); * heightMapMenu[1] = new GUIContent("Filters"); * heightMapOptions = GUILayout.Toolbar(heightMapOptions, heightMapMenu, EditorStyles.toolbarButton); * * switch (heightMapOptions) * { * case 0: * Elements.BoldLabel(ToolTips.heightsLabel); * Functions.OffsetMap(ref offset, ref clampOffset); * Functions.SetHeight(ref heightSet); * Functions.ClampHeight(ref heightLow, ref heightHigh); * Elements.BoldLabel(ToolTips.miscLabel); * Functions.InvertMap(); * break; * case 1: * Functions.NormaliseMap(ref normaliseLow, ref normaliseHigh, ref autoUpdate); * Functions.SmoothMap(ref filterStrength, ref blurDirection, ref smoothPasses); * Functions.TerraceMap(ref terraceErodeFeatureSize, ref terraceErodeInteriorCornerWeight); * break; * } * break; #endregion * #region Textures * case 0: * Functions.ConditionalPaint(ref conditionalPaintOptions, ref texture, ref conditions, ref layers); * break; #endregion * #region Misc * case 2: * Functions.RotateMap(ref rotateSelection); * break; #endregion */ } break; case 4: GUIContent[] generatorMenu = new GUIContent[3]; generatorMenu[0] = new GUIContent("Heightmap"); generatorMenu[1] = new GUIContent("Geology"); generatorMenu[2] = new GUIContent("Monuments"); generatorOptions = GUILayout.Toolbar(generatorOptions, generatorMenu, EditorStyles.toolbarButton); switch (generatorOptions) { case 0: Functions.SetHeight(ref heightSet); Functions.OffsetMap(ref offset, ref clampOffset); perlin = SettingsManager.perlin; Functions.PerlinTerrain(ref perlin); Functions.NormaliseMap(ref normaliseLow, ref normaliseHigh, ref autoUpdate); ocean = SettingsManager.ocean; Functions.Ocean(ref ocean); ripple = SettingsManager.ripple; Functions.Ripple(ref ripple); terracing = SettingsManager.terracing; Functions.RandomTerracing(ref terracing); break; case 1: Functions.Geology(ref activePreset, ref presetIndex, ref geologyList, ref macroIndex, ref macroList, ref macroTitle, ref macroDisplay, ref layers); break; case 2: city = SettingsManager.city; Functions.RustCity(ref city); break; } break; case 5: Functions.Merger(ref zOffset); break; } #endregion EditorGUILayout.EndScrollView(); }
public static void NewMapOptions(ref int mapSize, ref float landHeight, ref Layers layers, CreateMapWindow window) { mapSize = Elements.ToolbarIntSlider(ToolTips.mapSize, mapSize, 1000, 6000); landHeight = Elements.ToolbarSlider(ToolTips.newMapHeight, landHeight, 0, 1000); Elements.BeginToolbarHorizontal(); Elements.ToolbarLabel(ToolTips.newMapGround); layers.Ground = (TerrainSplat.Enum)Elements.ToolbarEnumPopup(layers.Ground); Elements.EndToolbarHorizontal(); Elements.BeginToolbarHorizontal(); Elements.ToolbarLabel(ToolTips.newMapBiome); layers.Biome = (TerrainBiome.Enum)Elements.ToolbarEnumPopup(layers.Biome); Elements.EndToolbarHorizontal(); Elements.BeginToolbarHorizontal(); if (Elements.ToolbarButton(ToolTips.createMap)) { window.Close(); int newMap = EditorUtility.DisplayDialogComplex("Warning", "Creating a new map will remove any unsaved changes to your map.", "Create New Map", "Close", "Save and Create New Map"); switch (newMap) { case 1: return; case 2: SaveMapPanel(); break; } MapManager.CreateMap(mapSize, TerrainSplat.TypeToIndex((int)layers.Ground), TerrainBiome.TypeToIndex((int)layers.Biome), landHeight); } if (Elements.ToolbarButton(ToolTips.cancel)) { window.Close(); } Elements.EndToolbarHorizontal(); }
void InitializeBiomes(int i) { terrainBiomes[i] = new TerrainBiome(ffSettings, meshFilter[i].sharedMesh); }