aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD
diff options
context:
space:
mode:
authorAdam Frisby2007-09-25 11:48:43 +0000
committerAdam Frisby2007-09-25 11:48:43 +0000
commit569ba9eb9acb9f024060a41ee4188a11aafa3fa7 (patch)
tree63cec15a6c0338a8777640ed13fd7c3ce05eeba7 /OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD
parentfix order issue with prebuild.xml, we need to build Local before (diff)
downloadopensim-SC_OLD-569ba9eb9acb9f024060a41ee4188a11aafa3fa7.zip
opensim-SC_OLD-569ba9eb9acb9f024060a41ee4188a11aafa3fa7.tar.gz
opensim-SC_OLD-569ba9eb9acb9f024060a41ee4188a11aafa3fa7.tar.bz2
opensim-SC_OLD-569ba9eb9acb9f024060a41ee4188a11aafa3fa7.tar.xz
Terrain:
* Attempted fix for lag/pause when doing lots of updates. * Some naming fixes to libTerrain. * Refactored terrain bitmap generation into a common call for both world map and export. General: * Switched some calls to Console.WriteLine to use MainLog.Warn/Verbose/Notice.
Diffstat (limited to 'OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD')
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs2
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs10
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs4
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Tools.cs8
4 files changed, 13 insertions, 11 deletions
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs
index 8e894ab..45bb06b 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs
@@ -115,7 +115,7 @@ namespace libTerrain
115 if (z < 0) 115 if (z < 0)
116 z = 0; 116 z = 0;
117 117
118 Set(x, y, Tools.linearInterpolate(map[x, y], height, z)); 118 Set(x, y, Tools.LinearInterpolate(map[x, y], height, z));
119 } 119 }
120 } 120 }
121 } 121 }
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs
index 3e88aa9..3a9b7f7 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs
@@ -100,7 +100,7 @@ namespace libTerrain
100 { 100 {
101 for (int y = 0; y < h; y++) 101 for (int y = 0; y < h; y++)
102 { 102 {
103 double miny = Tools.linearInterpolate(a[1], b[1], (double)x / (double)w); 103 double miny = Tools.LinearInterpolate(a[1], b[1], (double)x / (double)w);
104 104
105 if (v >= 0.5) 105 if (v >= 0.5)
106 { 106 {
@@ -108,14 +108,14 @@ namespace libTerrain
108 { 108 {
109 if (y > miny) 109 if (y > miny)
110 { 110 {
111 map[x, y] += Tools.linearInterpolate(scalemin, scalemax, z); 111 map[x, y] += Tools.LinearInterpolate(scalemin, scalemax, z);
112 } 112 }
113 } 113 }
114 else 114 else
115 { 115 {
116 if (y < miny) 116 if (y < miny)
117 { 117 {
118 map[x, y] += Tools.linearInterpolate(scalemin, scalemax, z); 118 map[x, y] += Tools.LinearInterpolate(scalemin, scalemax, z);
119 } 119 }
120 } 120 }
121 } 121 }
@@ -125,14 +125,14 @@ namespace libTerrain
125 { 125 {
126 if (x > miny) 126 if (x > miny)
127 { 127 {
128 map[x, y] += Tools.linearInterpolate(scalemin, scalemax, z); 128 map[x, y] += Tools.LinearInterpolate(scalemin, scalemax, z);
129 } 129 }
130 } 130 }
131 else 131 else
132 { 132 {
133 if (x < miny) 133 if (x < miny)
134 { 134 {
135 map[x, y] += Tools.linearInterpolate(scalemin, scalemax, z); 135 map[x, y] += Tools.LinearInterpolate(scalemin, scalemax, z);
136 } 136 }
137 } 137 }
138 } 138 }
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs
index 0930a36..0155791 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs
@@ -341,7 +341,7 @@ namespace libTerrain
341 { 341 {
342 for (y = 0; y < h; y++) 342 for (y = 0; y < h; y++)
343 { 343 {
344 Set(x, y, Tools.linearInterpolate(map[x, y], other.map[x, y], amount)); 344 Set(x, y, Tools.LinearInterpolate(map[x, y], other.map[x, y], amount));
345 } 345 }
346 } 346 }
347 return this; 347 return this;
@@ -354,7 +354,7 @@ namespace libTerrain
354 { 354 {
355 for (y = 0; y < h; y++) 355 for (y = 0; y < h; y++)
356 { 356 {
357 Set(x, y, Tools.linearInterpolate(map[x, y], other.map[x, y], amount.map[x, y])); 357 Set(x, y, Tools.LinearInterpolate(map[x, y], other.map[x, y], amount.map[x, y]));
358 } 358 }
359 } 359 }
360 return this; 360 return this;
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Tools.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Tools.cs
index 60dbf62..13338a2 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Tools.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Tools.cs
@@ -37,17 +37,19 @@ namespace libTerrain
37{ 37{
38 class Tools 38 class Tools
39 { 39 {
40 public static double linearInterpolate(double a, double b, double amount) 40 public static double LinearInterpolate(double a, double b, double amount)
41 { 41 {
42 return a + ((b - a) * amount); 42 return a + ((b - a) * amount);
43 } 43 }
44 public static double exponentialInterpolate(double a, double b, double amount) 44
45 public static double ExponentialInterpolate(double a, double b, double amount)
45 { 46 {
46 a = Math.Pow(a, amount); 47 a = Math.Pow(a, amount);
47 b = Math.Pow(b - a, 1.0 - amount); 48 b = Math.Pow(b - a, 1.0 - amount);
48 return a+b; 49 return a+b;
49 } 50 }
50 public static int powerOf2Log2(int n) { 51
52 public static int PowerOf2Log2(int n) {
51 for (int i = 0; i < 31; i++) { 53 for (int i = 0; i < 31; i++) {
52 if ((n & 1) == 1) { 54 if ((n & 1) == 1) {
53 return i; 55 return i;