Exemplo n.º 1
0
        protected void InitializeTribeNoise()
        {
            float layerWeight = NoisePool.NoiseLayerInitialWeight(config.noiseLayers);

            tribeNoise = new float[width * height];

            for (int layer = 1; layer <= config.noiseLayers; layer++)
            {
                float scale  = config.noiseScale * layer * layer;
                float weight = layerWeight * Mathf.Pow(.25f, layer - 1);

                float[] layered;
                float   seed = pool.Next() * 1000;

                layered = NoisePool.Cellular(width, height, scale, seed);

                for (int i = 0; i < noises.Length; i++)
                {
                    tribeNoise[i] += layered[i] * weight;
                }
            }
        }
Exemplo n.º 2
0
        protected void InitializeNoise()
        {
            noises = new float[width * height];

            float layerWeight = NoisePool.NoiseLayerInitialWeight(config.noiseLayers);

            for (int layer = 1; layer <= config.noiseLayers; layer++)
            {
                float scale  = config.noiseScale * layer * layer;
                float weight = layerWeight * Mathf.Pow(.25f, layer - 1);

                float[] layered;
                float   seed = pool.Next() * 1000;

                switch (config.noiseType)
                {
                case NoiseType.Perlin:
                    layered = NoisePool.Perlin(width, height, scale, seed);
                    break;

                case NoiseType.Simplex:
                    layered = NoisePool.Simplex(width, height, scale, seed);
                    break;

                case NoiseType.Cellular:
                    layered = NoisePool.Cellular(width, height, scale, seed);
                    break;

                default:
                    layered = NoisePool.Perlin(width, height, scale, seed);
                    break;
                }

                for (int i = 0; i < noises.Length; i++)
                {
                    noises[i] += layered[i] * weight;
                }
            }
        }