* Major style changes in libTerrain.Channel - now uses .NET-style naming syntax.
* Issue#218 - Updated mySQL region table.afrisby
parent
5db16cbd9b
commit
b8da9c3a64
|
@ -109,13 +109,13 @@ namespace OpenSim.Region.Terrain
|
||||||
{
|
{
|
||||||
for (y = 0; y < h; y++)
|
for (y = 0; y < h; y++)
|
||||||
{
|
{
|
||||||
if ((heightmap.get(x, y) > revertmap.get(x, y) + maxRaise))
|
if ((heightmap.Get(x, y) > revertmap.Get(x, y) + maxRaise))
|
||||||
{
|
{
|
||||||
heightmap.map[x, y] = revertmap.get(x, y) + maxRaise;
|
heightmap.map[x, y] = revertmap.Get(x, y) + maxRaise;
|
||||||
}
|
}
|
||||||
if ((heightmap.get(x, y) > revertmap.get(x, y) - minLower))
|
if ((heightmap.Get(x, y) > revertmap.Get(x, y) - minLower))
|
||||||
{
|
{
|
||||||
heightmap.map[x, y] = revertmap.get(x, y) - minLower;
|
heightmap.map[x, y] = revertmap.Get(x, y) - minLower;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -192,7 +192,7 @@ namespace OpenSim.Region.Terrain
|
||||||
{
|
{
|
||||||
for (y = 0; y < h; y++)
|
for (y = 0; y < h; y++)
|
||||||
{
|
{
|
||||||
heightmap.set(x, y, (double)heights[x, y]);
|
heightmap.Set(x, y, (double)heights[x, y]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SaveRevertMap();
|
SaveRevertMap();
|
||||||
|
@ -210,7 +210,7 @@ namespace OpenSim.Region.Terrain
|
||||||
{
|
{
|
||||||
for (y = 0; y < h; y++)
|
for (y = 0; y < h; y++)
|
||||||
{
|
{
|
||||||
heightmap.set(x, y, heights[x, y]);
|
heightmap.Set(x, y, heights[x, y]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SaveRevertMap();
|
SaveRevertMap();
|
||||||
|
@ -222,7 +222,7 @@ namespace OpenSim.Region.Terrain
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SwapRevertMaps()
|
public void SwapRevertMaps()
|
||||||
{
|
{
|
||||||
Channel backup = heightmap.copy();
|
Channel backup = heightmap.Copy();
|
||||||
heightmap = revertmap;
|
heightmap = revertmap;
|
||||||
revertmap = backup;
|
revertmap = backup;
|
||||||
}
|
}
|
||||||
|
@ -232,7 +232,7 @@ namespace OpenSim.Region.Terrain
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SaveRevertMap()
|
public void SaveRevertMap()
|
||||||
{
|
{
|
||||||
revertmap = heightmap.copy();
|
revertmap = heightmap.Copy();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -295,7 +295,7 @@ namespace OpenSim.Region.Terrain
|
||||||
double[] c = new double[2];
|
double[] c = new double[2];
|
||||||
c[0] = -1;
|
c[0] = -1;
|
||||||
c[1] = 1;
|
c[1] = 1;
|
||||||
heightmap.voronoiDiagram(Convert.ToInt32(args[1]), Convert.ToInt32(args[2]), c);
|
heightmap.VoronoiDiagram(Convert.ToInt32(args[1]), Convert.ToInt32(args[2]), c);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "hills":
|
case "hills":
|
||||||
|
@ -331,7 +331,7 @@ namespace OpenSim.Region.Terrain
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "img":
|
case "img":
|
||||||
heightmap.loadImage(args[2]);
|
heightmap.LoadImage(args[2]);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -357,7 +357,7 @@ namespace OpenSim.Region.Terrain
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "png":
|
case "png":
|
||||||
heightmap.saveImage(args[2]);
|
heightmap.SaveImage(args[2]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "raw":
|
case "raw":
|
||||||
|
@ -412,12 +412,12 @@ namespace OpenSim.Region.Terrain
|
||||||
heightmap.AerobicErosion(Convert.ToDouble(args[2]), Convert.ToDouble(args[3]), Convert.ToDouble(args[4]), Convert.ToDouble(args[5]), Convert.ToInt32(args[6]), Convert.ToBoolean(args[7]), true);
|
heightmap.AerobicErosion(Convert.ToDouble(args[2]), Convert.ToDouble(args[3]), Convert.ToDouble(args[4]), Convert.ToDouble(args[5]), Convert.ToInt32(args[6]), Convert.ToBoolean(args[7]), true);
|
||||||
break;
|
break;
|
||||||
case "thermal":
|
case "thermal":
|
||||||
heightmap.thermalWeathering(Convert.ToDouble(args[2]), Convert.ToInt32(args[3]), Convert.ToDouble(args[4]));
|
heightmap.ThermalWeathering(Convert.ToDouble(args[2]), Convert.ToInt32(args[3]), Convert.ToDouble(args[4]));
|
||||||
break;
|
break;
|
||||||
case "hydraulic":
|
case "hydraulic":
|
||||||
Channel rainMap = new Channel(w, h);
|
Channel rainMap = new Channel(w, h);
|
||||||
rainMap.fill(Convert.ToDouble(args[2]));
|
rainMap.Fill(Convert.ToDouble(args[2]));
|
||||||
heightmap.hydraulicErosion(rainMap, Convert.ToDouble(args[3]), Convert.ToDouble(args[4]), Convert.ToInt32(args[5]), Convert.ToInt32(args[6]));
|
heightmap.HydraulicErosion(rainMap, Convert.ToDouble(args[3]), Convert.ToDouble(args[4]), Convert.ToInt32(args[5]), Convert.ToInt32(args[6]));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
resultText = "Unknown erosion type";
|
resultText = "Unknown erosion type";
|
||||||
|
@ -459,16 +459,16 @@ namespace OpenSim.Region.Terrain
|
||||||
switch (args[1].ToLower())
|
switch (args[1].ToLower())
|
||||||
{
|
{
|
||||||
case "blocks":
|
case "blocks":
|
||||||
heightmap.hillsBlocks(count, sizeMin, sizeRange, island, additive, noisy);
|
heightmap.HillsBlocks(count, sizeMin, sizeRange, island, additive, noisy);
|
||||||
break;
|
break;
|
||||||
case "cones":
|
case "cones":
|
||||||
heightmap.hillsCones(count, sizeMin, sizeRange, island, additive, noisy);
|
heightmap.HillsCones(count, sizeMin, sizeRange, island, additive, noisy);
|
||||||
break;
|
break;
|
||||||
case "spheres":
|
case "spheres":
|
||||||
heightmap.hillsSpheres(count, sizeMin, sizeRange, island, additive, noisy);
|
heightmap.HillsSpheres(count, sizeMin, sizeRange, island, additive, noisy);
|
||||||
break;
|
break;
|
||||||
case "squared":
|
case "squared":
|
||||||
heightmap.hillsSquared(count, sizeMin, sizeRange, island, additive, noisy);
|
heightmap.HillsSquared(count, sizeMin, sizeRange, island, additive, noisy);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
resultText = "Unknown hills type";
|
resultText = "Unknown hills type";
|
||||||
|
@ -485,7 +485,7 @@ namespace OpenSim.Region.Terrain
|
||||||
/// <param name="max">Maximum value of the new array</param>
|
/// <param name="max">Maximum value of the new array</param>
|
||||||
public void SetRange(float min, float max)
|
public void SetRange(float min, float max)
|
||||||
{
|
{
|
||||||
heightmap.normalise((double)min, (double)max);
|
heightmap.Normalise((double)min, (double)max);
|
||||||
tainted++;
|
tainted++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -580,7 +580,7 @@ namespace OpenSim.Region.Terrain
|
||||||
{
|
{
|
||||||
for (y = 0; y < h; y++)
|
for (y = 0; y < h; y++)
|
||||||
{
|
{
|
||||||
bs.Write(heightmap.get(x, y));
|
bs.Write(heightmap.Get(x, y));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -603,7 +603,7 @@ namespace OpenSim.Region.Terrain
|
||||||
{
|
{
|
||||||
for (y = 0; y < h; y++)
|
for (y = 0; y < h; y++)
|
||||||
{
|
{
|
||||||
bs.Write((float)heightmap.get(x, y));
|
bs.Write((float)heightmap.Get(x, y));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -625,8 +625,8 @@ namespace OpenSim.Region.Terrain
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
// Used for the 'green' channel.
|
// Used for the 'green' channel.
|
||||||
byte avgMultiplier = (byte)heightmap.avg();
|
byte avgMultiplier = (byte)heightmap.Avg();
|
||||||
byte backupMultiplier = (byte)revertmap.avg();
|
byte backupMultiplier = (byte)revertmap.Avg();
|
||||||
|
|
||||||
// Limit the multiplier so it can represent points >64m.
|
// Limit the multiplier so it can represent points >64m.
|
||||||
if (avgMultiplier > 196)
|
if (avgMultiplier > 196)
|
||||||
|
@ -643,9 +643,9 @@ namespace OpenSim.Region.Terrain
|
||||||
{
|
{
|
||||||
for (y = 0; y < h; y++)
|
for (y = 0; y < h; y++)
|
||||||
{
|
{
|
||||||
byte red = (byte)(heightmap.get(x, y) / ((double)avgMultiplier / 128.0));
|
byte red = (byte)(heightmap.Get(x, y) / ((double)avgMultiplier / 128.0));
|
||||||
byte green = avgMultiplier;
|
byte green = avgMultiplier;
|
||||||
byte blue = (byte)watermap.get(x, y);
|
byte blue = (byte)watermap.Get(x, y);
|
||||||
byte alpha1 = 0; // Land Parcels
|
byte alpha1 = 0; // Land Parcels
|
||||||
byte alpha2 = 0; // For Sale Land
|
byte alpha2 = 0; // For Sale Land
|
||||||
byte alpha3 = 0; // Public Edit Object
|
byte alpha3 = 0; // Public Edit Object
|
||||||
|
@ -654,7 +654,7 @@ namespace OpenSim.Region.Terrain
|
||||||
byte alpha6 = 255; // Flying Allowed
|
byte alpha6 = 255; // Flying Allowed
|
||||||
byte alpha7 = 255; // Create Landmark
|
byte alpha7 = 255; // Create Landmark
|
||||||
byte alpha8 = 255; // Outside Scripts
|
byte alpha8 = 255; // Outside Scripts
|
||||||
byte alpha9 = (byte)(revertmap.get(x, y) / ((double)backupMultiplier / 128.0));
|
byte alpha9 = (byte)(revertmap.Get(x, y) / ((double)backupMultiplier / 128.0));
|
||||||
byte alpha10 = backupMultiplier;
|
byte alpha10 = backupMultiplier;
|
||||||
|
|
||||||
binStream.Write(red);
|
binStream.Write(red);
|
||||||
|
@ -703,7 +703,7 @@ namespace OpenSim.Region.Terrain
|
||||||
{
|
{
|
||||||
for (y = 0; y < h; y++)
|
for (y = 0; y < h; y++)
|
||||||
{
|
{
|
||||||
double t = heightmap.get(x, y);
|
double t = heightmap.Get(x, y);
|
||||||
double min = double.MaxValue;
|
double min = double.MaxValue;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
|
@ -718,7 +718,7 @@ namespace OpenSim.Region.Terrain
|
||||||
|
|
||||||
byte red = (byte)(index & 0xFF);
|
byte red = (byte)(index & 0xFF);
|
||||||
byte green = (byte)((index >> 8) & 0xFF);
|
byte green = (byte)((index >> 8) & 0xFF);
|
||||||
byte blue = (byte)watermap.get(x, y);
|
byte blue = (byte)watermap.Get(x, y);
|
||||||
byte alpha1 = 0; // Land Parcels
|
byte alpha1 = 0; // Land Parcels
|
||||||
byte alpha2 = 0; // For Sale Land
|
byte alpha2 = 0; // For Sale Land
|
||||||
byte alpha3 = 0; // Public Edit Object
|
byte alpha3 = 0; // Public Edit Object
|
||||||
|
@ -770,7 +770,7 @@ namespace OpenSim.Region.Terrain
|
||||||
{
|
{
|
||||||
lock (heightmap)
|
lock (heightmap)
|
||||||
{
|
{
|
||||||
heightmap.raise(rx, ry, size, amount);
|
heightmap.Raise(rx, ry, size, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
tainted++;
|
tainted++;
|
||||||
|
@ -787,7 +787,7 @@ namespace OpenSim.Region.Terrain
|
||||||
{
|
{
|
||||||
lock (heightmap)
|
lock (heightmap)
|
||||||
{
|
{
|
||||||
heightmap.lower(rx, ry, size, amount);
|
heightmap.Lower(rx, ry, size, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
tainted++;
|
tainted++;
|
||||||
|
@ -804,7 +804,7 @@ namespace OpenSim.Region.Terrain
|
||||||
{
|
{
|
||||||
lock (heightmap)
|
lock (heightmap)
|
||||||
{
|
{
|
||||||
heightmap.flatten(rx, ry, size, amount);
|
heightmap.Flatten(rx, ry, size, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
tainted++;
|
tainted++;
|
||||||
|
@ -822,12 +822,12 @@ namespace OpenSim.Region.Terrain
|
||||||
lock (heightmap)
|
lock (heightmap)
|
||||||
{
|
{
|
||||||
Channel smoothed = new Channel();
|
Channel smoothed = new Channel();
|
||||||
smoothed.noise();
|
smoothed.Noise();
|
||||||
|
|
||||||
Channel mask = new Channel();
|
Channel mask = new Channel();
|
||||||
mask.raise(rx, ry, size, amount);
|
mask.Raise(rx, ry, size, amount);
|
||||||
|
|
||||||
heightmap.blend(smoothed, mask);
|
heightmap.Blend(smoothed, mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
tainted++;
|
tainted++;
|
||||||
|
@ -845,9 +845,9 @@ namespace OpenSim.Region.Terrain
|
||||||
lock (heightmap)
|
lock (heightmap)
|
||||||
{
|
{
|
||||||
Channel mask = new Channel();
|
Channel mask = new Channel();
|
||||||
mask.raise(rx, ry, size, amount);
|
mask.Raise(rx, ry, size, amount);
|
||||||
|
|
||||||
heightmap.blend(revertmap, mask);
|
heightmap.Blend(revertmap, mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
tainted++;
|
tainted++;
|
||||||
|
@ -864,13 +864,13 @@ namespace OpenSim.Region.Terrain
|
||||||
{
|
{
|
||||||
lock (heightmap)
|
lock (heightmap)
|
||||||
{
|
{
|
||||||
Channel smoothed = heightmap.copy();
|
Channel smoothed = heightmap.Copy();
|
||||||
smoothed.smooth(amount);
|
smoothed.Smooth(amount);
|
||||||
|
|
||||||
Channel mask = new Channel();
|
Channel mask = new Channel();
|
||||||
mask.raise(rx,ry,size,amount);
|
mask.Raise(rx,ry,size,amount);
|
||||||
|
|
||||||
heightmap.blend(smoothed, mask);
|
heightmap.Blend(smoothed, mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
tainted++;
|
tainted++;
|
||||||
|
@ -883,8 +883,8 @@ namespace OpenSim.Region.Terrain
|
||||||
{
|
{
|
||||||
lock (heightmap)
|
lock (heightmap)
|
||||||
{
|
{
|
||||||
heightmap.hillsSpheres(200, 20, 40, true, true, false);
|
heightmap.HillsSpheres(200, 20, 40, true, true, false);
|
||||||
heightmap.normalise();
|
heightmap.Normalise();
|
||||||
heightmap *= 60.0; // Raise to 60m
|
heightmap *= 60.0; // Raise to 60m
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -899,7 +899,7 @@ namespace OpenSim.Region.Terrain
|
||||||
/// <returns>Height at specified coordinates</returns>
|
/// <returns>Height at specified coordinates</returns>
|
||||||
public double GetHeight(int x, int y)
|
public double GetHeight(int x, int y)
|
||||||
{
|
{
|
||||||
return heightmap.get(x, y);
|
return heightmap.Get(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -936,13 +936,13 @@ namespace OpenSim.Region.Terrain
|
||||||
colours[i] = gradientmapLd.GetPixel(0, i);
|
colours[i] = gradientmapLd.GetPixel(0, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
Channel copy = heightmap.copy();
|
Channel copy = heightmap.Copy();
|
||||||
for (int x = 0; x < copy.w; x++)
|
for (int x = 0; x < copy.w; x++)
|
||||||
{
|
{
|
||||||
for (int y = 0; y < copy.h; y++)
|
for (int y = 0; y < copy.h; y++)
|
||||||
{
|
{
|
||||||
// 512 is the largest possible height before colours clamp
|
// 512 is the largest possible height before colours clamp
|
||||||
int colorindex = (int)(Math.Max(Math.Min(1.0, copy.get(x, y) / 512.0), 0.0) * (pallete - 1));
|
int colorindex = (int)(Math.Max(Math.Min(1.0, copy.Get(x, y) / 512.0), 0.0) * (pallete - 1));
|
||||||
bmp.SetPixel(x, y, colours[colorindex]);
|
bmp.SetPixel(x, y, colours[colorindex]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -976,13 +976,13 @@ namespace OpenSim.Region.Terrain
|
||||||
colours[i] = gradientmapLd.GetPixel(0, i);
|
colours[i] = gradientmapLd.GetPixel(0, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
Channel copy = heightmap.copy();
|
Channel copy = heightmap.Copy();
|
||||||
for (int x = 0; x < copy.w; x++)
|
for (int x = 0; x < copy.w; x++)
|
||||||
{
|
{
|
||||||
for (int y = 0; y < copy.h; y++)
|
for (int y = 0; y < copy.h; y++)
|
||||||
{
|
{
|
||||||
// 512 is the largest possible height before colours clamp
|
// 512 is the largest possible height before colours clamp
|
||||||
int colorindex = (int)(Math.Max(Math.Min(1.0, copy.get(copy.h - y, x) / 512.0), 0.0) * pallete);
|
int colorindex = (int)(Math.Max(Math.Min(1.0, copy.Get(copy.h - y, x) / 512.0), 0.0) * pallete);
|
||||||
bmp.SetPixel(x, y, colours[colorindex]);
|
bmp.SetPixel(x, y, colours[colorindex]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace libTerrain
|
||||||
bmp = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
|
bmp = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Channel toChannel()
|
public Channel ToChannel()
|
||||||
{
|
{
|
||||||
Channel chan = new Channel(bmp.Width, bmp.Height);
|
Channel chan = new Channel(bmp.Width, bmp.Height);
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ namespace libTerrain
|
||||||
return chan;
|
return chan;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawText(string txt, string font, double size)
|
public void DrawText(string txt, string font, double size)
|
||||||
{
|
{
|
||||||
Graphics gd = Graphics.FromImage(bmp);
|
Graphics gd = Graphics.FromImage(bmp);
|
||||||
//gd.DrawString(txt,
|
//gd.DrawString(txt,
|
||||||
|
|
|
@ -35,23 +35,23 @@ namespace libTerrain
|
||||||
{
|
{
|
||||||
public partial class Channel
|
public partial class Channel
|
||||||
{
|
{
|
||||||
public int getWidth()
|
public int GetWidth()
|
||||||
{
|
{
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
public int getHeight()
|
public int GetHeight()
|
||||||
{
|
{
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Channel copy()
|
public Channel Copy()
|
||||||
{
|
{
|
||||||
Channel x = new Channel(w, h);
|
Channel x = new Channel(w, h);
|
||||||
x.map = (double[,])this.map.Clone();
|
x.map = (double[,])this.map.Clone();
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void set(int x, int y, double val)
|
public void Set(int x, int y, double val)
|
||||||
{
|
{
|
||||||
if (x >= w)
|
if (x >= w)
|
||||||
throw new Exception("Bounds error while setting pixel (width)");
|
throw new Exception("Bounds error while setting pixel (width)");
|
||||||
|
@ -65,7 +65,7 @@ namespace libTerrain
|
||||||
map[x, y] = val;
|
map[x, y] = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setClip(int x, int y, double val)
|
public void SetClip(int x, int y, double val)
|
||||||
{
|
{
|
||||||
if (x >= w)
|
if (x >= w)
|
||||||
throw new Exception("Bounds error while setting pixel (width)");
|
throw new Exception("Bounds error while setting pixel (width)");
|
||||||
|
@ -84,7 +84,7 @@ namespace libTerrain
|
||||||
map[x, y] = val;
|
map[x, y] = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
private double getBilinearInterpolate(double x, double y)
|
private double GetBilinearInterpolate(double x, double y)
|
||||||
{
|
{
|
||||||
if (x > w - 2.0)
|
if (x > w - 2.0)
|
||||||
x = w - 2.0;
|
x = w - 2.0;
|
||||||
|
@ -95,11 +95,11 @@ namespace libTerrain
|
||||||
if (y < 0.0)
|
if (y < 0.0)
|
||||||
y = 0.0;
|
y = 0.0;
|
||||||
|
|
||||||
int STEP_SIZE = 1;
|
int stepSize = 1;
|
||||||
double h00 = get((int)x, (int)y);
|
double h00 = Get((int)x, (int)y);
|
||||||
double h10 = get((int)x + STEP_SIZE, (int)y);
|
double h10 = Get((int)x + stepSize, (int)y);
|
||||||
double h01 = get((int)x, (int)y + STEP_SIZE);
|
double h01 = Get((int)x, (int)y + stepSize);
|
||||||
double h11 = get((int)x + STEP_SIZE, (int)y + STEP_SIZE);
|
double h11 = Get((int)x + stepSize, (int)y + stepSize);
|
||||||
double h1 = h00;
|
double h1 = h00;
|
||||||
double h2 = h10;
|
double h2 = h10;
|
||||||
double h3 = h01;
|
double h3 = h01;
|
||||||
|
@ -114,7 +114,7 @@ namespace libTerrain
|
||||||
return hi;
|
return hi;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double get(int x, int y)
|
public double Get(int x, int y)
|
||||||
{
|
{
|
||||||
if (x >= w)
|
if (x >= w)
|
||||||
x = w - 1;
|
x = w - 1;
|
||||||
|
@ -127,12 +127,12 @@ namespace libTerrain
|
||||||
return map[x, y];
|
return map[x, y];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWrap(int x, int y, double val)
|
public void SetWrap(int x, int y, double val)
|
||||||
{
|
{
|
||||||
map[x % w, y % h] = val;
|
map[x % w, y % h] = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWrapClip(int x, int y, double val)
|
public void SetWrapClip(int x, int y, double val)
|
||||||
{
|
{
|
||||||
if (val > 1.0)
|
if (val > 1.0)
|
||||||
val = 1.0;
|
val = 1.0;
|
||||||
|
@ -142,7 +142,7 @@ namespace libTerrain
|
||||||
map[x % w, y % h] = val;
|
map[x % w, y % h] = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fill(double val)
|
public void Fill(double val)
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
for (x = 0; x < w; x++)
|
for (x = 0; x < w; x++)
|
||||||
|
@ -154,7 +154,7 @@ namespace libTerrain
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fill(double min, double max, double val)
|
public void Fill(double min, double max, double val)
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
for (x = 0; x < w; x++)
|
for (x = 0; x < w; x++)
|
||||||
|
@ -167,7 +167,7 @@ namespace libTerrain
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public double findMax()
|
public double FindMax()
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
double max = double.MinValue;
|
double max = double.MinValue;
|
||||||
|
@ -184,7 +184,7 @@ namespace libTerrain
|
||||||
return max;
|
return max;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double findMin()
|
public double FindMin()
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
double min = double.MaxValue;
|
double min = double.MaxValue;
|
||||||
|
@ -201,7 +201,7 @@ namespace libTerrain
|
||||||
return min;
|
return min;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double sum()
|
public double Sum()
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
double sum = 0.0;
|
double sum = 0.0;
|
||||||
|
@ -217,9 +217,9 @@ namespace libTerrain
|
||||||
return sum;
|
return sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double avg()
|
public double Avg()
|
||||||
{
|
{
|
||||||
return sum() / (w * h);
|
return Sum() / (w * h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,14 +42,14 @@ namespace libTerrain
|
||||||
/// <param name="ry">The Y coordinate of the terrain mask</param>
|
/// <param name="ry">The Y coordinate of the terrain mask</param>
|
||||||
/// <param name="size">The size of the terrain mask</param>
|
/// <param name="size">The size of the terrain mask</param>
|
||||||
/// <param name="amount">The scale of the terrain mask</param>
|
/// <param name="amount">The scale of the terrain mask</param>
|
||||||
public void flatten(double rx, double ry, double size, double amount)
|
public void Flatten(double rx, double ry, double size, double amount)
|
||||||
{
|
{
|
||||||
// Generate the mask
|
// Generate the mask
|
||||||
Channel temp = new Channel(w, h);
|
Channel temp = new Channel(w, h);
|
||||||
temp.fill(0);
|
temp.Fill(0);
|
||||||
temp.raise(rx, ry, size, amount);
|
temp.Raise(rx, ry, size, amount);
|
||||||
temp.normalise();
|
temp.Normalise();
|
||||||
double total_mod = temp.sum();
|
double total_mod = temp.Sum();
|
||||||
|
|
||||||
// Establish the average height under the area
|
// Establish the average height under the area
|
||||||
Channel newmap = new Channel(w, h);
|
Channel newmap = new Channel(w, h);
|
||||||
|
@ -57,26 +57,26 @@ namespace libTerrain
|
||||||
|
|
||||||
newmap *= temp;
|
newmap *= temp;
|
||||||
|
|
||||||
double total_terrain = newmap.sum();
|
double total_terrain = newmap.Sum();
|
||||||
double avg_height = total_terrain / total_mod;
|
double avg_height = total_terrain / total_mod;
|
||||||
|
|
||||||
// Create a flat terrain using the average height
|
// Create a flat terrain using the average height
|
||||||
Channel flat = new Channel(w, h);
|
Channel flat = new Channel(w, h);
|
||||||
flat.fill(avg_height);
|
flat.Fill(avg_height);
|
||||||
|
|
||||||
// Blend the current terrain with the average height terrain
|
// Blend the current terrain with the average height terrain
|
||||||
// using the "raised" empty terrain as a mask
|
// using the "raised" empty terrain as a mask
|
||||||
blend(flat, temp);
|
Blend(flat, temp);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void flatten(Channel mask, double amount)
|
public void Flatten(Channel mask, double amount)
|
||||||
{
|
{
|
||||||
// Generate the mask
|
// Generate the mask
|
||||||
Channel temp = mask * amount;
|
Channel temp = mask * amount;
|
||||||
temp.clip(0, 1); // Cut off out-of-bounds values
|
temp.Clip(0, 1); // Cut off out-of-bounds values
|
||||||
|
|
||||||
double total_mod = temp.sum();
|
double total_mod = temp.Sum();
|
||||||
|
|
||||||
// Establish the average height under the area
|
// Establish the average height under the area
|
||||||
Channel map = new Channel(w, h);
|
Channel map = new Channel(w, h);
|
||||||
|
@ -84,16 +84,16 @@ namespace libTerrain
|
||||||
|
|
||||||
map *= temp;
|
map *= temp;
|
||||||
|
|
||||||
double total_terrain = map.sum();
|
double total_terrain = map.Sum();
|
||||||
double avg_height = total_terrain / total_mod;
|
double avg_height = total_terrain / total_mod;
|
||||||
|
|
||||||
// Create a flat terrain using the average height
|
// Create a flat terrain using the average height
|
||||||
Channel flat = new Channel(w, h);
|
Channel flat = new Channel(w, h);
|
||||||
flat.fill(avg_height);
|
flat.Fill(avg_height);
|
||||||
|
|
||||||
// Blend the current terrain with the average height terrain
|
// Blend the current terrain with the average height terrain
|
||||||
// using the "raised" empty terrain as a mask
|
// using the "raised" empty terrain as a mask
|
||||||
blend(flat, temp);
|
Blend(flat, temp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -42,9 +42,9 @@ namespace libTerrain
|
||||||
/// <param name="ry">The center the Y coordinate of where you wish to raise the land</param>
|
/// <param name="ry">The center the Y coordinate of where you wish to raise the land</param>
|
||||||
/// <param name="size">The radius of the dimple</param>
|
/// <param name="size">The radius of the dimple</param>
|
||||||
/// <param name="amount">How much impact to add to the terrain (0..2 usually)</param>
|
/// <param name="amount">How much impact to add to the terrain (0..2 usually)</param>
|
||||||
public void raise(double rx, double ry, double size, double amount)
|
public void Raise(double rx, double ry, double size, double amount)
|
||||||
{
|
{
|
||||||
raiseSphere(rx, ry, size, amount);
|
RaiseSphere(rx, ry, size, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -54,7 +54,7 @@ namespace libTerrain
|
||||||
/// <param name="ry">The center the Y coordinate of where you wish to raise the land</param>
|
/// <param name="ry">The center the Y coordinate of where you wish to raise the land</param>
|
||||||
/// <param name="size">The radius of the sphere dimple</param>
|
/// <param name="size">The radius of the sphere dimple</param>
|
||||||
/// <param name="amount">How much impact to add to the terrain (0..2 usually)</param>
|
/// <param name="amount">How much impact to add to the terrain (0..2 usually)</param>
|
||||||
public void raiseSphere(double rx, double ry, double size, double amount)
|
public void RaiseSphere(double rx, double ry, double size, double amount)
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
for (x = 0; x < w; x++)
|
for (x = 0; x < w; x++)
|
||||||
|
@ -80,7 +80,7 @@ namespace libTerrain
|
||||||
/// <param name="ry">The center the Y coordinate of where you wish to raise the land</param>
|
/// <param name="ry">The center the Y coordinate of where you wish to raise the land</param>
|
||||||
/// <param name="size">The radius of the cone</param>
|
/// <param name="size">The radius of the cone</param>
|
||||||
/// <param name="amount">How much impact to add to the terrain (0..2 usually)</param>
|
/// <param name="amount">How much impact to add to the terrain (0..2 usually)</param>
|
||||||
public void raiseCone(double rx, double ry, double size, double amount)
|
public void RaiseCone(double rx, double ry, double size, double amount)
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
for (x = 0; x < w; x++)
|
for (x = 0; x < w; x++)
|
||||||
|
@ -105,9 +105,9 @@ namespace libTerrain
|
||||||
/// <param name="ry">The center the Y coordinate of where you wish to lower the land</param>
|
/// <param name="ry">The center the Y coordinate of where you wish to lower the land</param>
|
||||||
/// <param name="size">The radius of the sphere dimple</param>
|
/// <param name="size">The radius of the sphere dimple</param>
|
||||||
/// <param name="amount">How much impact to remove from the terrain (0..2 usually)</param>
|
/// <param name="amount">How much impact to remove from the terrain (0..2 usually)</param>
|
||||||
public void lower(double rx, double ry, double size, double amount)
|
public void Lower(double rx, double ry, double size, double amount)
|
||||||
{
|
{
|
||||||
lowerSphere(rx, ry, size, amount);
|
LowerSphere(rx, ry, size, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -117,7 +117,7 @@ namespace libTerrain
|
||||||
/// <param name="ry">The center the Y coordinate of where you wish to lower the land</param>
|
/// <param name="ry">The center the Y coordinate of where you wish to lower the land</param>
|
||||||
/// <param name="size">The radius of the sphere dimple</param>
|
/// <param name="size">The radius of the sphere dimple</param>
|
||||||
/// <param name="amount">How much impact to remove from the terrain (0..2 usually)</param>
|
/// <param name="amount">How much impact to remove from the terrain (0..2 usually)</param>
|
||||||
public void lowerSphere(double rx, double ry, double size, double amount)
|
public void LowerSphere(double rx, double ry, double size, double amount)
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
for (x = 0; x < w; x++)
|
for (x = 0; x < w; x++)
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace libTerrain
|
||||||
{
|
{
|
||||||
partial class Channel
|
partial class Channel
|
||||||
{
|
{
|
||||||
public Channel loadImage(string filename)
|
public Channel LoadImage(string filename)
|
||||||
{
|
{
|
||||||
Bitmap bit = new Bitmap(filename);
|
Bitmap bit = new Bitmap(filename);
|
||||||
Channel chan = new Channel(bit.Width, bit.Height);
|
Channel chan = new Channel(bit.Width, bit.Height);
|
||||||
|
@ -53,7 +53,7 @@ namespace libTerrain
|
||||||
return chan;
|
return chan;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveImage(string filename)
|
public void SaveImage(string filename)
|
||||||
{
|
{
|
||||||
Bitmap bit = new Bitmap(w, h, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
|
Bitmap bit = new Bitmap(w, h, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace libTerrain
|
||||||
/// <param name="w"></param>
|
/// <param name="w"></param>
|
||||||
/// <param name="h"></param>
|
/// <param name="h"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private int[] radialEdge256(int val)
|
private int[] RadialEdge256(int val)
|
||||||
{
|
{
|
||||||
// Four cases:
|
// Four cases:
|
||||||
// 1. 000..255 return 0,val
|
// 1. 000..255 return 0,val
|
||||||
|
@ -79,7 +79,7 @@ namespace libTerrain
|
||||||
|
|
||||||
throw new Exception("Out of bounds parameter (val)");
|
throw new Exception("Out of bounds parameter (val)");
|
||||||
}
|
}
|
||||||
public void fracture(int number, double scalemin, double scalemax)
|
public void Fracture(int number, double scalemin, double scalemax)
|
||||||
{
|
{
|
||||||
Random rand = new Random(seed);
|
Random rand = new Random(seed);
|
||||||
|
|
||||||
|
@ -87,8 +87,8 @@ namespace libTerrain
|
||||||
{
|
{
|
||||||
int[] a, b;
|
int[] a, b;
|
||||||
|
|
||||||
a = radialEdge256(rand.Next(1023)); // TODO: Broken
|
a = RadialEdge256(rand.Next(1023)); // TODO: Broken
|
||||||
b = radialEdge256(rand.Next(1023)); // TODO: Broken
|
b = RadialEdge256(rand.Next(1023)); // TODO: Broken
|
||||||
double z = rand.NextDouble();
|
double z = rand.NextDouble();
|
||||||
|
|
||||||
for (int x = 0; x < w; x++)
|
for (int x = 0; x < w; x++)
|
||||||
|
@ -104,7 +104,7 @@ namespace libTerrain
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
normalise();
|
Normalise();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -35,7 +35,7 @@ namespace libTerrain
|
||||||
partial class Channel
|
partial class Channel
|
||||||
{
|
{
|
||||||
|
|
||||||
public void gradientCube()
|
public void GradientCube()
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
for (x = 0; x < w; x++)
|
for (x = 0; x < w; x++)
|
||||||
|
@ -45,10 +45,10 @@ namespace libTerrain
|
||||||
map[x, y] = x*y;
|
map[x, y] = x*y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
normalise();
|
Normalise();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void gradientStripe()
|
public void GradientStripe()
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
for (x = 0; x < w; x++)
|
for (x = 0; x < w; x++)
|
||||||
|
@ -58,7 +58,7 @@ namespace libTerrain
|
||||||
map[x, y] = x;
|
map[x, y] = x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
normalise();
|
Normalise();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -44,7 +44,7 @@ namespace libTerrain
|
||||||
/// <param name="island">Whether to bias hills towards the center of the map</param>
|
/// <param name="island">Whether to bias hills towards the center of the map</param>
|
||||||
/// <param name="additive">Whether to add hills together or to pick the largest value</param>
|
/// <param name="additive">Whether to add hills together or to pick the largest value</param>
|
||||||
/// <param name="noisy">Generates hill-shaped noise instead of consistent hills</param>
|
/// <param name="noisy">Generates hill-shaped noise instead of consistent hills</param>
|
||||||
public void hillsSpheres(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy)
|
public void HillsSpheres(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy)
|
||||||
{
|
{
|
||||||
Random random = new Random(seed);
|
Random random = new Random(seed);
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ namespace libTerrain
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
normalise();
|
Normalise();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -108,7 +108,7 @@ namespace libTerrain
|
||||||
/// <param name="island">Whether to bias hills towards the center of the map</param>
|
/// <param name="island">Whether to bias hills towards the center of the map</param>
|
||||||
/// <param name="additive">Whether to add hills together or to pick the largest value</param>
|
/// <param name="additive">Whether to add hills together or to pick the largest value</param>
|
||||||
/// <param name="noisy">Generates hill-shaped noise instead of consistent hills</param>
|
/// <param name="noisy">Generates hill-shaped noise instead of consistent hills</param>
|
||||||
public void hillsCones(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy)
|
public void HillsCones(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy)
|
||||||
{
|
{
|
||||||
Random random = new Random(seed);
|
Random random = new Random(seed);
|
||||||
|
|
||||||
|
@ -158,10 +158,10 @@ namespace libTerrain
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
normalise();
|
Normalise();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hillsBlocks(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy)
|
public void HillsBlocks(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy)
|
||||||
{
|
{
|
||||||
Random random = new Random(seed);
|
Random random = new Random(seed);
|
||||||
|
|
||||||
|
@ -212,10 +212,10 @@ namespace libTerrain
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
normalise();
|
Normalise();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hillsSquared(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy)
|
public void HillsSquared(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy)
|
||||||
{
|
{
|
||||||
Random random = new Random(seed);
|
Random random = new Random(seed);
|
||||||
|
|
||||||
|
@ -268,7 +268,7 @@ namespace libTerrain
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
normalise();
|
Normalise();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace libTerrain
|
||||||
/// Fills a channel with 0..1 noise
|
/// Fills a channel with 0..1 noise
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>3-Clause BSD Licensed</remarks>
|
/// <remarks>3-Clause BSD Licensed</remarks>
|
||||||
public void noise()
|
public void Noise()
|
||||||
{
|
{
|
||||||
Random rand = new Random(seed);
|
Random rand = new Random(seed);
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace libTerrain
|
||||||
{
|
{
|
||||||
partial class Channel
|
partial class Channel
|
||||||
{
|
{
|
||||||
private double[] coordinatesToPolar(int x, int y)
|
private double[] CoordinatesToPolar(int x, int y)
|
||||||
{
|
{
|
||||||
|
|
||||||
double theta = Math.Atan2(x - (w / 2), y - (h / 2));
|
double theta = Math.Atan2(x - (w / 2), y - (h / 2));
|
||||||
|
@ -48,7 +48,7 @@ namespace libTerrain
|
||||||
return coords;
|
return coords;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int[] polarToCoordinates(double r, double theta) {
|
public int[] PolarToCoordinates(double r, double theta) {
|
||||||
double nx;
|
double nx;
|
||||||
double ny;
|
double ny;
|
||||||
|
|
||||||
|
@ -78,14 +78,14 @@ namespace libTerrain
|
||||||
|
|
||||||
public void Polar()
|
public void Polar()
|
||||||
{
|
{
|
||||||
Channel n = this.copy();
|
Channel n = this.Copy();
|
||||||
|
|
||||||
int x, y;
|
int x, y;
|
||||||
for (x = 0; x < w; x++)
|
for (x = 0; x < w; x++)
|
||||||
{
|
{
|
||||||
for (y = 0; y < h; y++)
|
for (y = 0; y < h; y++)
|
||||||
{
|
{
|
||||||
double[] coords = coordinatesToPolar(x,y);
|
double[] coords = CoordinatesToPolar(x,y);
|
||||||
|
|
||||||
coords[0] += w / 2.0;
|
coords[0] += w / 2.0;
|
||||||
coords[1] += h / 2.0;
|
coords[1] += h / 2.0;
|
||||||
|
@ -105,8 +105,8 @@ namespace libTerrain
|
||||||
r += incRadius;
|
r += incRadius;
|
||||||
theta += incAngle;
|
theta += incAngle;
|
||||||
|
|
||||||
int[] coords = polarToCoordinates(r,theta);
|
int[] coords = PolarToCoordinates(r,theta);
|
||||||
raise(coords[0], coords[1], 20, 1);
|
Raise(coords[0], coords[1], 20, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,11 +122,11 @@ namespace libTerrain
|
||||||
r += incRadius;
|
r += incRadius;
|
||||||
theta += incAngle;
|
theta += incAngle;
|
||||||
|
|
||||||
int[] coords = polarToCoordinates(r, theta);
|
int[] coords = PolarToCoordinates(r, theta);
|
||||||
points.Add(new Point2D(coords[0],coords[1]));
|
points.Add(new Point2D(coords[0],coords[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
voronoiDiagram(points, c);
|
VoronoiDiagram(points, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Spiral(double wid, double hig, double offset)
|
public void Spiral(double wid, double hig, double offset)
|
||||||
|
@ -143,7 +143,7 @@ namespace libTerrain
|
||||||
map[x, y] += Math.Sin(dx / wid) + Math.Cos(dy / hig);
|
map[x, y] += Math.Sin(dx / wid) + Math.Cos(dy / hig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
normalise();
|
Normalise();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -42,7 +42,7 @@ namespace libTerrain
|
||||||
/// <param name="blockSize">A multiple of the channel width and height which will have voronoi points generated in it.
|
/// <param name="blockSize">A multiple of the channel width and height which will have voronoi points generated in it.
|
||||||
/// <para>This is to ensure a more even distribution of the points than pure random allocation.</para></param>
|
/// <para>This is to ensure a more even distribution of the points than pure random allocation.</para></param>
|
||||||
/// <param name="c">The Voronoi diagram type. Usually an array with values consisting of [-1,1]. Experiment with the chain, you can have as many values as you like.</param>
|
/// <param name="c">The Voronoi diagram type. Usually an array with values consisting of [-1,1]. Experiment with the chain, you can have as many values as you like.</param>
|
||||||
public void voronoiDiagram(int pointsPerBlock, int blockSize, double[] c)
|
public void VoronoiDiagram(int pointsPerBlock, int blockSize, double[] c)
|
||||||
{
|
{
|
||||||
List<Point2D> points = new List<Point2D>();
|
List<Point2D> points = new List<Point2D>();
|
||||||
Random generator = new Random(seed);
|
Random generator = new Random(seed);
|
||||||
|
@ -98,10 +98,10 @@ namespace libTerrain
|
||||||
}
|
}
|
||||||
|
|
||||||
// Normalise the result
|
// Normalise the result
|
||||||
normalise();
|
Normalise();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void voronoiDiagram(List<Point2D> points, double[] c)
|
public void VoronoiDiagram(List<Point2D> points, double[] c)
|
||||||
{
|
{
|
||||||
|
|
||||||
Random generator = new Random(seed);
|
Random generator = new Random(seed);
|
||||||
|
@ -141,10 +141,10 @@ namespace libTerrain
|
||||||
}
|
}
|
||||||
|
|
||||||
// Normalise the result
|
// Normalise the result
|
||||||
normalise();
|
Normalise();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void voroflatDiagram(int pointsPerBlock, int blockSize)
|
public void VoroflatDiagram(int pointsPerBlock, int blockSize)
|
||||||
{
|
{
|
||||||
List<Point2D> points = new List<Point2D>();
|
List<Point2D> points = new List<Point2D>();
|
||||||
Random generator = new Random(seed);
|
Random generator = new Random(seed);
|
||||||
|
@ -203,7 +203,7 @@ namespace libTerrain
|
||||||
}
|
}
|
||||||
|
|
||||||
// Normalise the result
|
// Normalise the result
|
||||||
normalise();
|
Normalise();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace libTerrain
|
||||||
/// <param name="movement">The maximum distance each worm will move each step</param>
|
/// <param name="movement">The maximum distance each worm will move each step</param>
|
||||||
/// <param name="size">The size of the area around the worm modified</param>
|
/// <param name="size">The size of the area around the worm modified</param>
|
||||||
/// <param name="centerspawn">Do worms start in the middle, or randomly?</param>
|
/// <param name="centerspawn">Do worms start in the middle, or randomly?</param>
|
||||||
public void worms(int number, int rounds, double movement, double size, bool centerspawn)
|
public void Worms(int number, int rounds, double movement, double size, bool centerspawn)
|
||||||
{
|
{
|
||||||
Random random = new Random(seed);
|
Random random = new Random(seed);
|
||||||
int i, j;
|
int i, j;
|
||||||
|
@ -64,7 +64,7 @@ namespace libTerrain
|
||||||
{
|
{
|
||||||
rx += (random.NextDouble() * movement) - (movement / 2.0);
|
rx += (random.NextDouble() * movement) - (movement / 2.0);
|
||||||
ry += (random.NextDouble() * movement) - (movement / 2.0);
|
ry += (random.NextDouble() * movement) - (movement / 2.0);
|
||||||
raise(rx, ry, size, 1.0);
|
Raise(rx, ry, size, 1.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,10 +34,10 @@ namespace libTerrain
|
||||||
{
|
{
|
||||||
partial class Channel
|
partial class Channel
|
||||||
{
|
{
|
||||||
public Channel normalise()
|
public Channel Normalise()
|
||||||
{
|
{
|
||||||
double max = findMax();
|
double max = FindMax();
|
||||||
double min = findMin();
|
double min = FindMin();
|
||||||
|
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
|
@ -52,10 +52,10 @@ namespace libTerrain
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Channel normalise(double minv, double maxv)
|
public Channel Normalise(double minv, double maxv)
|
||||||
{
|
{
|
||||||
double max = findMax();
|
double max = FindMax();
|
||||||
double min = findMin();
|
double min = FindMin();
|
||||||
|
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ namespace libTerrain
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Channel clip()
|
public Channel Clip()
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
|
@ -82,14 +82,14 @@ namespace libTerrain
|
||||||
{
|
{
|
||||||
for (y = 0; y < h; y++)
|
for (y = 0; y < h; y++)
|
||||||
{
|
{
|
||||||
setClip(x, y, map[x, y]);
|
SetClip(x, y, map[x, y]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Channel clip(double min, double max)
|
public Channel Clip(double min, double max)
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
for (x = 0; x < w; x++)
|
for (x = 0; x < w; x++)
|
||||||
|
@ -105,7 +105,7 @@ namespace libTerrain
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Channel crop(int x1, int y1, int x2, int y2)
|
public Channel Crop(int x1, int y1, int x2, int y2)
|
||||||
{
|
{
|
||||||
int width = x1 - x2 + 1;
|
int width = x1 - x2 + 1;
|
||||||
int height = y1 - y2 + 1;
|
int height = y1 - y2 + 1;
|
||||||
|
@ -130,7 +130,7 @@ namespace libTerrain
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Channel addClip(Channel other)
|
public Channel AddClip(Channel other)
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
for (x = 0; x < w; x++)
|
for (x = 0; x < w; x++)
|
||||||
|
@ -147,7 +147,7 @@ namespace libTerrain
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void smooth(double amount)
|
public void Smooth(double amount)
|
||||||
{
|
{
|
||||||
double area = amount;
|
double area = amount;
|
||||||
double step = amount / 4.0;
|
double step = amount / 4.0;
|
||||||
|
@ -167,7 +167,7 @@ namespace libTerrain
|
||||||
for (l = 0.0 - area; l < area; l += step)
|
for (l = 0.0 - area; l < area; l += step)
|
||||||
{
|
{
|
||||||
avgsteps++;
|
avgsteps++;
|
||||||
average += getBilinearInterpolate(x + n, y + l);
|
average += GetBilinearInterpolate(x + n, y + l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ namespace libTerrain
|
||||||
map = manipulate;
|
map = manipulate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pertubation(double amount)
|
public void Pertubation(double amount)
|
||||||
{
|
{
|
||||||
// Simple pertubation filter
|
// Simple pertubation filter
|
||||||
double[,] manipulated = new double[w, h];
|
double[,] manipulated = new double[w, h];
|
||||||
|
@ -191,14 +191,14 @@ namespace libTerrain
|
||||||
{
|
{
|
||||||
double offset_x = (double)x + (generator.NextDouble() * amount) - (amount / 2.0);
|
double offset_x = (double)x + (generator.NextDouble() * amount) - (amount / 2.0);
|
||||||
double offset_y = (double)y + (generator.NextDouble() * amount) - (amount / 2.0);
|
double offset_y = (double)y + (generator.NextDouble() * amount) - (amount / 2.0);
|
||||||
double p = getBilinearInterpolate(offset_x, offset_y);
|
double p = GetBilinearInterpolate(offset_x, offset_y);
|
||||||
manipulated[x, y] = p;
|
manipulated[x, y] = p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
map = manipulated;
|
map = manipulated;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pertubationMask(Channel mask)
|
public void PertubationMask(Channel mask)
|
||||||
{
|
{
|
||||||
// Simple pertubation filter
|
// Simple pertubation filter
|
||||||
double[,] manipulated = new double[w, h];
|
double[,] manipulated = new double[w, h];
|
||||||
|
@ -225,14 +225,14 @@ namespace libTerrain
|
||||||
if (offset_x < 0)
|
if (offset_x < 0)
|
||||||
offset_x = 0;
|
offset_x = 0;
|
||||||
|
|
||||||
double p = getBilinearInterpolate(offset_x, offset_y);
|
double p = GetBilinearInterpolate(offset_x, offset_y);
|
||||||
manipulated[x, y] = p;
|
manipulated[x, y] = p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
map = manipulated;
|
map = manipulated;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Channel blend(Channel other, double amount)
|
public Channel Blend(Channel other, double amount)
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
for (x = 0; x < w; x++)
|
for (x = 0; x < w; x++)
|
||||||
|
@ -245,7 +245,7 @@ namespace libTerrain
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Channel blend(Channel other, Channel amount)
|
public Channel Blend(Channel other, Channel amount)
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
for (x = 0; x < w; x++)
|
for (x = 0; x < w; x++)
|
||||||
|
|
|
@ -74,14 +74,14 @@ namespace libTerrain
|
||||||
/// <param name="carry">The percentage of rock which can be picked up to pickup 0..1</param>
|
/// <param name="carry">The percentage of rock which can be picked up to pickup 0..1</param>
|
||||||
/// <param name="rounds">The number of erosion rounds (recommended: 25+)</param>
|
/// <param name="rounds">The number of erosion rounds (recommended: 25+)</param>
|
||||||
/// <param name="lowest">Drop sediment at the lowest point?</param>
|
/// <param name="lowest">Drop sediment at the lowest point?</param>
|
||||||
public void AerobicErosion(double windspeed, double pickup_talus_minimum, double drop_talus_minimum, double carry, int rounds, bool lowest, bool usingFluidDynamics)
|
public void AerobicErosion(double windspeed, double pickupTalusMinimum, double dropTalusMinimum, double carry, int rounds, bool lowest, bool usingFluidDynamics)
|
||||||
{
|
{
|
||||||
Channel wind = new Channel(w, h) ;
|
Channel wind = new Channel(w, h) ;
|
||||||
Channel sediment = new Channel(w, h);
|
Channel sediment = new Channel(w, h);
|
||||||
int x, y, i, j;
|
int x, y, i, j;
|
||||||
|
|
||||||
wind = this.copy();
|
wind = this.Copy();
|
||||||
wind.normalise(); // Cheap wind calculations
|
wind.Normalise(); // Cheap wind calculations
|
||||||
wind *= windspeed;
|
wind *= windspeed;
|
||||||
|
|
||||||
if (usingFluidDynamics)
|
if (usingFluidDynamics)
|
||||||
|
@ -90,7 +90,7 @@ namespace libTerrain
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wind.pertubation(30); // Can do better later
|
wind.Pertubation(30); // Can do better later
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < rounds; i++)
|
for (i = 0; i < rounds; i++)
|
||||||
|
@ -100,13 +100,13 @@ namespace libTerrain
|
||||||
{
|
{
|
||||||
for (y = 1; y < h - 1; y++)
|
for (y = 1; y < h - 1; y++)
|
||||||
{
|
{
|
||||||
double me = get(x, y);
|
double me = Get(x, y);
|
||||||
double surfacearea = 0.3; // Everything will erode even if it's flat. Just slower.
|
double surfacearea = 0.3; // Everything will erode even if it's flat. Just slower.
|
||||||
|
|
||||||
for (j = 0; j < 9; j++)
|
for (j = 0; j < 9; j++)
|
||||||
{
|
{
|
||||||
int[] coords = neighbours(NEIGHBOURS.NEIGHBOUR_MOORE, j);
|
int[] coords = Neighbours(NeighbourSystem.Moore, j);
|
||||||
double target = get(x + coords[0], y + coords[1]);
|
double target = Get(x + coords[0], y + coords[1]);
|
||||||
|
|
||||||
surfacearea += Math.Abs(target - me);
|
surfacearea += Math.Abs(target - me);
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ namespace libTerrain
|
||||||
if (amount < 0)
|
if (amount < 0)
|
||||||
amount = 0;
|
amount = 0;
|
||||||
|
|
||||||
if (surfacearea > pickup_talus_minimum)
|
if (surfacearea > pickupTalusMinimum)
|
||||||
{
|
{
|
||||||
this.map[x, y] -= amount;
|
this.map[x, y] -= amount;
|
||||||
sediment.map[x, y] += amount;
|
sediment.map[x, y] += amount;
|
||||||
|
@ -131,9 +131,9 @@ namespace libTerrain
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wind.pertubation(15); // Can do better later
|
wind.Pertubation(15); // Can do better later
|
||||||
wind.seed++;
|
wind.seed++;
|
||||||
sediment.pertubation(10); // Sediment is blown around a bit
|
sediment.Pertubation(10); // Sediment is blown around a bit
|
||||||
sediment.seed++;
|
sediment.seed++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,15 +142,15 @@ namespace libTerrain
|
||||||
{
|
{
|
||||||
for (y = 1; y < h - 1; y++)
|
for (y = 1; y < h - 1; y++)
|
||||||
{
|
{
|
||||||
double me = get(x, y);
|
double me = Get(x, y);
|
||||||
double surfacearea = 0.01; // Flat land does not get deposition
|
double surfacearea = 0.01; // Flat land does not get deposition
|
||||||
double min = double.MaxValue;
|
double min = double.MaxValue;
|
||||||
int[] minside = new int[2];
|
int[] minside = new int[2];
|
||||||
|
|
||||||
for (j = 0; j < 9; j++)
|
for (j = 0; j < 9; j++)
|
||||||
{
|
{
|
||||||
int[] coords = neighbours(NEIGHBOURS.NEIGHBOUR_MOORE, j);
|
int[] coords = Neighbours(NeighbourSystem.Moore, j);
|
||||||
double target = get(x + coords[0], y + coords[1]);
|
double target = Get(x + coords[0], y + coords[1]);
|
||||||
|
|
||||||
surfacearea += Math.Abs(target - me);
|
surfacearea += Math.Abs(target - me);
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ namespace libTerrain
|
||||||
if (amount < 0)
|
if (amount < 0)
|
||||||
amount = 0;
|
amount = 0;
|
||||||
|
|
||||||
if (surfacearea > drop_talus_minimum)
|
if (surfacearea > dropTalusMinimum)
|
||||||
{
|
{
|
||||||
this.map[x + minside[0], y + minside[1]] += amount;
|
this.map[x + minside[0], y + minside[1]] += amount;
|
||||||
sediment.map[x, y] -= amount;
|
sediment.map[x, y] -= amount;
|
||||||
|
@ -178,7 +178,7 @@ namespace libTerrain
|
||||||
|
|
||||||
Channel myself = this;
|
Channel myself = this;
|
||||||
myself += sediment;
|
myself += sediment;
|
||||||
myself.normalise();
|
myself.Normalise();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -34,17 +34,17 @@ namespace libTerrain
|
||||||
{
|
{
|
||||||
partial class Channel
|
partial class Channel
|
||||||
{
|
{
|
||||||
public void hydraulicErosion(Channel rain, double evaporation, double solubility, int frequency, int rounds)
|
public void HydraulicErosion(Channel rain, double evaporation, double solubility, int frequency, int rounds)
|
||||||
{
|
{
|
||||||
Channel water = new Channel(w, h);
|
Channel water = new Channel(w, h);
|
||||||
Channel sediment = new Channel(w, h);
|
Channel sediment = new Channel(w, h);
|
||||||
Channel terrain = this;
|
Channel terrain = this;
|
||||||
Channel waterFlow = new Channel(w, h);
|
Channel waterFlow = new Channel(w, h);
|
||||||
|
|
||||||
NEIGHBOURS type = NEIGHBOURS.NEIGHBOUR_MOORE;
|
NeighbourSystem type = NeighbourSystem.Moore;
|
||||||
int NEIGHBOUR_ME = 4;
|
int NEIGHBOUR_ME = 4;
|
||||||
|
|
||||||
int NEIGHBOUR_MAX = type == NEIGHBOURS.NEIGHBOUR_MOORE ? 9 : 5;
|
int NEIGHBOUR_MAX = type == NeighbourSystem.Moore ? 9 : 5;
|
||||||
|
|
||||||
for (int i = 0; i < rounds; i++)
|
for (int i = 0; i < rounds; i++)
|
||||||
{
|
{
|
||||||
|
@ -66,7 +66,7 @@ namespace libTerrain
|
||||||
{
|
{
|
||||||
if (j != NEIGHBOUR_ME)
|
if (j != NEIGHBOUR_ME)
|
||||||
{
|
{
|
||||||
int[] coords = neighbours(type, j);
|
int[] coords = Neighbours(type, j);
|
||||||
coords[0] += x;
|
coords[0] += x;
|
||||||
coords[1] += y;
|
coords[1] += y;
|
||||||
|
|
||||||
|
@ -107,13 +107,13 @@ namespace libTerrain
|
||||||
{
|
{
|
||||||
if (j != NEIGHBOUR_ME)
|
if (j != NEIGHBOUR_ME)
|
||||||
{
|
{
|
||||||
int[] coords = neighbours(type, j);
|
int[] coords = Neighbours(type, j);
|
||||||
coords[0] += x;
|
coords[0] += x;
|
||||||
coords[1] += y;
|
coords[1] += y;
|
||||||
|
|
||||||
if (diffs[j] > 0)
|
if (diffs[j] > 0)
|
||||||
{
|
{
|
||||||
waterFlow.setWrap(coords[0], coords[1], waterFlow.map[coords[0], coords[1]] + diffs[j] * totalInverseDiff);
|
waterFlow.SetWrap(coords[0], coords[1], waterFlow.map[coords[0], coords[1]] + diffs[j] * totalInverseDiff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ namespace libTerrain
|
||||||
}
|
}
|
||||||
|
|
||||||
water += waterFlow;
|
water += waterFlow;
|
||||||
waterFlow.fill(0);
|
waterFlow.Fill(0);
|
||||||
|
|
||||||
water *= evaporation;
|
water *= evaporation;
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace libTerrain
|
||||||
/// <param name="talus">The rock angle (represented as a dy/dx ratio) at which point it will be succeptible to breakage</param>
|
/// <param name="talus">The rock angle (represented as a dy/dx ratio) at which point it will be succeptible to breakage</param>
|
||||||
/// <param name="rounds">The number of erosion rounds</param>
|
/// <param name="rounds">The number of erosion rounds</param>
|
||||||
/// <param name="c">The amount of rock to carry each round</param>
|
/// <param name="c">The amount of rock to carry each round</param>
|
||||||
public Channel thermalWeathering(double talus, int rounds, double c)
|
public Channel ThermalWeathering(double talus, int rounds, double c)
|
||||||
{
|
{
|
||||||
double[,] lastFrame;
|
double[,] lastFrame;
|
||||||
double[,] thisFrame;
|
double[,] thisFrame;
|
||||||
|
@ -48,10 +48,10 @@ namespace libTerrain
|
||||||
lastFrame = (double[,])map.Clone();
|
lastFrame = (double[,])map.Clone();
|
||||||
thisFrame = (double[,])map.Clone();
|
thisFrame = (double[,])map.Clone();
|
||||||
|
|
||||||
NEIGHBOURS type = NEIGHBOURS.NEIGHBOUR_MOORE; // Using moore neighbourhood (twice as computationally expensive)
|
NeighbourSystem type = NeighbourSystem.Moore; // Using moore neighbourhood (twice as computationally expensive)
|
||||||
int NEIGHBOUR_ME = 4; // I am always 4 in both systems.
|
int NEIGHBOUR_ME = 4; // I am always 4 in both systems.
|
||||||
|
|
||||||
int NEIGHBOUR_MAX = type == NEIGHBOURS.NEIGHBOUR_MOORE ? 9 : 5;
|
int NEIGHBOUR_MAX = type == NeighbourSystem.Moore ? 9 : 5;
|
||||||
|
|
||||||
int frames = rounds; // Number of thermal erosion iterations to run
|
int frames = rounds; // Number of thermal erosion iterations to run
|
||||||
int i, j;
|
int i, j;
|
||||||
|
@ -67,7 +67,7 @@ namespace libTerrain
|
||||||
{
|
{
|
||||||
if (j != NEIGHBOUR_ME)
|
if (j != NEIGHBOUR_ME)
|
||||||
{
|
{
|
||||||
int[] coords = neighbours(type, j);
|
int[] coords = Neighbours(type, j);
|
||||||
|
|
||||||
coords[0] += x;
|
coords[0] += x;
|
||||||
coords[1] += y;
|
coords[1] += y;
|
||||||
|
@ -103,7 +103,7 @@ namespace libTerrain
|
||||||
|
|
||||||
map = thisFrame;
|
map = thisFrame;
|
||||||
|
|
||||||
normalise(); // Just to guaruntee a smooth 0..1 value
|
Normalise(); // Just to guaruntee a smooth 0..1 value
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,13 +34,13 @@ namespace libTerrain
|
||||||
{
|
{
|
||||||
partial class Channel
|
partial class Channel
|
||||||
{
|
{
|
||||||
enum NEIGHBOURS
|
enum NeighbourSystem
|
||||||
{
|
{
|
||||||
NEIGHBOUR_MOORE,
|
Moore,
|
||||||
NEIGHBOUR_VONNEUMANN
|
VonNeumann
|
||||||
};
|
};
|
||||||
|
|
||||||
private int[] neighbours(NEIGHBOURS type, int index)
|
private int[] Neighbours(NeighbourSystem type, int index)
|
||||||
{
|
{
|
||||||
int[] coord = new int[2];
|
int[] coord = new int[2];
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ namespace libTerrain
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case NEIGHBOURS.NEIGHBOUR_MOORE:
|
case NeighbourSystem.Moore:
|
||||||
switch (index)
|
switch (index)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -101,7 +101,7 @@ namespace libTerrain
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NEIGHBOURS.NEIGHBOUR_VONNEUMANN:
|
case NeighbourSystem.VonNeumann:
|
||||||
switch (index)
|
switch (index)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
|
|
|
@ -22,6 +22,7 @@ CREATE TABLE `regions` (
|
||||||
`regionUserURI` varchar(255) default NULL,
|
`regionUserURI` varchar(255) default NULL,
|
||||||
`regionUserRecvKey` varchar(128) default NULL,
|
`regionUserRecvKey` varchar(128) default NULL,
|
||||||
`regionUserSendKey` varchar(128) default NULL, `regionMapTexture` varchar(36) default NULL,
|
`regionUserSendKey` varchar(128) default NULL, `regionMapTexture` varchar(36) default NULL,
|
||||||
|
`serverHttpPort` int(10) default NULL, `serverRemotingPort` int(10) default NULL,
|
||||||
PRIMARY KEY (`uuid`),
|
PRIMARY KEY (`uuid`),
|
||||||
KEY `regionName` (`regionName`),
|
KEY `regionName` (`regionName`),
|
||||||
KEY `regionHandle` (`regionHandle`),
|
KEY `regionHandle` (`regionHandle`),
|
||||||
|
|
Loading…
Reference in New Issue