aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/TerrainData.cs
diff options
context:
space:
mode:
authorUbitUmarov2019-01-20 02:02:24 +0000
committerUbitUmarov2019-01-20 02:02:24 +0000
commit3bfa278984c40418c9742e8890ce2596d3f86e55 (patch)
tree141df34738985964e980073aa9fb431e5ce8f5a7 /OpenSim/Framework/TerrainData.cs
parentcosmetics (diff)
downloadopensim-SC-3bfa278984c40418c9742e8890ce2596d3f86e55.zip
opensim-SC-3bfa278984c40418c9742e8890ce2596d3f86e55.tar.gz
opensim-SC-3bfa278984c40418c9742e8890ce2596d3f86e55.tar.bz2
opensim-SC-3bfa278984c40418c9742e8890ce2596d3f86e55.tar.xz
cosmetics
Diffstat (limited to 'OpenSim/Framework/TerrainData.cs')
-rw-r--r--OpenSim/Framework/TerrainData.cs50
1 files changed, 39 insertions, 11 deletions
diff --git a/OpenSim/Framework/TerrainData.cs b/OpenSim/Framework/TerrainData.cs
index 5cec2b5..f99dd00 100644
--- a/OpenSim/Framework/TerrainData.cs
+++ b/OpenSim/Framework/TerrainData.cs
@@ -80,6 +80,10 @@ namespace OpenSim.Framework
80 80
81 public abstract float[] GetFloatsSerialized(); 81 public abstract float[] GetFloatsSerialized();
82 public abstract double[,] GetDoubles(); 82 public abstract double[,] GetDoubles();
83
84 public abstract void GetPatchMinMax(int px, int py, out float zmin, out float zmax);
85 public abstract void GetPatchBlock(ref float[] block, int px, int py, float sub, float premult);
86
83 public abstract TerrainData Clone(); 87 public abstract TerrainData Clone();
84 } 88 }
85 89
@@ -275,6 +279,37 @@ namespace OpenSim.Framework
275 return ret; 279 return ret;
276 } 280 }
277 281
282 public override void GetPatchMinMax(int px, int py, out float zmin, out float zmax)
283 {
284 zmax = float.MinValue;
285 zmin = float.MaxValue;
286
287 int startx = px * 16;
288 int starty = py * 16;
289 for (int i = startx; i < startx + 16; i++)
290 {
291 for (int j = starty; j < starty + 16; j++)
292 {
293 float val = m_heightmap[i, j];
294 if (val > zmax) zmax = val;
295 if (val < zmin) zmin = val;
296 }
297 }
298 }
299
300 public override void GetPatchBlock(ref float[] block, int px, int py, float sub, float premult)
301 {
302 int k = 0;
303 int startX = px * 16;
304 int startY = py * 16;
305 for (int y = startY; y < startY + 16; y++)
306 {
307 for (int x = startX; x < startX + 16; x++)
308 {
309 block[k++] = (m_heightmap[x, y] - sub) * premult;
310 }
311 }
312 }
278 313
279 // ============================================================= 314 // =============================================================
280 315
@@ -476,13 +511,9 @@ namespace OpenSim.Framework
476 ret = str.ToArray(); 511 ret = str.ToArray();
477 } 512 }
478 } 513 }
479 catch 514 catch {}
480 {
481 515
482 } 516 m_log.DebugFormat("{0} V2D {1} bytes", LogHeader, ret.Length);
483
484 m_log.DebugFormat("{0} V2D {1} bytes",
485 LogHeader, ret.Length);
486 517
487 return ret; 518 return ret;
488 } 519 }
@@ -520,12 +551,9 @@ namespace OpenSim.Framework
520 } 551 }
521 } 552 }
522 } 553 }
523 catch 554 catch {}
524 {
525 555
526 } 556 m_log.DebugFormat("{0} V2DGzip {1} bytes", LogHeader, ret.Length);
527 m_log.DebugFormat("{0} V2DGzip {1} bytes",
528 LogHeader, ret.Length);
529 return ret; 557 return ret;
530 } 558 }
531 559