diff options
author | Adam Frisby | 2007-07-24 05:22:33 +0000 |
---|---|---|
committer | Adam Frisby | 2007-07-24 05:22:33 +0000 |
commit | d8997b59d30b63218f594d840d924a10287ce509 (patch) | |
tree | f96960b2605c8da0d6b0a0d9a905db28a62fca67 /OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs | |
parent | * Terrain Fracture Generator now produces more appropriate results. (diff) | |
download | opensim-SC-d8997b59d30b63218f594d840d924a10287ce509.zip opensim-SC-d8997b59d30b63218f594d840d924a10287ce509.tar.gz opensim-SC-d8997b59d30b63218f594d840d924a10287ce509.tar.bz2 opensim-SC-d8997b59d30b63218f594d840d924a10287ce509.tar.xz |
* Terrain should now send just updated patches.
Diffstat (limited to 'OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs')
-rw-r--r-- | OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs index a9106b4..a39db50 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs | |||
@@ -36,6 +36,8 @@ namespace libTerrain | |||
36 | { | 36 | { |
37 | public Channel Normalise() | 37 | public Channel Normalise() |
38 | { | 38 | { |
39 | SetDiff(); | ||
40 | |||
39 | double max = FindMax(); | 41 | double max = FindMax(); |
40 | double min = FindMin(); | 42 | double min = FindMin(); |
41 | 43 | ||
@@ -54,6 +56,8 @@ namespace libTerrain | |||
54 | 56 | ||
55 | public Channel Normalise(double minv, double maxv) | 57 | public Channel Normalise(double minv, double maxv) |
56 | { | 58 | { |
59 | SetDiff(); | ||
60 | |||
57 | double max = FindMax(); | 61 | double max = FindMax(); |
58 | double min = FindMin(); | 62 | double min = FindMin(); |
59 | 63 | ||
@@ -99,7 +103,8 @@ namespace libTerrain | |||
99 | double val = map[x, y]; | 103 | double val = map[x, y]; |
100 | if (val > max) val = max; | 104 | if (val > max) val = max; |
101 | if (val < min) val = min; | 105 | if (val < min) val = min; |
102 | map[x, y] = val; | 106 | |
107 | Set(x, y, val); | ||
103 | } | 108 | } |
104 | } | 109 | } |
105 | return this; | 110 | return this; |
@@ -132,6 +137,8 @@ namespace libTerrain | |||
132 | 137 | ||
133 | public Channel AddClip(Channel other) | 138 | public Channel AddClip(Channel other) |
134 | { | 139 | { |
140 | SetDiff(); | ||
141 | |||
135 | int x, y; | 142 | int x, y; |
136 | for (x = 0; x < w; x++) | 143 | for (x = 0; x < w; x++) |
137 | { | 144 | { |
@@ -149,6 +156,8 @@ namespace libTerrain | |||
149 | 156 | ||
150 | public void Smooth(double amount) | 157 | public void Smooth(double amount) |
151 | { | 158 | { |
159 | SetDiff(); | ||
160 | |||
152 | double area = amount; | 161 | double area = amount; |
153 | double step = amount / 4.0; | 162 | double step = amount / 4.0; |
154 | 163 | ||
@@ -179,6 +188,8 @@ namespace libTerrain | |||
179 | 188 | ||
180 | public void Pertubation(double amount) | 189 | public void Pertubation(double amount) |
181 | { | 190 | { |
191 | SetDiff(); | ||
192 | |||
182 | // Simple pertubation filter | 193 | // Simple pertubation filter |
183 | double[,] manipulated = new double[w, h]; | 194 | double[,] manipulated = new double[w, h]; |
184 | Random generator = new Random(seed); // Seeds FTW! | 195 | Random generator = new Random(seed); // Seeds FTW! |
@@ -227,6 +238,7 @@ namespace libTerrain | |||
227 | 238 | ||
228 | double p = GetBilinearInterpolate(offset_x, offset_y); | 239 | double p = GetBilinearInterpolate(offset_x, offset_y); |
229 | manipulated[x, y] = p; | 240 | manipulated[x, y] = p; |
241 | SetDiff(x, y); | ||
230 | } | 242 | } |
231 | } | 243 | } |
232 | map = manipulated; | 244 | map = manipulated; |
@@ -239,7 +251,7 @@ namespace libTerrain | |||
239 | { | 251 | { |
240 | for (y = 0; y < h; y++) | 252 | for (y = 0; y < h; y++) |
241 | { | 253 | { |
242 | map[x, y] = Tools.linearInterpolate(map[x,y],other.map[x,y],amount); | 254 | Set(x, y, Tools.linearInterpolate(map[x, y], other.map[x, y], amount)); |
243 | } | 255 | } |
244 | } | 256 | } |
245 | return this; | 257 | return this; |
@@ -252,7 +264,7 @@ namespace libTerrain | |||
252 | { | 264 | { |
253 | for (y = 0; y < h; y++) | 265 | for (y = 0; y < h; y++) |
254 | { | 266 | { |
255 | map[x, y] = Tools.linearInterpolate(map[x, y], other.map[x, y], amount.map[x,y]); | 267 | Set(x, y, Tools.linearInterpolate(map[x, y], other.map[x, y], amount.map[x, y])); |
256 | } | 268 | } |
257 | } | 269 | } |
258 | return this; | 270 | return this; |