Exemplo n.º 1
0
    private void ShowPerlinNoise(ExtendedTerrain terrain)
    {
        if (_showPerlinNoise)
        {
            EditorGUILayout.LabelField(string.Empty, GUI.skin.horizontalSlider);
            GUILayout.Label("Perlin Noise 2D", EditorStyles.boldLabel);
            EditorGUILayout.Slider(PerlinScaleX, 0, 1, new GUIContent("X Scale"));
            EditorGUILayout.Slider(PerlinScaleY, 0, 1, new GUIContent("Y Scale"));
            EditorGUILayout.IntSlider(PerlinOffsetX, 0, 1000, new GUIContent("X Offset"));
            EditorGUILayout.IntSlider(PerlinOffsetY, 0, 1000, new GUIContent("Y Offset"));
            EditorGUILayout.IntSlider(PerlinOctaves, 1, 10, new GUIContent("Octaves"));
            EditorGUILayout.Slider(PerlinPersistance, 0.1f, 10, new GUIContent("Persistance"));
            EditorGUILayout.Slider(PerlinHeightScale, 0, 1, new GUIContent("Height Scale"));

            //if (GUILayout.Button("Process Perlin Noise"))
            //{
            //	terrain.PerlinNoise2D();
            //}

            if (GUILayout.Button("Process Improved Perlin Noise"))
            {
                terrain.ImprovetPerlinNoise();
            }

            if (GUILayout.Button("Process Fractal Brownian Motion"))
            {
                terrain.FractalBrownianMotion();
            }
        }
    }
Exemplo n.º 2
0
 private void ShowReset(ExtendedTerrain terrain)
 {
     EditorGUILayout.LabelField(string.Empty, GUI.skin.horizontalSlider);
     if (GUILayout.Button("Reset"))
     {
         terrain.ResetTerrain();
     }
 }
Exemplo n.º 3
0
 private void ShowDiamondSquare(ExtendedTerrain terrain)
 {
     if (_showDiamondSquare)
     {
         EditorGUILayout.LabelField(string.Empty, GUI.skin.horizontalSlider);
         if (GUILayout.Button("Process"))
         {
             terrain.DiamondSquare();
         }
     }
 }
Exemplo n.º 4
0
    private void ShowRandom(ExtendedTerrain terrain)
    {
        if (_showRandom)
        {
            EditorGUILayout.LabelField(string.Empty, GUI.skin.horizontalSlider);
            GUILayout.Label("Set Heights", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(TerrainHeightRange);

            if (GUILayout.Button("Process"))
            {
                terrain.RandomTerrain();
            }
        }
    }
Exemplo n.º 5
0
    private void ShowHeightMapLoader(ExtendedTerrain terrain)
    {
        if (_showLoadHeightMap)
        {
            EditorGUILayout.LabelField(string.Empty, GUI.skin.horizontalSlider);
            GUILayout.Label("Load heightmap", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(HeightMapImage);
            EditorGUILayout.PropertyField(HeightMapScale);

            if (GUILayout.Button("Load"))
            {
                terrain.LoadMapFromFile();
            }
        }
    }
Exemplo n.º 6
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();
        ExtendedTerrain terrain = (ExtendedTerrain)target;

        FoldoutUpdate();

        ShowRandom(terrain);
        ShowPerlinNoise(terrain);
        ShowVoronoiTessellation(terrain);
        ShowDiamondSquare(terrain);
        //ShowHeightMapLoader(terrain);

        ShowReset(terrain);

        serializedObject.ApplyModifiedProperties();
    }
Exemplo n.º 7
0
    private void ShowVoronoiTessellation(ExtendedTerrain terrain)
    {
        if (_showVoronoiTessellation)
        {
            EditorGUILayout.LabelField(string.Empty, GUI.skin.horizontalSlider);
            GUILayout.Label("Voronoi Tessellation", EditorStyles.boldLabel);

            EditorGUILayout.IntSlider(VoronoiPeakCount, 1, 10, new GUIContent("Peak Count"));
            EditorGUILayout.Slider(VoronoiFalloff, 0, 10, new GUIContent("Falloff"));
            EditorGUILayout.Slider(VoronoiDropoff, 0, 10, new GUIContent("Dropoff"));
            EditorGUILayout.Slider(VoronoiMinHeight, 0, 1, new GUIContent("Min Height"));
            EditorGUILayout.Slider(VoronoiMaxHeight, 0, 1, new GUIContent("Max Height"));

            if (GUILayout.Button("Process"))
            {
                terrain.OwnVoronoiTesselation();
            }
        }
    }