示例#1
0
        /// <summary>
        /// Generates a spherical projection of a point in the noise map.
        /// </summary>
        /// <param name="lat">The latitude of the point.</param>
        /// <param name="lon">The longitude of the point.</param>
        /// <returns>The corresponding noise map value.</returns>
        private double GenerateSpherical(double lat, double lon)
        {
            var r = Math.Cos(Mathf.Deg2Rad * lat);

            return(BurstModuleManager.GetBurstValue((float)(r * Math.Cos(Mathf.Deg2Rad * lon)), (float)(Math.Sin(Mathf.Deg2Rad * lat)),
                                                    (float)(r * Math.Sin(Mathf.Deg2Rad * lon)), moduleData, 0));
        }
示例#2
0
        /// <summary>
        /// Generates a cylindrical projection of a point in the noise map.
        /// </summary>
        /// <param name="angle">The angle of the point.</param>
        /// <param name="height">The height of the point.</param>
        /// <returns>The corresponding noise map value.</returns>
        private double GenerateCylindrical(double angle, double height)
        {
            var x = math.cos(math.radians(angle));
            var y = height;
            var z = math.sin(math.radians(angle));

            return(BurstModuleManager.GetBurstValue((float)x, (float)y, (float)z, moduleData, 0));
        }
示例#3
0
 /// <summary>
 /// Generates a non-seamless planar projection of the noise map.
 /// </summary>
 /// <param name="left">The clip region to the left.</param>
 /// <param name="right">The clip region to the right.</param>
 /// <param name="top">The clip region to the top.</param>
 /// <param name="bottom">The clip region to the bottom.</param>
 /// <param name="isSeamless">Indicates whether the resulting noise map should be seamless.</param>
 public new void GeneratePlanar(double left, double right, double top, double bottom, bool isSeamless = true)
 {
     if (right <= left || bottom <= top)
     {
         throw new ArgumentException("Invalid right/left or bottom/top combination");
     }
     if (generator == null)
     {
         throw new ArgumentNullException("Generator is null");
     }
     BurstModuleManager.GeneratePlanarHeightmap(heightmap, generator, heightmapWidth, heightmapHeight, left, right, top, bottom, isSeamless);
     SetData();
 }
示例#4
0
 /// <summary>
 /// Generates a spherical projection of the noise map.
 /// </summary>
 /// <param name="south">The clip region to the south.</param>
 /// <param name="north">The clip region to the north.</param>
 /// <param name="west">The clip region to the west.</param>
 /// <param name="east">The clip region to the east.</param>
 public new void GenerateSpherical(double south, double north, double west, double east)
 {
     if (east <= west || south <= north)
     {
         throw new ArgumentException("Invalid east/west or north/south combination");
     }
     if (generator == null)
     {
         throw new ArgumentNullException("Generator is null");
     }
     BurstModuleManager.GenerateSphericalHeightmap(heightmap, generator, heightmapWidth, heightmapHeight, south, north, west, east);
     SetData();
 }
示例#5
0
 /// <summary>
 /// Generates a cylindrical projection of the noise map.
 /// </summary>
 /// <param name="angleMin">The maximum angle of the clip region.</param>
 /// <param name="angleMax">The minimum angle of the clip region.</param>
 /// <param name="heightMin">The minimum height of the clip region.</param>
 /// <param name="heightMax">The maximum height of the clip region.</param>
 public new void GenerateCylindrical(double angleMin, double angleMax, double heightMin, double heightMax)
 {
     if (angleMax <= angleMin || heightMax <= heightMin)
     {
         throw new ArgumentException("Invalid angle or height parameters");
     }
     if (generator == null)
     {
         throw new ArgumentNullException("Generator is null");
     }
     BurstModuleManager.GenerateCylindricalHeightmap(heightmap, generator, heightmapWidth, heightmapHeight, angleMin, angleMax, heightMin, heightMax);
     SetData();
 }
示例#6
0
 public float Calculate(int x, int y, int z)
 {
     if (generateMode == GenerateMode.Planar)
     {
         return(CalculatePlanar(x, y, z));
     }
     else if (generateMode == GenerateMode.Cylindrical)
     {
         return(CalculateCylindrical(x, y, z));
     }
     else if (generateMode == GenerateMode.Spherical)
     {
         return(CalculateSpherical(x, y, z));
     }
     else
     {
         return(BurstModuleManager.GetBurstValue(x, y, z, moduleData, 0));
     }
 }
示例#7
0
 public float Calculate(int x, int y, int z)
 {
     return(BurstModuleManager.GetBurstValue(x, y, z, moduleData, 0));
 }
示例#8
0
 /// <summary>
 /// Generates a planar projection of a point in the noise map.
 /// </summary>
 /// <param name="x">The position on the x-axis.</param>
 /// <param name="y">The position on the y-axis.</param>
 /// <returns>The corresponding noise map value.</returns>
 private double GeneratePlanar(double x, double y)
 {
     return(BurstModuleManager.GetBurstValue((float)x, 0.0f, (float)y, moduleData, 0));
 }