fCraft.Noise.Normalize C# (CSharp) Method

Normalize() public static method

public static Normalize ( float map ) : void
map float
return void
        public static void Normalize( float[,] map )
        {
            Normalize( map, 0, 1 );
        }

Same methods

Noise::Normalize ( float map, float &multiplier, float &constant ) : void
Noise::Normalize ( float ptr, int length, float low, float high ) : void

Usage Example

Example #1
0
        private void GenerateHeightmap()
        {
            ReportProgress(10, "Heightmap: Priming");
            heightmap = new float[args.MapWidth, args.MapLength];

            noise.PerlinNoise(heightmap, args.FeatureScale, args.DetailScale, args.Roughness, 0, 0);

            if (args.UseBias && !args.DelayBias)
            {
                ReportProgress(2, "Heightmap: Biasing");
                Noise.Normalize(heightmap);
                ApplyBias();
            }

            Noise.Normalize(heightmap);

            if (args.LayeredHeightmap)
            {
                ReportProgress(10, "Heightmap: Layering");

                // needs a new Noise object to randomize second map
                float[,] heightmap2 = new float[args.MapWidth, args.MapLength];
                new Noise(rand.Next(), NoiseInterpolationMode.Bicubic).PerlinNoise(heightmap2, 0, args.DetailScale,
                                                                                   args.Roughness, 0, 0);
                Noise.Normalize(heightmap2);

                // make a blendmap
                blendmap = new float[args.MapWidth, args.MapLength];
                int blendmapDetailSize = (int)Math.Log(Math.Max(args.MapWidth, args.MapLength), 2) - 2;
                new Noise(rand.Next(), NoiseInterpolationMode.Cosine).PerlinNoise(blendmap, 3, blendmapDetailSize, 0.5f,
                                                                                  0, 0);
                Noise.Normalize(blendmap);
                float cliffSteepness = Math.Max(args.MapWidth, args.MapLength) / 6f;
                Noise.ScaleAndClip(blendmap, cliffSteepness);

                Noise.Blend(heightmap, heightmap2, blendmap);
            }

            if (args.MarbledHeightmap)
            {
                ReportProgress(1, "Heightmap: Marbling");
                Noise.Marble(heightmap);
            }

            if (args.InvertHeightmap)
            {
                ReportProgress(1, "Heightmap: Inverting");
                Noise.Invert(heightmap);
            }

            if (args.UseBias && args.DelayBias)
            {
                ReportProgress(2, "Heightmap: Biasing");
                Noise.Normalize(heightmap);
                ApplyBias();
            }
            Noise.Normalize(heightmap);
        }
All Usage Examples Of fCraft.Noise::Normalize