diff options
author | UbitUmarov | 2015-08-25 13:36:45 +0100 |
---|---|---|
committer | UbitUmarov | 2015-08-25 13:36:45 +0100 |
commit | 64d05bab0fe9e12038309275a677e68518fb9b15 (patch) | |
tree | c9c6049f06b2462d18029404c4f6119ea87f209f /OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | |
parent | let mysql be happy with a NULL heighmap ( yeap i made several ) (diff) | |
download | opensim-SC_OLD-64d05bab0fe9e12038309275a677e68518fb9b15.zip opensim-SC_OLD-64d05bab0fe9e12038309275a677e68518fb9b15.tar.gz opensim-SC_OLD-64d05bab0fe9e12038309275a677e68518fb9b15.tar.bz2 opensim-SC_OLD-64d05bab0fe9e12038309275a677e68518fb9b15.tar.xz |
terrain stored as ushorts with gzip compression
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | 49 |
1 files changed, 43 insertions, 6 deletions
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index 118c8f8..135fe50 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | |||
@@ -1349,6 +1349,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1349 | double desiredMin = (double)args[0]; | 1349 | double desiredMin = (double)args[0]; |
1350 | double desiredMax = (double)args[1]; | 1350 | double desiredMax = (double)args[1]; |
1351 | 1351 | ||
1352 | if (desiredMin < 0 || desiredMin > 655.35 | ||
1353 | || desiredMax < 0 || desiredMax > 655.35) | ||
1354 | { | ||
1355 | m_log.Error("desired Min and Max must be in range 0.0 to 655.0m"); | ||
1356 | return; | ||
1357 | } | ||
1358 | |||
1352 | // determine desired scaling factor | 1359 | // determine desired scaling factor |
1353 | double desiredRange = desiredMax - desiredMin; | 1360 | double desiredRange = desiredMax - desiredMin; |
1354 | //m_log.InfoFormat("Desired {0}, {1} = {2}", new Object[] { desiredMin, desiredMax, desiredRange }); | 1361 | //m_log.InfoFormat("Desired {0}, {1} = {2}", new Object[] { desiredMin, desiredMax, desiredRange }); |
@@ -1405,45 +1412,69 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1405 | 1412 | ||
1406 | private void InterfaceElevateTerrain(Object[] args) | 1413 | private void InterfaceElevateTerrain(Object[] args) |
1407 | { | 1414 | { |
1415 | double val = (double)args[0]; | ||
1416 | if (val < 0 || val > 655.35) | ||
1417 | { | ||
1418 | m_log.Error("elevation must be in range 0.0 to 655.0m"); | ||
1419 | return; | ||
1420 | } | ||
1421 | |||
1408 | int x, y; | 1422 | int x, y; |
1409 | for (x = 0; x < m_channel.Width; x++) | 1423 | for (x = 0; x < m_channel.Width; x++) |
1410 | for (y = 0; y < m_channel.Height; y++) | 1424 | for (y = 0; y < m_channel.Height; y++) |
1411 | m_channel[x, y] += (double) args[0]; | 1425 | m_channel[x, y] += val; |
1412 | } | 1426 | } |
1413 | 1427 | ||
1414 | private void InterfaceMultiplyTerrain(Object[] args) | 1428 | private void InterfaceMultiplyTerrain(Object[] args) |
1415 | { | 1429 | { |
1416 | int x, y; | 1430 | int x, y; |
1431 | double val = (double)args[0]; | ||
1432 | |||
1417 | for (x = 0; x < m_channel.Width; x++) | 1433 | for (x = 0; x < m_channel.Width; x++) |
1418 | for (y = 0; y < m_channel.Height; y++) | 1434 | for (y = 0; y < m_channel.Height; y++) |
1419 | m_channel[x, y] *= (double) args[0]; | 1435 | m_channel[x, y] *= val; |
1420 | } | 1436 | } |
1421 | 1437 | ||
1422 | private void InterfaceLowerTerrain(Object[] args) | 1438 | private void InterfaceLowerTerrain(Object[] args) |
1423 | { | 1439 | { |
1424 | int x, y; | 1440 | int x, y; |
1441 | double val = (double)args[0]; | ||
1442 | if (val < 0 || val > 655.35) | ||
1443 | |||
1425 | for (x = 0; x < m_channel.Width; x++) | 1444 | for (x = 0; x < m_channel.Width; x++) |
1426 | for (y = 0; y < m_channel.Height; y++) | 1445 | for (y = 0; y < m_channel.Height; y++) |
1427 | m_channel[x, y] -= (double) args[0]; | 1446 | m_channel[x, y] -= val; |
1428 | } | 1447 | } |
1429 | 1448 | ||
1430 | public void InterfaceFillTerrain(Object[] args) | 1449 | public void InterfaceFillTerrain(Object[] args) |
1431 | { | 1450 | { |
1432 | int x, y; | 1451 | int x, y; |
1452 | double val = (double)args[0]; | ||
1453 | if (val < 0 || val > 655.35) | ||
1454 | { | ||
1455 | m_log.Error("height must be in range 0.0 to 655.0m"); | ||
1456 | return; | ||
1457 | } | ||
1433 | 1458 | ||
1434 | for (x = 0; x < m_channel.Width; x++) | 1459 | for (x = 0; x < m_channel.Width; x++) |
1435 | for (y = 0; y < m_channel.Height; y++) | 1460 | for (y = 0; y < m_channel.Height; y++) |
1436 | m_channel[x, y] = (double) args[0]; | 1461 | m_channel[x, y] = val; |
1437 | } | 1462 | } |
1438 | 1463 | ||
1439 | private void InterfaceMinTerrain(Object[] args) | 1464 | private void InterfaceMinTerrain(Object[] args) |
1440 | { | 1465 | { |
1441 | int x, y; | 1466 | int x, y; |
1467 | double val = (double)args[0]; | ||
1468 | if (val < 0 || val > 655.35) | ||
1469 | { | ||
1470 | m_log.Error("minimum must be in range 0.0 to 655.0m"); | ||
1471 | return; | ||
1472 | } | ||
1442 | for (x = 0; x < m_channel.Width; x++) | 1473 | for (x = 0; x < m_channel.Width; x++) |
1443 | { | 1474 | { |
1444 | for (y = 0; y < m_channel.Height; y++) | 1475 | for (y = 0; y < m_channel.Height; y++) |
1445 | { | 1476 | { |
1446 | m_channel[x, y] = Math.Max((double)args[0], m_channel[x, y]); | 1477 | m_channel[x, y] = Math.Max(val, m_channel[x, y]); |
1447 | } | 1478 | } |
1448 | } | 1479 | } |
1449 | } | 1480 | } |
@@ -1451,11 +1482,17 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1451 | private void InterfaceMaxTerrain(Object[] args) | 1482 | private void InterfaceMaxTerrain(Object[] args) |
1452 | { | 1483 | { |
1453 | int x, y; | 1484 | int x, y; |
1485 | double val = (double)args[0]; | ||
1486 | if (val < 0 || val > 655.35) | ||
1487 | { | ||
1488 | m_log.Error("maximum must be in range 0.0 to 655.0m"); | ||
1489 | return; | ||
1490 | } | ||
1454 | for (x = 0; x < m_channel.Width; x++) | 1491 | for (x = 0; x < m_channel.Width; x++) |
1455 | { | 1492 | { |
1456 | for (y = 0; y < m_channel.Height; y++) | 1493 | for (y = 0; y < m_channel.Height; y++) |
1457 | { | 1494 | { |
1458 | m_channel[x, y] = Math.Min((double)args[0], m_channel[x, y]); | 1495 | m_channel[x, y] = Math.Min(val, m_channel[x, y]); |
1459 | } | 1496 | } |
1460 | } | 1497 | } |
1461 | } | 1498 | } |