private void OnGUI()
    {
        EditorGUILayout.BeginVertical();

        EditorGUILayout.LabelField("Texture Settings", EditorStyles.boldLabel);
        m_resolution = EditorGUILayout.IntField("Texture Resolution", m_resolution);

        EditorGUILayout.Space();
        EditorGUILayout.Space();

        EditorGUILayout.LabelField("Noise Settings", EditorStyles.boldLabel);
        m_noiseMethod    = (NoiseMethodType)EditorGUILayout.EnumPopup("Method", m_noiseMethod);
        m_noiseDimension = (DimensionType)EditorGUILayout.EnumPopup("Dimension", m_noiseDimension);

        if (m_noiseMethod != NoiseMethodType.Simplex)
        {
            m_noiseInterpolate = (InterpolateMethodType)EditorGUILayout.EnumPopup("Interpolate Type", m_noiseInterpolate);
        }

        m_generateNewHash  = EditorGUILayout.Toggle("Generate New Hash", m_generateNewHash);
        m_noiseFrequency   = EditorGUILayout.FloatField("Frequency", m_noiseFrequency);
        m_noiseOctave      = EditorGUILayout.IntField("Octave", m_noiseOctave);
        m_noiseLacunarity  = EditorGUILayout.FloatField("Lacunarity", m_noiseLacunarity);
        m_noisePersistence = EditorGUILayout.FloatField("Persistence", m_noisePersistence);

        OnShowButtons();

        EditorGUILayout.EndVertical();
    }
Beispiel #2
0
    public static float GetValue(Vector3 point, NoiseMethodType noiseMethodType, DimensionType dimension, InterpolateMethodType interpolate, float frequency, int octave, float lacunarity, float persistence)
    {
        float value = 0;

        switch (noiseMethodType)
        {
        case NoiseMethodType.Value:
            value = FractalSum(point, m_valueMethods[(int)dimension], m_interpolateMethods[(int)interpolate], frequency, octave, lacunarity, persistence);
            break;

        case NoiseMethodType.Perlin:
            value = FractalSum(point, m_perlinMethods[(int)dimension], m_interpolateMethods[(int)interpolate], frequency, octave, lacunarity, persistence);
            break;

        case NoiseMethodType.Simplex:
            value = FractalSum(point, m_simplexMethods[(int)dimension], m_interpolateMethods[(int)interpolate], frequency, octave, lacunarity, persistence);
            break;
        }

        return(value);
    }