コード例 #1
0
        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
        }
コード例 #2
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;
        }
コード例 #3
0
    void GraphChangedCallback(PWGraph newGraph)
    {
        if (newGraph == null)
        {
            return;
        }

        terrainManager = new PWGraphTerrainManager(graph);

        settingsBar.onDraw = (rect) =>
        {
            settingsBar.DrawDefault(rect);

            EditorGUI.BeginChangeCheck();

            if (PWGUI.BeginFade("Scaled preview", ref scaledPreviewFoldout, false))
            {
                EditorGUILayout.BeginHorizontal();
                {
                    if (GUILayout.Button("Active", (mainGraph.scaledPreviewEnabled) ? PWStyles.pressedButton : PWStyles.button))
                    {
                        mainGraph.scaledPreviewEnabled        = !mainGraph.scaledPreviewEnabled;
                        PWGUIManager.displaySamplerStepBounds = mainGraph.scaledPreviewEnabled;
                        mainGraph.Process();
                    }
                }
                EditorGUILayout.EndHorizontal();

                mainGraph.scaledPreviewRatio     = EditorGUILayout.Slider("Ratio", mainGraph.scaledPreviewRatio, 1, 128);
                mainGraph.scaledPreviewChunkSize = EditorGUILayout.IntSlider("Chunk size", mainGraph.scaledPreviewChunkSize, 32, 2048);
                float scale = (mainGraph.scaledPreviewRatio * mainGraph.scaledPreviewChunkSize) / (mainGraph.nonModifiedChunkSize * mainGraph.nonModifiedStep);
                EditorGUILayout.LabelField("Scale: " + scale);
            }
            PWGUI.EndFade();

            if (PWGUI.BeginFade("Renderer settings", ref terrainSettingsFoldout, false))
            {
                terrainManager.DrawTerrainSettings(rect, mainGraph.materializerType);
            }
            PWGUI.EndFade();

            /*if (PWGUI.BeginFade("Geological settings", ref geologicalSettingsFoldout, false))
             * {
             *      mainGraph.geologicTerrainStep = graph.PWGUI.Slider("Geological terrain step: ", mainGraph.geologicTerrainStep, 4, 64);
             *      mainGraph.geologicDistanceCheck = graph.PWGUI.IntSlider("Geological search distance: ", mainGraph.geologicDistanceCheck, 1, 4);
             * }
             * PWGUI.EndFade();*/

            if (PWGUI.BeginFade("Chunk settings"))
            {
                //seed
                GUI.SetNextControlName("seed");
                mainGraph.seed = EditorGUILayout.IntField("Seed", mainGraph.seed);

                EditorGUI.BeginDisabledGroup(mainGraph.scaledPreviewEnabled);
                {
                    //chunk size:
                    GUI.SetNextControlName("chunk size");
                    mainGraph.chunkSize = EditorGUILayout.IntField("Chunk size", mainGraph.chunkSize);
                    mainGraph.chunkSize = Mathf.Clamp(mainGraph.chunkSize, 1, 1024);

                    //step:
                    float min = 0.1f;
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.PrefixLabel("step", PWStyles.prefixLabel);
                    mainGraph.step = mainGraph.PWGUI.Slider(mainGraph.step, ref min, ref mainGraph.maxStep, 0.01f, false, true);
                    EditorGUILayout.EndHorizontal();
                }
                EditorGUI.EndDisabledGroup();
            }
            PWGUI.EndFade();

            if (EditorGUI.EndChangeCheck())
            {
                delayedChanges.UpdateValue(graphProcessKey);
            }
        };
    }
コード例 #4
0
        void LoadGUI()
        {
            var settingsPanel = layout.GetPanel <BaseGraphSettingsPanel>();

            settingsPanel.onGUI = (rect) =>
            {
                settingsPanel.DrawDefault(rect);

                EditorGUI.BeginChangeCheck();

                if (PWGUI.BeginFade("Scaled preview", ref scaledPreviewFoldout, false))
                {
                    EditorGUILayout.BeginHorizontal();
                    {
                        if (GUILayout.Button("Active", (worldGraph.scaledPreviewEnabled) ? Styles.pressedButton : Styles.button))
                        {
                            worldGraph.scaledPreviewEnabled = !worldGraph.scaledPreviewEnabled;
                            ProceduralWorldsGUI.displaySamplerStepBounds = !worldGraph.hideChunkLines && worldGraph.scaledPreviewEnabled;
                            worldGraph.Process();
                        }
                    }
                    EditorGUILayout.EndHorizontal();

                    worldGraph.scaledPreviewRatio     = EditorGUILayout.Slider("Ratio", worldGraph.scaledPreviewRatio, 1, 128);
                    worldGraph.scaledPreviewChunkSize = EditorGUILayout.IntSlider("Chunk size", worldGraph.scaledPreviewChunkSize, 32, 2048);
                    worldGraph.hideChunkLines         = EditorGUILayout.Toggle("Hide chunk lines", worldGraph.hideChunkLines);

                    ProceduralWorldsGUI.displaySamplerStepBounds = !worldGraph.hideChunkLines && worldGraph.scaledPreviewEnabled;

                    float scale = (worldGraph.scaledPreviewRatio * worldGraph.scaledPreviewChunkSize) / (worldGraph.nonModifiedChunkSize * worldGraph.nonModifiedStep);
                    EditorGUILayout.LabelField("Scale: " + scale);
                }
                PWGUI.EndFade();

                //Activate this when the geological update will be ready
                                #if false
                if (PWGUI.BeginFade("Geological settings", ref geologicalSettingsFoldout, false))
                {
                    worldGraph.geologicTerrainStep   = graph.PWGUI.Slider("Geological terrain step: ", worldGraph.geologicTerrainStep, 4, 64);
                    worldGraph.geologicDistanceCheck = graph.PWGUI.IntSlider("Geological search distance: ", worldGraph.geologicDistanceCheck, 1, 4);
                }
                PWGUI.EndFade();
                                #endif

                if (PWGUI.BeginFade("Chunk settings", ref chunkSettingsFoldout, false))
                {
                    //seed
                    GUI.SetNextControlName("seed");
                    worldGraph.seed = EditorGUILayout.IntField("Seed", worldGraph.seed);

                    EditorGUI.BeginDisabledGroup(worldGraph.scaledPreviewEnabled);
                    {
                        //chunk size:
                        GUI.SetNextControlName("chunk size");
                        worldGraph.chunkSize = EditorGUILayout.IntField("Chunk size", worldGraph.chunkSize);
                        worldGraph.chunkSize = Mathf.Clamp(worldGraph.chunkSize, 1, 1024);

                        //step:
                        float min = 0.1f;
                        EditorGUILayout.BeginHorizontal();
                        EditorGUILayout.PrefixLabel("step", Styles.prefixLabel);
                        worldGraph.step = PWGUI.Slider(worldGraph.step, ref min, ref worldGraph.maxStep, 0.01f, false, true);
                        EditorGUILayout.EndHorizontal();
                    }
                    EditorGUI.EndDisabledGroup();
                }
                PWGUI.EndFade();

                if (PWGUI.BeginFade("Chunkloader settings", ref chunkLoaderFoldout, false))
                {
                    if (!chunkLoaderDrawer.isEnabled)
                    {
                        chunkLoaderDrawer.OnEnable(worldGraph);
                    }
                    chunkLoaderDrawer.OnGUI(new Rect());
                }
                PWGUI.EndFade();

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