aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorCharles Krinke2008-10-25 14:07:35 +0000
committerCharles Krinke2008-10-25 14:07:35 +0000
commit4e14aa44c7b7ed9564dd34d797b8a4d577bba684 (patch)
treeb17170a6cdba7bd9b1d49cf7d068d044d88db24e
parentA few more bots to yesterday's plumbing: change instant message method (diff)
downloadopensim-SC_OLD-4e14aa44c7b7ed9564dd34d797b8a4d577bba684.zip
opensim-SC_OLD-4e14aa44c7b7ed9564dd34d797b8a4d577bba684.tar.gz
opensim-SC_OLD-4e14aa44c7b7ed9564dd34d797b8a4d577bba684.tar.bz2
opensim-SC_OLD-4e14aa44c7b7ed9564dd34d797b8a4d577bba684.tar.xz
Thank you kindly, Tglion for a patch that:
Support of strength-slider in latest sl-client (1.21.6) Added a patch, which includes the support of strength-slider in latest sl-client (1.21.6) for Raise- and LowerSphere.
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/LowerSphere.cs36
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RaiseSphere.cs35
2 files changed, 51 insertions, 20 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/LowerSphere.cs b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/LowerSphere.cs
index fe82396..290711f 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/LowerSphere.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/LowerSphere.cs
@@ -36,29 +36,43 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
36 36
37 public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration) 37 public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration)
38 { 38 {
39 strength = TerrainUtil.MetersToSphericalStrength(strength); 39 int s = (int) (Math.Pow(2, strength) + 0.5);
40 duration = 0.03; //MCP Should be read from ini file 40
41
42 int x; 41 int x;
43 for (x = 0; x < map.Width; x++) 42 int xFrom = (int)(rx-s+0.5);
43 int xTo = (int)(rx+s+0.5) + 1;
44 int yFrom = (int)(ry-s+0.5);
45 int yTo = (int)(ry+s+0.5) + 1;
46
47 if (xFrom < 0)
48 xFrom = 0;
49
50 if (yFrom < 0)
51 yFrom = 0;
52
53 if (xTo > map.Width)
54 xTo = map.Width;
55
56 if (yTo > map.Width)
57 yTo = map.Width;
58
59 for (x = xFrom; x < xTo; x++)
44 { 60 {
45 int y; 61 int y;
46 for (y = 0; y < map.Height; y++) 62 for (y = yFrom; y <= yTo; y++)
47 { 63 {
48 if (!mask[x,y]) 64 if (!mask[x,y])
49 continue; 65 continue;
50 66
51 // Calculate a sphere and add it to the heighmap 67 // Calculate a cos-sphere and add it to the heighmap
52 double z = strength; 68 double r = Math.Sqrt((x-rx) * (x-rx) + ((y-ry) * (y-ry)));
53 z *= z; 69 double z = Math.Cos(r * Math.PI / (s * 2));
54 z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry));
55
56 if (z > 0.0) 70 if (z > 0.0)
57 map[x, y] -= z * duration; 71 map[x, y] -= z * duration;
58 } 72 }
59 } 73 }
60 }
61 74
75 }
62 #endregion 76 #endregion
63 } 77 }
64} 78}
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RaiseSphere.cs b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RaiseSphere.cs
index 92bac63..b1a52b0 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RaiseSphere.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RaiseSphere.cs
@@ -26,34 +26,51 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Reflection;
30using log4net;
29using OpenSim.Region.Environment.Interfaces; 31using OpenSim.Region.Environment.Interfaces;
30 32
31namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes 33namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
32{ 34{
33 public class RaiseSphere : ITerrainPaintableEffect 35 public class RaiseSphere : ITerrainPaintableEffect
34 { 36 {
37 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
35 #region ITerrainPaintableEffect Members 38 #region ITerrainPaintableEffect Members
36 39
37 40
38 public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration) 41 public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration)
39 { 42 {
40 duration = 0.03; //MCP Should be read from ini file 43 int s = (int) (Math.Pow(2, strength) + 0.5);
41 strength = TerrainUtil.MetersToSphericalStrength(strength);
42 44
43 int x; 45 int x;
44 for (x = 0; x < map.Width; x++) 46 int xFrom = (int)(rx-s+0.5);
47 int xTo = (int)(rx+s+0.5) + 1;
48 int yFrom = (int)(ry-s+0.5);
49 int yTo = (int)(ry+s+0.5) + 1;
50
51 if (xFrom < 0)
52 xFrom = 0;
53
54 if (yFrom < 0)
55 yFrom = 0;
56
57 if (xTo > map.Width)
58 xTo = map.Width;
59
60 if (yTo > map.Width)
61 yTo = map.Width;
62
63 for (x = xFrom; x < xTo; x++)
45 { 64 {
46 int y; 65 int y;
47 for (y = 0; y < map.Height; y++) 66 for (y = yFrom; y <= yTo; y++)
48 { 67 {
49 if (!mask[x,y]) 68 if (!mask[x,y])
50 continue; 69 continue;
51 70
52 // Calculate a sphere and add it to the heighmap 71 // Calculate a cos-sphere and add it to the heighmap
53 double z = strength; 72 double r = Math.Sqrt((x-rx) * (x-rx) + ((y-ry) * (y-ry)));
54 z *= z; 73 double z = Math.Cos(r * Math.PI / (s * 2));
55 z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry));
56
57 if (z > 0.0) 74 if (z > 0.0)
58 map[x, y] += z * duration; 75 map[x, y] += z * duration;
59 } 76 }