예제 #1
0
        public void Generate(clsHeightmap Source, int Inflations, double NoiseFactor, double HeightMultiplier)
        {
            var Temp = new clsHeightmap();
            var A    = 0;

            if (Inflations >= 1)
            {
                Temp.Inflate(Source, NoiseFactor, HeightMultiplier, 1);
                HeightData      = Temp.HeightData;
                Temp.HeightData = new clsHeightData();
                for (A = 2; A <= Inflations; A++)
                {
                    Temp.Inflate(this, NoiseFactor, HeightMultiplier, A);
                    HeightData      = Temp.HeightData;
                    Temp.HeightData = new clsHeightData();
                }
            }
            else if (Inflations == 0)
            {
                Copy(Source);
            }
            else
            {
            }
        }
예제 #2
0
        public void GenerateNew(int SizeY, int SizeX, int Inflations, double NoiseFactor, double HeightMultiplier)
        {
            var Temp = new clsHeightmap();

            Blank(SizeY, SizeX);
            Randomize(HeightMultiplier / HeightScale);
            Temp.HeightScale = HeightScale;
            Temp.Generate(this, Inflations, NoiseFactor, HeightMultiplier / HeightScale);
            HeightData = Temp.HeightData; //steal the temporary heightmap's data
        }
예제 #3
0
        public void GenerateNewOfSize(int Final_SizeY, int Final_SizeX, float Scale, double HeightMultiplier)
        {
            var    Inflations = 0;
            var    SizeY      = 0;
            var    SizeX      = 0;
            double Log2       = 0;
            var    intTemp    = 0;
            var    hmTemp     = new clsHeightmap();
            double Ratio      = 0;

            Log2 = Math.Log(2.0D);
            if (Final_SizeX > Final_SizeY)
            {
                Inflations = Math.Ceiling(Math.Log(Final_SizeX - 1) / Log2).ToInt();
            }
            else
            {
                Inflations = Math.Ceiling(Math.Log(Final_SizeY - 1) / Log2).ToInt();
            }
            Inflations = Math.Ceiling(Scale).ToInt();
            if (Inflations < 0)
            {
                Debugger.Break();
            }
            Ratio   = Math.Pow(2.0D, (Scale - Inflations));
            intTemp = Math.Pow(2.0D, Inflations).ToInt();
            SizeX   = Math.Ceiling((Final_SizeX / Ratio - 1) / intTemp).ToInt() + 1;
            SizeY   = Math.Ceiling((Final_SizeY / Ratio - 1) / intTemp).ToInt() + 1;

            GenerateNew(SizeY, SizeX, Inflations, 1.0D, HeightMultiplier);
            if (Inflations > Scale)
            {
                hmTemp.Stretch(this, (HeightData.SizeX * Ratio).ToInt(), (HeightData.SizeY * Ratio).ToInt());
                HeightData        = hmTemp.HeightData;
                hmTemp.HeightData = new clsHeightData();
            }
            if (HeightData.SizeX != Final_SizeX | HeightData.SizeY != Final_SizeY)
            {
                //If HeightData.SizeX / Final_SizeX > HeightData.SizeY / Final_SizeY Then
                //    hmTemp.Resize(Me, 0, 0, HeightData.SizeY, Final_SizeX * HeightData.SizeY / Final_SizeY)
                //Else
                //    hmTemp.Resize(Me, 0, 0, Final_SizeY * HeightData.SizeX / Final_SizeX, HeightData.SizeX)
                //End If
                //StretchPixelated(hmTemp, Final_SizeX, Final_SizeY)
                hmTemp.Resize(this, 0, 0, Final_SizeY, Final_SizeX);
                HeightData = hmTemp.HeightData;
            }
        }
예제 #4
0
        public void GenerateNewOfSize(int Final_SizeY, int Final_SizeX, float Scale, double HeightMultiplier)
        {
            int Inflations = 0;
            int SizeY = 0;
            int SizeX = 0;
            double Log2 = 0;
            int intTemp = 0;
            clsHeightmap hmTemp = new clsHeightmap();
            double Ratio = 0;

            Log2 = Math.Log(2.0D);
            if ( Final_SizeX > Final_SizeY )
            {
                Inflations = (int)(Math.Ceiling(Math.Log(Final_SizeX - 1) / Log2));
            }
            else
            {
                Inflations = (int)(Math.Ceiling(Math.Log(Final_SizeY - 1) / Log2));
            }
            Inflations = (int)(Math.Ceiling(Scale));
            if ( Inflations < 0 )
            {
                Debugger.Break();
            }
            Ratio = Math.Pow(2.0D, (Scale - Inflations));
            intTemp = (int)(Math.Pow(2.0D, Inflations));
            SizeX = ((int)(Math.Ceiling((Final_SizeX / Ratio - 1) / intTemp))) + 1;
            SizeY = ((int)(Math.Ceiling((Final_SizeY / Ratio - 1) / intTemp))) + 1;

            GenerateNew(SizeY, SizeX, Inflations, 1.0D, HeightMultiplier);
            if ( Inflations > Scale )
            {
                hmTemp.Stretch(this, (int)(HeightData.SizeX * Ratio), (int)(HeightData.SizeY * Ratio));
                HeightData = hmTemp.HeightData;
                hmTemp.HeightData = new clsHeightData();
            }
            if ( HeightData.SizeX != Final_SizeX | HeightData.SizeY != Final_SizeY )
            {
                //If HeightData.SizeX / Final_SizeX > HeightData.SizeY / Final_SizeY Then
                //    hmTemp.Resize(Me, 0, 0, HeightData.SizeY, Final_SizeX * HeightData.SizeY / Final_SizeY)
                //Else
                //    hmTemp.Resize(Me, 0, 0, Final_SizeY * HeightData.SizeX / Final_SizeX, HeightData.SizeX)
                //End If
                //StretchPixelated(hmTemp, Final_SizeX, Final_SizeY)
                hmTemp.Resize(this, 0, 0, Final_SizeY, Final_SizeX);
                HeightData = hmTemp.HeightData;
            }
        }
예제 #5
0
        public void GenerateNew(int SizeY, int SizeX, int Inflations, double NoiseFactor, double HeightMultiplier)
        {
            clsHeightmap Temp = new clsHeightmap();

            Blank(SizeY, SizeX);
            Randomize(HeightMultiplier / HeightScale);
            Temp.HeightScale = HeightScale;
            Temp.Generate(this, Inflations, NoiseFactor, HeightMultiplier / HeightScale);
            HeightData = Temp.HeightData; //steal the temporary heightmap's data
        }
예제 #6
0
        public void Generate(clsHeightmap Source, int Inflations, double NoiseFactor, double HeightMultiplier)
        {
            clsHeightmap Temp = new clsHeightmap();
            int A = 0;

            if ( Inflations >= 1 )
            {
                Temp.Inflate(Source, NoiseFactor, HeightMultiplier, 1);
                HeightData = Temp.HeightData;
                Temp.HeightData = new clsHeightData();
                for ( A = 2; A <= Inflations; A++ )
                {
                    Temp.Inflate(this, NoiseFactor, HeightMultiplier, A);
                    HeightData = Temp.HeightData;
                    Temp.HeightData = new clsHeightData();
                }
            }
            else if ( Inflations == 0 )
            {
                Copy(Source);
            }
            else
            {
                return;
            }
        }
예제 #7
0
 public void GenerateNewOfSize(int Final_SizeY, int Final_SizeX, float Scale, double HeightMultiplier)
 {
     int num;
     clsHeightmap heightmap = new clsHeightmap();
     double num3 = Math.Log(2.0);
     if (Final_SizeX > Final_SizeY)
     {
         num = (int) Math.Round(Math.Ceiling((double) (Math.Log((double) (Final_SizeX - 1)) / num3)));
     }
     else
     {
         num = (int) Math.Round(Math.Ceiling((double) (Math.Log((double) (Final_SizeY - 1)) / num3)));
     }
     num = (int) Math.Round(Math.Ceiling((double) Scale));
     if (num < 0)
     {
         Debugger.Break();
     }
     double num4 = Math.Pow(2.0, (double) (Scale - num));
     int num2 = (int) Math.Round(Math.Pow(2.0, (double) num));
     int sizeX = ((int) Math.Round(Math.Ceiling((double) (((((double) Final_SizeX) / num4) - 1.0) / ((double) num2))))) + 1;
     int sizeY = ((int) Math.Round(Math.Ceiling((double) (((((double) Final_SizeY) / num4) - 1.0) / ((double) num2))))) + 1;
     this.GenerateNew(sizeY, sizeX, num, 1.0, HeightMultiplier);
     if (num > Scale)
     {
         heightmap.Stretch(this, (int) Math.Round((double) (this.HeightData.SizeX * num4)), (int) Math.Round((double) (this.HeightData.SizeY * num4)));
         this.HeightData = heightmap.HeightData;
         heightmap.HeightData = new clsHeightData();
     }
     if ((this.HeightData.SizeX != Final_SizeX) | (this.HeightData.SizeY != Final_SizeY))
     {
         heightmap.Resize(this, 0, 0, Final_SizeY, Final_SizeX);
         this.HeightData = heightmap.HeightData;
     }
 }
예제 #8
0
 public void GenerateNew(int SizeY, int SizeX, int Inflations, double NoiseFactor, double HeightMultiplier)
 {
     clsHeightmap heightmap = new clsHeightmap();
     this.Blank(SizeY, SizeX);
     this.Randomize(HeightMultiplier / this.HeightScale);
     heightmap.HeightScale = this.HeightScale;
     heightmap.Generate(this, Inflations, NoiseFactor, HeightMultiplier / this.HeightScale);
     this.HeightData = heightmap.HeightData;
 }
예제 #9
0
 public void Generate(clsHeightmap Source, int Inflations, double NoiseFactor, double HeightMultiplier)
 {
     clsHeightmap heightmap = new clsHeightmap();
     if (Inflations >= 1)
     {
         heightmap.Inflate(Source, NoiseFactor, HeightMultiplier, 1);
         this.HeightData = heightmap.HeightData;
         heightmap.HeightData = new clsHeightData();
         int num2 = Inflations;
         for (int i = 2; i <= num2; i++)
         {
             heightmap.Inflate(this, NoiseFactor, HeightMultiplier, i);
             this.HeightData = heightmap.HeightData;
             heightmap.HeightData = new clsHeightData();
         }
     }
     else if (Inflations == 0)
     {
         this.Copy(Source);
     }
 }