Exemplo n.º 1
0
    void OnGUI()
    {
        if (window == null)
        {
            GUILayout.Label("Missing window reference!");
            return;
        }

        EditorGUILayout.BeginVertical("Box");
        IntPow2Field("Noise Texture Size", ref mTexSize);
        mTexPeriod = EditorGUILayout.IntSlider("Noise Texture Period", mTexPeriod, 2, 10);
        EditorGUILayout.EndVertical();

        EditorGUILayout.BeginHorizontal("Box");
        EditorGUILayout.LabelField("Random Seed:", mRandomSeed.ToString());
        if (GUILayout.Button("Random"))
        {
            mRandomSeed = UnityEngine.Random.Range(0.001f, 200000f);
        }
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginVertical("Box");
        mType = (eNoiseType)EditorGUILayout.EnumPopup("Noise Type:", mType);
        mDim  = (eNoiseDim)EditorGUILayout.EnumPopup("Noise Dimension:", mDim);
        EditorGUILayout.EndVertical();

        EditorGUILayout.BeginVertical("Box");
        mFBM = EditorGUILayout.Toggle("Use fBm", mFBM);
        if (mFBM == true)
        {
            mOctaves     = EditorGUILayout.IntSlider("fBm Octaves", mOctaves, 2, 10);
            mPersistence = EditorGUILayout.Slider("fBm Persistence", mPersistence, 0f, 1f);
            mScale       = EditorGUILayout.Slider("fBm Scale", mScale, 1f, 10f);
        }
        EditorGUILayout.EndVertical();

        if (GUILayout.Button("Generate"))
        {
            switch (mDim)
            {
            case eNoiseDim.Dimension2:
                GenerateNoise2D();
                break;

            case eNoiseDim.Dimension3:
                GenerateNoise3D();
                break;
            }
        }
    }
Exemplo n.º 2
0
    void OnGUI()
    {
        if (window == null)
        {
            GUILayout.Label("Missing window reference!");
            return;
        }

        if (noises == null)
        {
            noises = new NoiseModule();
        }

        EditorGUILayout.BeginVertical("Box");
        IntPow2Field("Noise Texture Size", ref mTexSize);
        EditorGUILayout.EndVertical();

        EditorGUILayout.BeginHorizontal("Box");
        EditorGUILayout.LabelField("Random Seed:", mRandomSeed.ToString());
        if (GUILayout.Button("Random"))
        {
            mRandomSeed = UnityEngine.Random.Range(0.001f, 200000f);
        }
        EditorGUILayout.EndHorizontal();

        mDim = (eNoiseDim)EditorGUILayout.EnumPopup("Texture Dimension:", mDim);

        SettingNoise("Curl Noise Setting", noises);

        if (GUILayout.Button("Generate"))
        {
            switch (mDim)
            {
            case eNoiseDim.Dimension2:
                GenerateNoise_2D();
                break;

            case eNoiseDim.Dimension3:
                GenerateNoise_3D();
                break;
            }
        }
    }
Exemplo n.º 3
0
    void OnGUI()
    {
        if (window == null)
        {
            GUILayout.Label("Missing window reference!");
            return;
        }

        if (noises == null)
        {
            noises = new NoiseModule[4];
            for (int i = 0; i < 4; ++i)
            {
                noises[i] = new NoiseModule();
            }
        }

        EditorGUILayout.BeginVertical("Box");
        IntPow2Field("Noise Texture Size", ref mTexSize);
        EditorGUILayout.EndVertical();

        mDim = (eNoiseDim)EditorGUILayout.EnumPopup("Texture Dimension:", mDim);

        SettingNoise("Channel (R)", noises[0]);
        SettingNoise("Channel (G)", noises[1]);
        SettingNoise("Channel (B)", noises[2]);
        SettingNoise("Channel (A)", noises[3]);

        if (GUILayout.Button("Generate"))
        {
            switch (mDim)
            {
            case eNoiseDim.Dimension2:
                GenerateNoise_2D();
                break;

            case eNoiseDim.Dimension3:
                GenerateNoise_3D();
                break;
            }
        }
    }