public override void OnNodeGUI()
		{
			GUILayout.Space(EditorGUIUtility.singleLineHeight);
			outputTexture = EditorGUILayout.ObjectField(outputTexture, typeof(Texture2D), false) as Texture2D;
			EditorGUI.BeginChangeCheck();
			{
				if ((isMaterialOutput = EditorGUILayout.Toggle("material output", isMaterialOutput)))
				{
					if (outputMaterial == null)
						CreateNewMaterial();
					tiling = EditorGUILayout.Vector2Field("tiling", tiling);
					offset = EditorGUILayout.Vector2Field("offset", offset);
	
					UpdateMaterialProperties();
					
					EditorGUI.BeginChangeCheck();
					showSceneHiddenObjects = EditorGUILayout.Toggle("Show scene hidden objects", showSceneHiddenObjects);
					if (EditorGUI.EndChangeCheck())
						matPreview.UpdateShowSceneHiddenObjects(showSceneHiddenObjects);
					
					if ((preview = EditorGUILayout.Foldout(preview, "preview")))
						matPreview.Render();
				}
				else if (outputTexture != null)
					if ((preview = EditorGUILayout.Foldout(preview, "preview")))
						PWGUI.TexturePreview(outputTexture);
			}
			if (EditorGUI.EndChangeCheck())
				UpdateProps();
		}
        public void OnGUI()
        {
            base.OnGUI(new Rect());

            EditorGUIUtility.labelWidth = 90;
            inputData.seed = EditorGUILayout.IntField("Seed", inputData.seed);
            inputData.size = PWGUI.IntSlider("Chunk size: ", inputData.size, 4, 512);
            inputData.step = PWGUI.Slider("Step: ", inputData.step, 0.01f, 16);

            if (PWGUI.BeginFade("Terrain", ref showTerrain, false))
            {
                inputData.maxTerrainHeight = PWGUI.IntSlider("Terrain height: ", inputData.maxTerrainHeight, 0, 1000);
                inputData.octaves          = PWGUI.IntSlider("Noise octaves: ", inputData.octaves, 1, 8);
                inputData.persistance      = PWGUI.Slider("Noise persistance: ", inputData.persistance, 0f, 2f);
                inputData.lacunarity       = PWGUI.Slider("Noise lacunarity: ", inputData.lacunarity, 0f, 2f);
                inputData.isWaterless      = EditorGUILayout.Toggle("Is waterless", inputData.isWaterless);
                if (!inputData.isWaterless)
                {
                    inputData.waterLevel = PWGUI.IntSlider("WaterLevel: ", (int)inputData.waterLevel, 0, 100);
                }
            }
            PWGUI.EndFade();

            //TODO: dummy temperature/wetness generation
        }
Example #3
0
 void UpdateGradient()
 {
     waterGradient = PWUtils.CreateGradient(GradientMode.Fixed,
                                            new KeyValuePair <float, Color>(waterLevel / (mapMax - mapMin), Color.blue),
                                            new KeyValuePair <float, Color>(1, Color.white));
     PWGUI.SetGradientForField(0, waterGradient);
 }
Example #4
0
        public override void OnNodeGUI()
        {
            bool updatePreview = false;

            GUILayout.Space(EditorGUIUtility.singleLineHeight * 1.2f);
            EditorGUI.BeginChangeCheck();
            Rect pos = EditorGUILayout.GetControlRect(false, 100);

            curve = EditorGUI.CurveField(pos, curve);
            if (EditorGUI.EndChangeCheck())
            {
                updatePreview     = true;
                notifyDataChanged = true;
                UpdateTerrain();
                sCurve.SetAnimationCurve(curve);
            }

            if (inputTerrain != null)
            {
                if (inputTerrain.type == SamplerType.Sampler2D)
                {
                    PWGUI.Sampler2DPreview(outputTerrain as Sampler2D, needUpdate || updatePreview);
                }
                else
                {
                }
            }
        }
        new public void OnGUI(Rect view)
        {
            if (b == null)
            {
                EditorGUILayout.LabelField("Null biome data");
                return;
            }

            base.OnGUI(view);

            if (samplerFoldouts == null || samplerFoldouts.Length != b.length)
            {
                samplerFoldouts = new bool[b.length];
            }

            //2D maps:
            int i = 0;

            foreach (var samplerDataKP in b.biomeSamplerNameMap)
            {
                if (!samplerDataKP.Value.is3D)
                {
                    samplerFoldouts[i] = EditorGUILayout.Foldout(samplerFoldouts[i], samplerDataKP.Key);

                    if (samplerFoldouts[i])
                    {
                        PWGUI.Sampler2DPreview(samplerDataKP.Value.data2D);
                    }
                }
                //TODO: 3D maps preview

                i++;
            }
        }
        public override void OnNodeGUI()
        {
            int i = 0;

            EditorGUIUtility.labelWidth = 80;
            materializer = (MaterializerType)EditorGUILayout.EnumPopup("Materializer", materializer);

            EditorGUILayout.LabelField("Output maps in chunk");
            EditorGUIUtility.labelWidth = 66;
            EditorGUILayout.BeginHorizontal();
            foreach (var outputMap in outputMaps)
            {
                i++;
                outputMap.active = EditorGUILayout.Toggle(outputMap.name, outputMap.active);
                if (i % 2 == 0)
                {
                    EditorGUILayout.EndHorizontal();
                    EditorGUILayout.BeginHorizontal();
                }
            }
            EditorGUILayout.EndHorizontal();

            if (terrainOutput.albedoMaps != null)
            {
                PWGUI.Texture2DArrayPreview(terrainOutput.albedoMaps, needUpdate);
            }
        }
Example #7
0
        public override void OnNodeGUI()
        {
            GUILayout.Space(EditorGUIUtility.singleLineHeight * 2 + 4);
            outputTexture = EditorGUILayout.ObjectField(outputTexture, typeof(Texture2D), false) as Texture2D;
            EditorGUI.BeginChangeCheck();
            {
                if ((isMaterialOutput = EditorGUILayout.Toggle("material output", isMaterialOutput)))
                {
                    if (outputMaterial == null)
                    {
                        CreateNewMaterial();
                    }
                    tiling = EditorGUILayout.Vector2Field("tiling", tiling);
                    offset = EditorGUILayout.Vector2Field("offset", offset);

                    UpdateMaterialProperties();

                    if ((preview = EditorGUILayout.Foldout(preview, "preview")))
                    {
                        matPreview.Render(outputMaterial);
                    }
                }
                else if (outputTexture != null)
                {
                    if ((preview = EditorGUILayout.Foldout(preview, "preview")))
                    {
                        PWGUI.TexturePreview(outputTexture);
                    }
                }
            }
            if (EditorGUI.EndChangeCheck())
            {
                UpdateProps();
            }
        }
Example #8
0
        public override void OnNodeGUI()
        {
            GUILayout.Space(14);

            EditorGUILayout.LabelField("Biome: " + inputBiome);

            PWGUI.PWArrayField(inputValues);
        }
Example #9
0
        public override void OnNodeGUI()
        {
            PWGUI.SpaceSkipAnchors();

            EditorGUILayout.LabelField("Biome: " + node.inputBiome);

            PWGUI.PWArrayField(node.inputValues);
        }
        public override void OnNodeGUI()
        {
            //write here the process which take inputs, transform them and set outputs.

            PWGUI.SpaceSkipAnchors();

            PWGUI.PWArrayField(node.inputValues);
        }
        public override void OnNodeGUI()
        {
            if (node.obj != null)
            {
                if (!firstRender && e.type != EventType.Layout)
                {
                    return;
                }

                firstRender = true;

                Type objType = node.obj.GetType();
                EditorGUILayout.LabelField(node.obj.ToString());
                if (objType.IsGenericType && objType.GetGenericTypeDefinition() == typeof(PWArray <>))
                {
                    var pwv = node.obj as PWArray <object>;

                    for (int i = 0; i < pwv.Count; i++)
                    {
                        EditorGUILayout.BeginHorizontal();
                        EditorGUILayout.LabelField("[" + i + "] " + pwv.NameAt(i) + ": " + pwv.At(i), GUILayout.Width(300));
                        EditorGUILayout.EndHorizontal();
                    }
                }
                else if (objType == typeof(Vector2))
                {
                    EditorGUILayout.Vector2Field("vec2", (Vector2)node.obj);
                }
                else if (objType == typeof(Vector3))
                {
                    EditorGUILayout.Vector2Field("vec3", (Vector3)node.obj);
                }
                else if (objType == typeof(Vector4))
                {
                    EditorGUILayout.Vector2Field("vec4", (Vector4)node.obj);
                }
                else if (objType == typeof(Sampler2D))
                {
                    PWGUI.Sampler2DPreview(node.obj as Sampler2D);
                }
                else if (objType == typeof(Sampler3D))
                {
                    //TODO: 3D sampler preview
                }
                else if (objType == typeof(BiomeData))
                {
                    if (!biomeDataDrawer.isEnabled)
                    {
                        biomeDataDrawer.OnEnable(node.obj as BiomeData);
                    }
                    biomeDataDrawer.OnGUI(rect);
                }
            }
            else
            {
                EditorGUILayout.LabelField("null");
            }
        }
Example #12
0
        void UpdateGradient()
        {
            waterGradient = Utils.CreateGradient(GradientMode.Fixed,
                                                 new KeyValuePair <float, Color>(node.waterLevel / (node.mapMax - node.mapMin), Color.blue),
                                                 new KeyValuePair <float, Color>(1, Color.white));
            PWGUI.SetGradientForField(PWGUIFieldType.Sampler2DPreview, 0, waterGradient);

            updateWaterPreview = true;
        }
        public override void OnNodeGUI()
        {
            EditorGUILayout.LabelField("MAP:");

            if (chunkSizeHasChanged)
            {
                texture = new Sampler2D(chunkSize, step);
            }

            PWGUI.Sampler2DPreview("perlinControlName", texture, needUpdate);
        }
Example #14
0
        public override void OnNodeGUI()
        {
            PWGUI.SpaceSkipAnchors();

            EditorGUI.BeginChangeCheck();
            {
                node.terrainHeightMultiplier = PWGUI.Slider("height multiplier: ", node.terrainHeightMultiplier, -1, 1);
                node.waterMultiplier         = PWGUI.Slider("water multiplier: ", node.waterMultiplier, -1, 1);

                EditorGUILayout.LabelField("temperature limits:");
                EditorGUILayout.BeginHorizontal();
                {
                    EditorGUIUtility.labelWidth = 25;
                    node.minTemperature         = EditorGUILayout.FloatField("from", node.minTemperature);
                    node.maxTemperature         = EditorGUILayout.FloatField("to", node.maxTemperature);
                }
                EditorGUILayout.EndHorizontal();
                EditorGUIUtility.labelWidth = 120;
                if (node.internalTemperatureMap)
                {
                    node.averageTemperature = EditorGUILayout.FloatField("average temperature", node.averageTemperature);
                }
                else
                {
                    EditorGUILayout.LabelField("Input temperature map range");
                    using (DefaultGUISkin.Get())
                        EditorGUILayout.MinMaxSlider(ref node.minTemperatureMapInput, ref node.maxTemperatureMapInput, node.minTemperature, node.maxTemperature);
                    EditorGUILayout.BeginHorizontal();
                    EditorGUIUtility.labelWidth = 25;
                    node.minTemperatureMapInput = EditorGUILayout.FloatField("Min", node.minTemperatureMapInput);
                    node.maxTemperatureMapInput = EditorGUILayout.FloatField("Max", node.maxTemperatureMapInput);
                    EditorGUILayout.EndHorizontal();
                }
            }
            if (EditorGUI.EndChangeCheck())
            {
                node.UpdateTemperatureMap();
                PWGUI.SetUpdateForField(PWGUIFieldType.Sampler2DPreview, 0, true);
                delayedChanges.UpdateValue(graphReloadKey);
            }

            if (node.localTemperatureMap != null)
            {
                PWGUI.Sampler2DPreview(node.localTemperatureMap as Sampler2D, false, FilterMode.Point);
            }

            if (!guiInitialized)
            {
                PWGUI.SetGradientForField(PWGUIFieldType.Sampler2DPreview, 0, temperatureGradient);
                PWGUI.SetDebugForField(PWGUIFieldType.Sampler2DPreview, 0, true);
                guiInitialized = true;
            }
        }
Example #15
0
		public override void OnNodeGUI()
		{
			EditorGUI.BeginChangeCheck();
			{
				PWGUI.Slider("Persistance: ", ref persistance, ref persistanceMin, ref persistanceMax);
				PWGUI.IntSlider("Octaves: ", ref octaves, 0, 16);
			}
			if (EditorGUI.EndChangeCheck())
				notifyDataChanged = true;

			PWGUI.Sampler2DPreview(output, needUpdate);
		}
Example #16
0
        public override void OnNodeGUI()
        {
            GUILayout.Space(EditorGUIUtility.singleLineHeight * 1.2f);
            EditorGUI.BeginChangeCheck();
            Rect pos = EditorGUILayout.GetControlRect(false, 100);

            curve = EditorGUI.CurveField(pos, curve);
            if (EditorGUI.EndChangeCheck())
            {
                delayedChanges.UpdateValue(notifyKey);
            }

            PWGUI.SamplerPreview(outputTerrain);
        }
        public override void OnNodeGUI()
        {
            GUILayout.Space(14);

            PWGUI.PWArrayField(node.outputValues);

            EditorGUI.BeginChangeCheck();
            {
                EditorGUIUtility.labelWidth = 90;
                node.inputDataMode          = (NodeBiomeGraphInput.BiomeDataInputMode)EditorGUILayout.EnumPopup("Input data mode", node.inputDataMode);

                EditorGUILayout.BeginVertical(Styles.box);
                {
                    if (node.inputDataMode == NodeBiomeGraphInput.BiomeDataInputMode.WorldGraph)
                    {
                        EditorGUILayout.LabelField("Preview graph");
                        node.previewGraph = EditorGUILayout.ObjectField(node.previewGraph, typeof(WorldGraph), false) as WorldGraph;

                        if (node.previewGraph == null)
                        {
                            EditorGUILayout.HelpBox("Can't process the graph without a preview graph ", MessageType.Error);
                        }
                    }
                    else
                    {
                        if (!biomeDataInputDrawer.isEnabled)
                        {
                            biomeDataInputDrawer.OnEnable(node.inputDataGenerator);
                        }
                        biomeDataInputDrawer.OnGUI();
                    }
                }
                EditorGUILayout.EndVertical();

                if (node.outputPartialBiome != null)
                {
                    if (!biomeDataDrawer.isEnabled)
                    {
                        biomeDataDrawer.OnEnable(node.outputPartialBiome);
                    }
                    biomeDataDrawer.OnGUI(rect);
                }
            }
            if (EditorGUI.EndChangeCheck())
            {
                delayedChanges.UpdateValue(updateInputKey);
            }

            node.calls = 0;
        }
Example #18
0
        public override void OnNodeGUI()
        {
            bool updateWaterPreview = false;

            GUILayout.Space(GUI.skin.label.lineHeight * 2f);

            if (outputBiome != null)
            {
                // BiomeUtils.DrawBiomeInfos(outputBiome);
                // EditorGUILayout.Separator();
            }

            EditorGUIUtility.labelWidth = 100;

            EditorGUI.BeginChangeCheck();
            waterLevel = EditorGUILayout.FloatField("WaterLevel", waterLevel);
            if (EditorGUI.EndChangeCheck())
            {
                delayedChanges.UpdateValue(delayedUpdateKey);
                updateWaterPreview = true;
            }

            EditorGUI.BeginChangeCheck();
            {
                if (terrainNoise != null)
                {
                    if (terrainNoise.type == SamplerType.Sampler2D)
                    {
                        EditorGUILayout.LabelField("Map terrain values:");
                        EditorGUILayout.BeginHorizontal();
                        EditorGUIUtility.labelWidth = 30;
                        mapMin = EditorGUILayout.FloatField("from", mapMin);
                        mapMax = EditorGUILayout.FloatField("to", mapMax);
                        EditorGUILayout.EndHorizontal();

                        PWGUI.Sampler2DPreview(terrainNoise as Sampler2D, false, FilterMode.Point);
                    }
                    else
                    {
                        EditorGUILayout.LabelField("TODO: water level 3D");
                    }
                    if (waterGradient == null || EditorGUI.EndChangeCheck() || updateWaterPreview)
                    {
                        UpdateGradient();
                        delayedChanges.UpdateValue(delayedUpdateKey);
                    }
                }
            }
        }
        public override void OnNodeGUI()
        {
            var       biomes    = inputBiomes.GetValues <Biome>();
            BiomeData biomeData = null;

            if (biomes.Count == 0 || biomes.First() == null)
            {
                EditorGUILayout.LabelField("biomes not connected !");
            }
            else
            {
                biomeData = biomes.First().biomeDataReference;
                EditorGUIUtility.labelWidth = 120;
                maxBiomeBlendCount          = EditorGUILayout.IntField("max blended biomes", maxBiomeBlendCount);
            }

            if (biomeData != null)
            {
                if ((biomePreviewFoldout = EditorGUILayout.Foldout(biomePreviewFoldout, "Biome id map")))
                {
                    if (biomeData.biomeIds != null)
                    {
                        PWGUI.BiomeMap2DPreview(biomeData, needUpdate || forceReload || biomeReloadRequested);
                    }
                    //TODO: biome 3D preview
                }
            }
            else
            {
                EditorGUILayout.LabelField("no biome data");
            }

            if (biomeCoverageRecap = EditorGUILayout.Foldout(biomeCoverageRecap, "Biome coverage recap"))
            {
                foreach (var biomeCoverageKP in biomeData.biomeTree.GetBiomeCoverage())
                {
                    if (biomeCoverageKP.Value > 0)
                    {
                        EditorGUILayout.LabelField(biomeCoverageKP.Key.ToString(), (biomeCoverageKP.Value * 100).ToString("F2") + "%");
                    }
                }
                //TODO: exloit the biome switch tree datas
            }

            if (outputBlendedBiomeTerrain.terrainTextureArray == null || forceReload || GetReloadRequestType() == typeof(PWNodeBiomeSurface))
            {
                LoadBiomeTexture2DArray(biomeData, false);
            }
        }
Example #20
0
        public override void OnNodeGUI()
        {
            PWGUI.SpaceSkipAnchors();

            EditorGUI.BeginChangeCheck();
            {
                Rect pos = EditorGUILayout.GetControlRect(false, 100);
                node.curve = EditorGUI.CurveField(pos, node.curve);
            }
            if (EditorGUI.EndChangeCheck())
            {
                delayedChanges.UpdateValue(notifyKey);
            }

            PWGUI.SamplerPreview(node.outputTerrain);
        }
Example #21
0
        public override void OnNodeGUI()
        {
            GUILayout.Space(GUI.skin.label.lineHeight * 3);

            EditorGUI.BeginChangeCheck();
            {
                terrainHeightMultiplier = PWGUI.Slider("height multiplier: ", terrainHeightMultiplier, -1, 1);
                waterMultiplier         = PWGUI.Slider("water multiplier: ", waterMultiplier, -1, 1);

                EditorGUILayout.LabelField("temperature limits:");
                EditorGUILayout.BeginHorizontal();
                {
                    EditorGUIUtility.labelWidth = 30;
                    minTemperature = EditorGUILayout.FloatField("from", minTemperature);
                    maxTemperature = EditorGUILayout.FloatField("to", maxTemperature);
                }
                EditorGUILayout.EndHorizontal();
                EditorGUIUtility.labelWidth = 120;
                if (internalTemperatureMap)
                {
                    averageTemperature = EditorGUILayout.FloatField("average temperature", averageTemperature);
                }
                else
                {
                    EditorGUILayout.LabelField("Input temperature map range");
                    using (DefaultGUISkin.Get())
                        EditorGUILayout.MinMaxSlider(ref minTemperatureMapInput, ref maxTemperatureMapInput, minTemperature, maxTemperature);
                }
            }
            if (EditorGUI.EndChangeCheck())
            {
                UpdateTemperatureMap();
            }

            if (localTemperatureMap != null)
            {
                PWGUI.Sampler2DPreview(localTemperatureMap as Sampler2D, false, FilterMode.Point);
                PWGUI.SetGradientForField(2, temperatureGradient);
                PWGUI.SetDebugForField(2, true);
            }

            if (updateTemperatureMap)
            {
                PWGUI.SetUpdateForField(2, true);
                updateTemperatureMap = false;
            }
        }
Example #22
0
        public override void OnNodeGUI()
        {
            EditorGUIUtility.labelWidth = 40;
            EditorGUI.BeginChangeCheck();
            {
                persistance    = PWGUI.Slider("Persistance: ", persistance, ref persistanceMin, ref persistanceMax);
                octaves        = PWGUI.IntSlider("Octaves: ", octaves, 0, 16);
                scale          = PWGUI.Slider("Scale: ", scale, 0.01f, 10);
                additionalSeed = EditorGUILayout.IntField("Seed", additionalSeed);
            }
            if (EditorGUI.EndChangeCheck())
            {
                delayedChanges.UpdateValue(noiseSettingsChangedKey);
            }

            PWGUI.Sampler2DPreview(output);
        }
Example #23
0
        public override void OnNodeGUI()
        {
            PWGUI.SpaceSkipAnchors();

            EditorGUIUtility.labelWidth = 100;

            EditorGUI.BeginChangeCheck();
            {
                node.waterLevel = EditorGUILayout.FloatField("WaterLevel", node.waterLevel);
            }
            if (EditorGUI.EndChangeCheck())
            {
                delayedChanges.UpdateValue(delayedUpdateKey);
                updateWaterPreview = true;
            }

            if (node.terrainNoise != null)
            {
                EditorGUI.BeginChangeCheck();
                {
                    if (node.terrainNoise.type == SamplerType.Sampler2D)
                    {
                        EditorGUILayout.LabelField("Map terrain values:");
                        EditorGUILayout.BeginHorizontal();
                        EditorGUIUtility.labelWidth = 30;
                        node.mapMin = EditorGUILayout.FloatField("from", node.mapMin);
                        node.mapMax = EditorGUILayout.FloatField("to", node.mapMax);
                        EditorGUILayout.EndHorizontal();

                        PWGUI.Sampler2DPreview(node.terrainNoise as Sampler2D, false, FilterMode.Point);
                    }
                    else
                    {
                        EditorGUILayout.LabelField("TODO: water level 3D");
                    }
                    if (waterGradient == null || EditorGUI.EndChangeCheck() || updateWaterPreview)
                    {
                        UpdateGradient();
                        delayedChanges.UpdateValue(delayedUpdateKey);
                        updateWaterPreview = false;
                    }
                }
            }
        }
Example #24
0
        public override void OnNodeGUI()
        {
            EditorGUIUtility.labelWidth = 40;
            EditorGUI.BeginChangeCheck();
            {
                node.persistence    = PWGUI.Slider("persistence: ", node.persistence, ref node.persistenceMin, ref node.persistenceMax);
                node.lacunarity     = PWGUI.Slider("Lacunarity: ", node.lacunarity, 0.1f, 5);
                node.octaves        = PWGUI.IntSlider("Octaves: ", node.octaves, 0, 16);
                node.scale          = PWGUI.Slider("Scale: ", node.scale, 0.01f, 10);
                node.additionalSeed = EditorGUILayout.IntField("Seed", node.additionalSeed);
            }
            if (EditorGUI.EndChangeCheck())
            {
                node.perlin2D.UpdateParams(node.GetSeed(), node.scale, node.octaves, node.persistence, node.lacunarity);
                delayedChanges.UpdateValue(noiseSettingsChangedKey);
            }

            PWGUI.Sampler2DPreview(node.output);
        }
Example #25
0
        public override void OnNodeGUI()
        {
            Sampler finalTerrain = null;

            PWGUI.SpaceSkipAnchors();

            if (node.mergedBiomeTerrain != null && node.mergedBiomeTerrain.mergedTerrain != null)
            {
                finalTerrain = node.mergedBiomeTerrain.mergedTerrain;
            }

            EditorGUIUtility.labelWidth = 80;
            EditorGUI.BeginChangeCheck();
            node.materializerType = (MaterializerType)EditorGUILayout.EnumPopup("Materializer", node.materializerType);
            if (EditorGUI.EndChangeCheck())
            {
                TerrainPreviewManager.instance.UpdateTerrainMaterializer(node.materializerType);
            }

            if (finalTerrain == null)
            {
                EditorGUILayout.LabelField("Null terrain");
                return;
            }

            if (!ValidateBlendedTerrainIntegrity())
            {
                EditorGUILayout.HelpBox("Null data found in the input blended biomes datas", MessageType.Error);
            }

            PWGUI.SamplerPreview("Final merged terrain", finalTerrain);

            node.biomeTerrainsFoldout = EditorGUILayout.Foldout(node.biomeTerrainsFoldout, "Show biome terrains");

            if (node.biomeTerrainsFoldout)
            {
                foreach (var biome in node.inputBlendedTerrain.biomes)
                {
                    PWGUI.SamplerPreview(biome.name, biome.modifiedTerrain);
                }
            }
        }
Example #26
0
        public override void OnNodeGUI()
        {
            GUILayout.Space(14);

            PWGUI.PWArrayField(outputValues);

            EditorGUILayout.LabelField("Preview graph");
            previewGraph = EditorGUILayout.ObjectField(previewGraph, typeof(PWMainGraph), false) as PWMainGraph;

            if (previewGraph == null)
            {
                EditorGUILayout.HelpBox("Can't process the graph without a preview graph ", MessageType.Error);
            }

            if (outputPartialBiome != null)
            {
                BiomeUtils.DrawBiomeInfos(rect, outputPartialBiome.biomeDataReference);
            }

            calls = 0;
        }
Example #27
0
        public override void OnNodeGUI()
        {
            node.UpdateSurfaceType(biomeGraphRef.surfaceType);

            EditorGUI.BeginChangeCheck();

            var outputSwitch = node.outputSwitch;

            if (PWGUI.BeginFade("Height limit", Styles.box, ref outputSwitch.heightEnabled))
            {
                EditorGUIUtility.labelWidth = 60;
                outputSwitch.minHeight      = EditorGUILayout.FloatField("From", outputSwitch.minHeight);
                outputSwitch.maxHeight      = EditorGUILayout.FloatField("To", outputSwitch.maxHeight);
                EditorGUIUtility.labelWidth = 0;
            }
            PWGUI.EndFade();
            if (PWGUI.BeginFade("Slope limit", Styles.box, ref outputSwitch.slopeEnabled))
            {
                PWGUI.MinMaxSlope(0, 90, ref outputSwitch.minSlope, ref outputSwitch.maxSlope);
            }
            PWGUI.EndFade();
            if (PWGUI.BeginFade("Param limit", Styles.box, ref outputSwitch.paramEnabled))
            {
                //TODO: modular input from BiomeSamplerName
                // outputSwitch.paramType = (BiomeSwitchMode)EditorGUILayout.EnumPopup(outputSwitch.paramType);
                EditorGUIUtility.labelWidth = 60;
                outputSwitch.minParam       = EditorGUILayout.FloatField("Min", outputSwitch.minParam);
                outputSwitch.maxParam       = EditorGUILayout.FloatField("Max", outputSwitch.maxParam);
                EditorGUIUtility.labelWidth = 0;
            }
            PWGUI.EndFade();

            if (EditorGUI.EndChangeCheck())
            {
                delayedChanges.UpdateValue(biomeSurfaceSwitchKey);
            }

            outputSwitch.surface.type = biomeGraphRef.surfaceType;
            outputSwitch.details      = node.inputDetails;
        }
        public override void OnNodeGUI()
        {
            if (node.samp == null)
            {
                EditorGUILayout.LabelField("Null input noise (Sampler2D)");
                return;
            }

            EditorGUIUtility.labelWidth = 70;
            EditorGUI.BeginChangeCheck();
            {
                node.blur   = EditorGUILayout.Slider("blur", node.blur, 0, 1);
                node.radius = EditorGUILayout.Slider("radius", node.radius, 0, 1);
            }
            if (EditorGUI.EndChangeCheck())
            {
                node.CreateNoiseMask();
                NotifyReload();
            }

            PWGUI.Sampler2DPreview(node.output);
        }
        public override void OnNodeGUI()
        {
            fieldUpdate = false;

            GUILayout.Space(GUI.skin.label.lineHeight * 3);

            EditorGUI.BeginChangeCheck();
            PWGUI.Slider("height multiplier: ", ref terrainHeightMultiplier, -1, 1);
            PWGUI.Slider(new GUIContent("water multiplier: "), ref waterMultiplier, -1, 1);

            EditorGUILayout.LabelField("temperature limits:");
            EditorGUILayout.BeginHorizontal();
            EditorGUIUtility.labelWidth = 30;
            minTemperature = EditorGUILayout.FloatField("from", minTemperature);
            maxTemperature = EditorGUILayout.FloatField("to", maxTemperature);
            EditorGUILayout.EndHorizontal();
            EditorGUIUtility.labelWidth = 120;
            averageTemperature          = EditorGUILayout.FloatField("average temperature", averageTemperature);
            if (EditorGUI.EndChangeCheck())
            {
                fieldUpdate = true;
            }

            if (fieldUpdate)
            {
                UpdateTemperatureMap();
            }

            PWGUI.Sampler2DPreview(temperatureMap as Sampler2D, needUpdate, false, FilterMode.Point);

            if (fieldUpdate)
            {
                PWGUI.SetGradientForField(2, temperatureGradient);
                PWGUI.SetDebugForField(2, true);
            }

            //TODO: temperature map creation options
        }
        public void OnGUI(BiomeData biomeData)
        {
            base.OnGUI(new Rect());

            if (biomeRepartitionPreview == null)
            {
                biomeRepartitionPreview = new Texture2D(previewTextureWidth, 1);
                UpdateBiomeRepartitionPreview(biomeData);
            }

            using (DefaultGUISkin.Get())
            {
                reorderableSwitchDataList.DoLayoutList();
            }

            EditorGUILayout.LabelField("repartition map: (" + localCoveragePercent.ToString("F1") + "%)");
            Rect previewRect = EditorGUILayout.GetControlRect(GUILayout.ExpandWidth(true), GUILayout.Height(0));

            previewRect.height = previewTextureHeight;
            GUILayout.Space(previewTextureHeight);

            PWGUI.TexturePreview(previewRect, biomeRepartitionPreview, false);
            PWGUI.SetScaleModeForField(PWGUIFieldType.Sampler2DPreview, -1, ScaleMode.StretchToFill);
        }