From 00d042f3d18483a5ca54c605d2aa22c6c330e9eb Mon Sep 17 00:00:00 2001
From: Dahlia Trimble
Date: Thu, 18 Jun 2009 23:02:12 +0000
Subject: Thanks Michelle Argus for Mantis #0003742: Terrain editor - Flatten
tool lowers Land
---
.../Region/ClientStack/LindenUDP/LLClientView.cs | 1 -
.../World/Terrain/PaintBrushes/FlattenSphere.cs | 53 +++++++---------------
.../CoreModules/World/Terrain/TerrainModule.cs | 5 +-
3 files changed, 21 insertions(+), 38 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 9ae5415..98c84ae 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -5028,7 +5028,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
handlerModifyTerrain = OnModifyTerrain;
if (handlerModifyTerrain != null)
{
- modify.ModifyBlock.Height = -1; // Hack, i don't know why the value is wrong
handlerModifyTerrain(AgentId, modify.ModifyBlock.Height, modify.ModifyBlock.Seconds,
modify.ModifyBlock.BrushSize,
modify.ModifyBlock.Action, modify.ParcelData[i].North,
diff --git a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/FlattenSphere.cs b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/FlattenSphere.cs
index 2fa0c3f..9aa3dff 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/FlattenSphere.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/FlattenSphere.cs
@@ -41,34 +41,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes
int x, y;
- duration = 0.009; //MCP Should be read from ini file
-
- // Disabled - just use the client value.
- /*
- if (rz < 0) {
- double sum = 0.0;
- double step2 = 0.0;
-
-
- // compute delta map
- for (x = 0; x < map.Width; x++)
- {
- for (y = 0; y < map.Height; y++)
- {
- double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength);
-
- if (z > 0) // add in non-zero amount
- {
- sum += map[x, y] * z;
- step2 += z;
- }
- }
- }
- rz = sum / step2;
- }
- */
-
-
// blend in map
for (x = 0; x < map.Width; x++)
{
@@ -77,19 +49,28 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes
if (!mask[x,y])
continue;
- double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength) * duration;
-
- if (z > 0) // add in non-zero amount
+ double z;
+ if (duration < 4.0)
{
- if (z > 1.0)
- z = 1.0;
-
- map[x, y] = (map[x, y] * (1.0 - z)) + (rz * z);
+ z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength) * duration * 0.25;
+ }
+ else {
+ z = 1.0;
}
double delta = rz - map[x, y];
if (Math.Abs(delta) > 0.1)
- delta *= 0.25;
+ {
+ if (z > 1.0)
+ {
+ z = 1.0;
+ }
+ else if (z < 0.0)
+ {
+ z = 0.0;
+ }
+ delta *= z;
+ }
if (delta != 0) // add in non-zero amount
{
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
index 08b1830..4d01f22 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
@@ -299,7 +299,10 @@ namespace OpenSim.Region.CoreModules.World.Terrain
/// UUID of script-owner
public void ModifyTerrain(UUID user, Vector3 pos, byte size, byte action, UUID agentId)
{
- client_OnModifyTerrain(user, (float)pos.Z, (float)0.25, size, action, pos.Y, pos.X, pos.Y, pos.X, agentId);
+ float duration = 0.25f;
+ if (action == 0)
+ duration = 4.0f;
+ client_OnModifyTerrain(user, (float)pos.Z, duration, size, action, pos.Y, pos.X, pos.Y, pos.X, agentId);
}
///
--
cgit v1.1