Revert r6697 patch as the build fails.
parent
dedc1baeb7
commit
e575ef7ad2
|
@ -61,7 +61,7 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
public delegate void ModifyTerrain(
|
public delegate void ModifyTerrain(
|
||||||
float height, float seconds, byte size, byte action, float north, float west, float south, float east,
|
float height, float seconds, byte size, byte action, float north, float west, float south, float east,
|
||||||
UUID agentId);
|
IClientAPI remoteClient);
|
||||||
|
|
||||||
public delegate void SetAppearance(byte[] texture, List<byte> visualParamList);
|
public delegate void SetAppearance(byte[] texture, List<byte> visualParamList);
|
||||||
|
|
||||||
|
|
|
@ -4171,7 +4171,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
modify.ModifyBlock.BrushSize,
|
modify.ModifyBlock.BrushSize,
|
||||||
modify.ModifyBlock.Action, modify.ParcelData[i].North,
|
modify.ModifyBlock.Action, modify.ParcelData[i].North,
|
||||||
modify.ParcelData[i].West, modify.ParcelData[i].South,
|
modify.ParcelData[i].West, modify.ParcelData[i].South,
|
||||||
modify.ParcelData[i].East, this.AgentId);
|
modify.ParcelData[i].East, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -984,9 +984,11 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
|
||||||
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
|
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
|
||||||
if (m_bypassPermissions) return m_bypassPermissionsValue;
|
if (m_bypassPermissions) return m_bypassPermissionsValue;
|
||||||
|
|
||||||
|
bool permission = false;
|
||||||
|
|
||||||
// Estate override
|
// Estate override
|
||||||
if (GenericEstatePermission(user))
|
if (GenericEstatePermission(user))
|
||||||
return true;
|
permission = true;
|
||||||
|
|
||||||
float X = position.X;
|
float X = position.X;
|
||||||
float Y = position.Y;
|
float Y = position.Y;
|
||||||
|
@ -1000,19 +1002,13 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
|
||||||
if (Y < 0)
|
if (Y < 0)
|
||||||
Y = 0;
|
Y = 0;
|
||||||
|
|
||||||
ILandObject parcel = m_scene.LandChannel.GetLandObject(X, Y);
|
|
||||||
if (parcel == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Others allowed to terraform?
|
|
||||||
if ((parcel.landData.Flags & ((int)Parcel.ParcelFlags.AllowTerraform)) != 0)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// Land owner can terraform too
|
// Land owner can terraform too
|
||||||
|
ILandObject parcel = m_scene.LandChannel.GetLandObject(X, Y);
|
||||||
if (parcel != null && GenericParcelPermission(user, parcel))
|
if (parcel != null && GenericParcelPermission(user, parcel))
|
||||||
return true;
|
permission = true;
|
||||||
|
|
||||||
return false;
|
|
||||||
|
return permission;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CanViewScript(UUID script, UUID objectID, UUID user, Scene scene)
|
private bool CanViewScript(UUID script, UUID objectID, UUID user, Scene scene)
|
||||||
|
|
|
@ -41,7 +41,6 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.Effects
|
||||||
bool[,] cliffMask = new bool[map.Width,map.Height];
|
bool[,] cliffMask = new bool[map.Width,map.Height];
|
||||||
bool[,] channelMask = new bool[map.Width,map.Height];
|
bool[,] channelMask = new bool[map.Width,map.Height];
|
||||||
bool[,] smoothMask = new bool[map.Width,map.Height];
|
bool[,] smoothMask = new bool[map.Width,map.Height];
|
||||||
bool[,] allowMask = new bool[map.Width,map.Height];
|
|
||||||
|
|
||||||
Console.WriteLine("S1");
|
Console.WriteLine("S1");
|
||||||
|
|
||||||
|
@ -53,7 +52,6 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.Effects
|
||||||
{
|
{
|
||||||
Console.Write(".");
|
Console.Write(".");
|
||||||
smoothMask[x, y] = true;
|
smoothMask[x, y] = true;
|
||||||
allowMask[x,y] = true;
|
|
||||||
|
|
||||||
// Start underwater
|
// Start underwater
|
||||||
map[x, y] = TerrainUtil.PerlinNoise2D(x, y, 3, 0.25) * 5;
|
map[x, y] = TerrainUtil.PerlinNoise2D(x, y, 3, 0.25) * 5;
|
||||||
|
@ -79,7 +77,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.Effects
|
||||||
for (y = 0; y < map.Height; y++)
|
for (y = 0; y < map.Height; y++)
|
||||||
{
|
{
|
||||||
if (cliffMask[x, y])
|
if (cliffMask[x, y])
|
||||||
eroder.PaintEffect(map, allowMask, x, y, -1, 4, 0.1);
|
eroder.PaintEffect(map, x, y, 4, 0.1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,4 +119,4 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.Effects
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -25,9 +25,7 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using OpenMetaverse;
|
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Modules.World.Terrain
|
namespace OpenSim.Region.Environment.Modules.World.Terrain
|
||||||
{
|
{
|
||||||
|
@ -35,8 +33,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
|
||||||
{
|
{
|
||||||
void LoadFromFile(string filename);
|
void LoadFromFile(string filename);
|
||||||
void SaveToFile(string filename);
|
void SaveToFile(string filename);
|
||||||
void ModifyTerrain(Vector3 pos, byte size, byte action, UUID agentId);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Load a terrain from a stream.
|
/// Load a terrain from a stream.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -31,6 +31,6 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
|
||||||
{
|
{
|
||||||
public interface ITerrainPaintableEffect
|
public interface ITerrainPaintableEffect
|
||||||
{
|
{
|
||||||
void PaintEffect(ITerrainChannel map, bool[,] allowMask, double x, double y, double z, double strength, double duration);
|
void PaintEffect(ITerrainChannel map, double x, double y, double strength, double duration);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -150,7 +150,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
||||||
|
|
||||||
#region ITerrainPaintableEffect Members
|
#region ITerrainPaintableEffect Members
|
||||||
|
|
||||||
public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration)
|
public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)
|
||||||
{
|
{
|
||||||
strength = TerrainUtil.MetersToSphericalStrength(strength);
|
strength = TerrainUtil.MetersToSphericalStrength(strength);
|
||||||
|
|
||||||
|
@ -173,13 +173,10 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
||||||
{
|
{
|
||||||
for (y = 0; y < water.Height; y++)
|
for (y = 0; y < water.Height; y++)
|
||||||
{
|
{
|
||||||
if (mask[x,y])
|
const double solConst = (1.0 / rounds);
|
||||||
{
|
double sedDelta = water[x, y] * solConst;
|
||||||
const double solConst = (1.0 / rounds);
|
map[x, y] -= sedDelta;
|
||||||
double sedDelta = water[x, y] * solConst;
|
sediment[x, y] += sedDelta;
|
||||||
map[x, y] -= sedDelta;
|
|
||||||
sediment[x, y] += sedDelta;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,11 +292,8 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
||||||
double sedimentDeposit = sediment[x, y] - waterCapacity;
|
double sedimentDeposit = sediment[x, y] - waterCapacity;
|
||||||
if (sedimentDeposit > 0)
|
if (sedimentDeposit > 0)
|
||||||
{
|
{
|
||||||
if (mask[x,y])
|
sediment[x, y] -= sedimentDeposit;
|
||||||
{
|
map[x, y] += sedimentDeposit;
|
||||||
sediment[x, y] -= sedimentDeposit;
|
|
||||||
map[x, y] += sedimentDeposit;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -308,10 +302,10 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
||||||
// Deposit any remainder (should be minimal)
|
// Deposit any remainder (should be minimal)
|
||||||
for (x = 0; x < water.Width; x++)
|
for (x = 0; x < water.Width; x++)
|
||||||
for (y = 0; y < water.Height; y++)
|
for (y = 0; y < water.Height; y++)
|
||||||
if (mask[x,y] && sediment[x, y] > 0)
|
if (sediment[x, y] > 0)
|
||||||
map[x, y] += sediment[x, y];
|
map[x, y] += sediment[x, y];
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -25,29 +25,48 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
|
||||||
using OpenSim.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
||||||
{
|
{
|
||||||
public class FlattenSphere : ITerrainPaintableEffect
|
public class FlattenSphere : ITerrainPaintableEffect
|
||||||
{
|
{
|
||||||
|
|
||||||
#region ITerrainPaintableEffect Members
|
#region ITerrainPaintableEffect Members
|
||||||
|
|
||||||
public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration)
|
public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)
|
||||||
{
|
{
|
||||||
strength = TerrainUtil.MetersToSphericalStrength(strength);
|
strength = TerrainUtil.MetersToSphericalStrength(strength);
|
||||||
|
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
|
double sum = 0.0;
|
||||||
|
double step2 = 0.0;
|
||||||
|
duration = 0.009; //MCP Should be read from ini file
|
||||||
|
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
double avg = sum / step2;
|
||||||
|
|
||||||
// blend in map
|
// blend in map
|
||||||
for (x = 0; x < map.Width; x++)
|
for (x = 0; x < map.Width; x++)
|
||||||
{
|
{
|
||||||
for (y = 0; y < map.Height; y++)
|
for (y = 0; y < map.Height; y++)
|
||||||
{
|
{
|
||||||
if (!mask[x,y])
|
|
||||||
continue;
|
|
||||||
|
|
||||||
double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength) * duration;
|
double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength) * duration;
|
||||||
|
|
||||||
if (z > 0) // add in non-zero amount
|
if (z > 0) // add in non-zero amount
|
||||||
|
@ -55,18 +74,8 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
||||||
if (z > 1.0)
|
if (z > 1.0)
|
||||||
z = 1.0;
|
z = 1.0;
|
||||||
|
|
||||||
map[x, y] = (map[x, y] * (1.0 - z)) + (rz * z);
|
map[x, y] = (map[x, y] * (1.0 - z)) + (avg * z);
|
||||||
}
|
}
|
||||||
|
|
||||||
double delta = rz - map[x, y];
|
|
||||||
if (Math.Abs(delta) > 0.1)
|
|
||||||
delta *= 0.25;
|
|
||||||
|
|
||||||
if (delta != 0) // add in non-zero amount
|
|
||||||
{
|
|
||||||
map[x, y] += delta;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
||||||
{
|
{
|
||||||
#region ITerrainPaintableEffect Members
|
#region ITerrainPaintableEffect Members
|
||||||
|
|
||||||
public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration)
|
public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)
|
||||||
{
|
{
|
||||||
strength = TerrainUtil.MetersToSphericalStrength(strength);
|
strength = TerrainUtil.MetersToSphericalStrength(strength);
|
||||||
duration = 0.03; //MCP Should be read from ini file
|
duration = 0.03; //MCP Should be read from ini file
|
||||||
|
@ -42,10 +42,15 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
||||||
int x;
|
int x;
|
||||||
for (x = 0; x < map.Width; x++)
|
for (x = 0; x < map.Width; x++)
|
||||||
{
|
{
|
||||||
|
// Skip everything unlikely to be affected
|
||||||
|
if (Math.Abs(x - rx) > strength * 1.1)
|
||||||
|
continue;
|
||||||
|
|
||||||
int y;
|
int y;
|
||||||
for (y = 0; y < map.Height; y++)
|
for (y = 0; y < map.Height; y++)
|
||||||
{
|
{
|
||||||
if (!mask[x,y])
|
// Skip everything unlikely to be affected
|
||||||
|
if (Math.Abs(y - ry) > strength * 1.1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Calculate a sphere and add it to the heighmap
|
// Calculate a sphere and add it to the heighmap
|
||||||
|
@ -61,4 +66,4 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -35,17 +35,22 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
||||||
{
|
{
|
||||||
#region ITerrainPaintableEffect Members
|
#region ITerrainPaintableEffect Members
|
||||||
|
|
||||||
public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration)
|
public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)
|
||||||
{
|
{
|
||||||
strength = TerrainUtil.MetersToSphericalStrength(strength);
|
strength = TerrainUtil.MetersToSphericalStrength(strength);
|
||||||
|
|
||||||
int x;
|
int x;
|
||||||
for (x = 0; x < map.Width; x++)
|
for (x = 0; x < map.Width; x++)
|
||||||
{
|
{
|
||||||
|
// Skip everything unlikely to be affected
|
||||||
|
if (Math.Abs(x - rx) > strength * 1.1)
|
||||||
|
continue;
|
||||||
|
|
||||||
int y;
|
int y;
|
||||||
for (y = 0; y < map.Height; y++)
|
for (y = 0; y < map.Height; y++)
|
||||||
{
|
{
|
||||||
if (!mask[x,y])
|
// Skip everything unlikely to be affected
|
||||||
|
if (Math.Abs(y - ry) > strength * 1.1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Calculate a sphere and add it to the heighmap
|
// Calculate a sphere and add it to the heighmap
|
||||||
|
@ -63,4 +68,4 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -151,7 +151,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
||||||
|
|
||||||
#region ITerrainPaintableEffect Members
|
#region ITerrainPaintableEffect Members
|
||||||
|
|
||||||
public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration)
|
public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)
|
||||||
{
|
{
|
||||||
strength = TerrainUtil.MetersToSphericalStrength(strength);
|
strength = TerrainUtil.MetersToSphericalStrength(strength);
|
||||||
|
|
||||||
|
@ -162,9 +162,6 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
||||||
int y;
|
int y;
|
||||||
for (y = 0; y < map.Height; y++)
|
for (y = 0; y < map.Height; y++)
|
||||||
{
|
{
|
||||||
if (!mask[x,y])
|
|
||||||
continue;
|
|
||||||
|
|
||||||
double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength);
|
double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength);
|
||||||
|
|
||||||
if (z > 0) // add in non-zero amount
|
if (z > 0) // add in non-zero amount
|
||||||
|
@ -219,4 +216,4 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -35,7 +35,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
||||||
#region ITerrainPaintableEffect Members
|
#region ITerrainPaintableEffect Members
|
||||||
|
|
||||||
|
|
||||||
public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration)
|
public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)
|
||||||
{
|
{
|
||||||
duration = 0.03; //MCP Should be read from ini file
|
duration = 0.03; //MCP Should be read from ini file
|
||||||
strength = TerrainUtil.MetersToSphericalStrength(strength);
|
strength = TerrainUtil.MetersToSphericalStrength(strength);
|
||||||
|
@ -43,10 +43,15 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
||||||
int x;
|
int x;
|
||||||
for (x = 0; x < map.Width; x++)
|
for (x = 0; x < map.Width; x++)
|
||||||
{
|
{
|
||||||
|
// Skip everything unlikely to be affected
|
||||||
|
if (Math.Abs(x - rx) > strength * 1.1)
|
||||||
|
continue;
|
||||||
|
|
||||||
int y;
|
int y;
|
||||||
for (y = 0; y < map.Height; y++)
|
for (y = 0; y < map.Height; y++)
|
||||||
{
|
{
|
||||||
if (!mask[x,y])
|
// Skip everything unlikely to be affected
|
||||||
|
if (Math.Abs(y - ry) > strength * 1.1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Calculate a sphere and add it to the heighmap
|
// Calculate a sphere and add it to the heighmap
|
||||||
|
@ -62,4 +67,4 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -41,7 +41,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
||||||
|
|
||||||
#region ITerrainPaintableEffect Members
|
#region ITerrainPaintableEffect Members
|
||||||
|
|
||||||
public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration)
|
public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)
|
||||||
{
|
{
|
||||||
strength = TerrainUtil.MetersToSphericalStrength(strength);
|
strength = TerrainUtil.MetersToSphericalStrength(strength);
|
||||||
duration = 0.03; //MCP Should be read from ini file
|
duration = 0.03; //MCP Should be read from ini file
|
||||||
|
@ -54,10 +54,15 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
||||||
int x;
|
int x;
|
||||||
for (x = 0; x < map.Width; x++)
|
for (x = 0; x < map.Width; x++)
|
||||||
{
|
{
|
||||||
|
// Skip everything unlikely to be affected
|
||||||
|
if (Math.Abs(x - rx) > strength * 1.1)
|
||||||
|
continue;
|
||||||
|
|
||||||
int y;
|
int y;
|
||||||
for (y = 0; y < map.Height; y++)
|
for (y = 0; y < map.Height; y++)
|
||||||
{
|
{
|
||||||
if (!mask[x,y])
|
// Skip everything unlikely to be affected
|
||||||
|
if (Math.Abs(y - ry) > strength * 1.1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Calculate a sphere and add it to the heighmap
|
// Calculate a sphere and add it to the heighmap
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
||||||
{
|
{
|
||||||
#region ITerrainPaintableEffect Members
|
#region ITerrainPaintableEffect Members
|
||||||
|
|
||||||
public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration)
|
public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)
|
||||||
{
|
{
|
||||||
strength = TerrainUtil.MetersToSphericalStrength(strength);
|
strength = TerrainUtil.MetersToSphericalStrength(strength);
|
||||||
|
|
||||||
|
@ -76,9 +76,6 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
||||||
{
|
{
|
||||||
for (y = 0; y < map.Height; y++)
|
for (y = 0; y < map.Height; y++)
|
||||||
{
|
{
|
||||||
if (!mask[x,y])
|
|
||||||
continue;
|
|
||||||
|
|
||||||
double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength);
|
double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength);
|
||||||
|
|
||||||
if (z > 0) // add in non-zero amount
|
if (z > 0) // add in non-zero amount
|
||||||
|
|
|
@ -147,7 +147,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
||||||
|
|
||||||
#region ITerrainPaintableEffect Members
|
#region ITerrainPaintableEffect Members
|
||||||
|
|
||||||
public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration)
|
public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)
|
||||||
{
|
{
|
||||||
strength = TerrainUtil.MetersToSphericalStrength(strength);
|
strength = TerrainUtil.MetersToSphericalStrength(strength);
|
||||||
|
|
||||||
|
@ -158,9 +158,6 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
||||||
int y;
|
int y;
|
||||||
for (y = 0; y < map.Height; y++)
|
for (y = 0; y < map.Height; y++)
|
||||||
{
|
{
|
||||||
if (!mask[x,y])
|
|
||||||
continue;
|
|
||||||
|
|
||||||
double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength);
|
double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength);
|
||||||
|
|
||||||
if (z > 0) // add in non-zero amount
|
if (z > 0) // add in non-zero amount
|
||||||
|
@ -207,4 +204,4 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -40,7 +40,6 @@ using OpenSim.Region.Environment.Modules.World.Terrain.FloodBrushes;
|
||||||
using OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes;
|
using OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
|
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Modules.World.Terrain
|
namespace OpenSim.Region.Environment.Modules.World.Terrain
|
||||||
{
|
{
|
||||||
public class TerrainModule : IRegionModule, ICommandableModule, ITerrainModule
|
public class TerrainModule : IRegionModule, ICommandableModule, ITerrainModule
|
||||||
|
@ -259,18 +258,6 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
|
||||||
throw new TerrainException(String.Format("unable to load heightmap from file {0}: no loader available for that format", filename));
|
throw new TerrainException(String.Format("unable to load heightmap from file {0}: no loader available for that format", filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Modify Land
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="pos">Land-position (X,Y,0)</param>
|
|
||||||
/// <param name="size">The size of the brush (0=small, 1=medium, 2=large)</param>
|
|
||||||
/// <param name="action">0=LAND_LEVEL, 1=LAND_RAISE, 2=LAND_LOWER, 3=LAND_SMOOTH, 4=LAND_NOISE, 5=LAND_REVERT</param>
|
|
||||||
/// <param name="agentId">UUID of script-owner</param>
|
|
||||||
public void ModifyTerrain(Vector3 pos, byte size, byte action, UUID agentId)
|
|
||||||
{
|
|
||||||
client_OnModifyTerrain((float)pos.Z, (float)0.25, size, action, pos.Y, pos.X, pos.Y, pos.X, agentId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Saves the current heightmap to a specified stream.
|
/// Saves the current heightmap to a specified stream.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -600,92 +587,58 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void client_OnModifyTerrain(float height, float seconds, byte size, byte action,
|
private void client_OnModifyTerrain(float height, float seconds, byte size, byte action, float north, float west,
|
||||||
float north, float west, float south, float east, UUID agentId)
|
float south, float east, IClientAPI remoteClient)
|
||||||
{
|
{
|
||||||
bool allowed = false;
|
// Not a good permissions check, if in area mode, need to check the entire area.
|
||||||
if (north == south && east == west)
|
if (m_scene.ExternalChecks.ExternalChecksCanTerraformLand(remoteClient.AgentId, new Vector3(north, west, 0)))
|
||||||
{
|
{
|
||||||
if (m_painteffects.ContainsKey((StandardTerrainEffects) action))
|
if (north == south && east == west)
|
||||||
{
|
{
|
||||||
bool[,] allowMask = new bool[m_channel.Width,m_channel.Height];
|
if (m_painteffects.ContainsKey((StandardTerrainEffects) action))
|
||||||
allowMask.Initialize();
|
|
||||||
int n = size + 1;
|
|
||||||
if (n > 2)
|
|
||||||
n = 4;
|
|
||||||
|
|
||||||
int zx = (int) (west + 0.5);
|
|
||||||
int zy = (int) (north + 0.5);
|
|
||||||
|
|
||||||
int dx;
|
|
||||||
for (dx=-n; dx<=n; dx++)
|
|
||||||
{
|
|
||||||
int dy;
|
|
||||||
for (dy=-n; dy<=n; dy++)
|
|
||||||
{
|
|
||||||
int x = zx + dx;
|
|
||||||
int y = zy + dy;
|
|
||||||
if (x>=0 && y>=0 && x<m_channel.Width && y<m_channel.Height)
|
|
||||||
{
|
|
||||||
if (m_scene.ExternalChecks.ExternalChecksCanTerraformLand(agentId, new Vector3(x,y,0)))
|
|
||||||
{
|
|
||||||
allowMask[x, y] = true;
|
|
||||||
allowed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (allowed)
|
|
||||||
{
|
{
|
||||||
m_painteffects[(StandardTerrainEffects) action].PaintEffect(
|
m_painteffects[(StandardTerrainEffects) action].PaintEffect(
|
||||||
m_channel, allowMask, west, south, height, size, seconds);
|
m_channel, west, south, size, seconds);
|
||||||
|
|
||||||
CheckForTerrainUpdates(true); //revert changes outside estate limits
|
CheckForTerrainUpdates(true); //revert changes outside estate limits
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.Debug("Unknown terrain brush type " + action);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.Debug("Unknown terrain brush type " + action);
|
if (m_floodeffects.ContainsKey((StandardTerrainEffects) action))
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (m_floodeffects.ContainsKey((StandardTerrainEffects) action))
|
|
||||||
{
|
|
||||||
bool[,] fillArea = new bool[m_channel.Width,m_channel.Height];
|
|
||||||
fillArea.Initialize();
|
|
||||||
|
|
||||||
int x;
|
|
||||||
for (x = 0; x < m_channel.Width; x++)
|
|
||||||
{
|
{
|
||||||
int y;
|
bool[,] fillArea = new bool[m_channel.Width,m_channel.Height];
|
||||||
for (y = 0; y < m_channel.Height; y++)
|
fillArea.Initialize();
|
||||||
|
|
||||||
|
int x;
|
||||||
|
for (x = 0; x < m_channel.Width; x++)
|
||||||
{
|
{
|
||||||
if (x < east && x > west)
|
int y;
|
||||||
|
for (y = 0; y < m_channel.Height; y++)
|
||||||
{
|
{
|
||||||
if (y < north && y > south)
|
if (x < east && x > west)
|
||||||
{
|
{
|
||||||
if (m_scene.ExternalChecks.ExternalChecksCanTerraformLand(agentId, new Vector3(x,y,0)))
|
if (y < north && y > south)
|
||||||
{
|
{
|
||||||
fillArea[x, y] = true;
|
fillArea[x, y] = true;
|
||||||
allowed = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (allowed)
|
|
||||||
{
|
|
||||||
m_floodeffects[(StandardTerrainEffects) action].FloodEffect(
|
m_floodeffects[(StandardTerrainEffects) action].FloodEffect(
|
||||||
m_channel, fillArea, size);
|
m_channel, fillArea, size);
|
||||||
|
|
||||||
CheckForTerrainUpdates(true); //revert changes outside estate limits
|
CheckForTerrainUpdates(true); //revert changes outside estate limits
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
m_log.Debug("Unknown terrain flood type " + action);
|
||||||
m_log.Debug("Unknown terrain flood type " + action);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,30 +37,19 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.Tests
|
||||||
[Test]
|
[Test]
|
||||||
public void BrushTest()
|
public void BrushTest()
|
||||||
{
|
{
|
||||||
TerrainChannel map = new TerrainChannel(256, 256);
|
TerrainChannel x = new TerrainChannel(256, 256);
|
||||||
bool[,] allowMask = new bool[map.Width,map.Height];
|
|
||||||
int x;
|
|
||||||
int y;
|
|
||||||
for (x=0; x<map.Width; x++)
|
|
||||||
{
|
|
||||||
for (y=0; y<map.Height; y++)
|
|
||||||
{
|
|
||||||
allowMask[x,y] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ITerrainPaintableEffect effect = new RaiseSphere();
|
ITerrainPaintableEffect effect = new RaiseSphere();
|
||||||
|
|
||||||
effect.PaintEffect(map, allowMask, 128.0, 128.0, 23.0, 50, 0.1);
|
effect.PaintEffect(x, 128.0, 128.0, 100, 0.1);
|
||||||
Assert.That(map[128, 128] > 0.0, "Raise brush not raising values.");
|
Assert.That(x[128, 128] > 0.0, "Raise brush not raising values.");
|
||||||
Assert.That(map[0, 128] > 0.0, "Raise brush lowering edge values.");
|
Assert.That(x[0, 128] > 0.0, "Raise brush lowering edge values.");
|
||||||
|
|
||||||
map = new TerrainChannel(256, 256);
|
x = new TerrainChannel(256, 256);
|
||||||
effect = new LowerSphere();
|
effect = new LowerSphere();
|
||||||
|
|
||||||
effect.PaintEffect(map, allowMask, 128.0, 128.0, -1, 50, 0.1);
|
effect.PaintEffect(x, 128.0, 128.0, 100, 0.1);
|
||||||
Assert.That(map[128, 128] < 0.0, "Lower not lowering values.");
|
Assert.That(x[128, 128] < 0.0, "Lower not lowering values.");
|
||||||
Assert.That(map[0, 128] < 0.0, "Lower brush affecting edge values.");
|
Assert.That(x[0, 128] < 0.0, "Lower brush affecting edge values.");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|
|
@ -756,7 +756,6 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
StoreUndoState();
|
StoreUndoState();
|
||||||
if (m_shape != null) {
|
|
||||||
m_shape.Scale = value;
|
m_shape.Scale = value;
|
||||||
|
|
||||||
if (PhysActor != null && m_parentGroup != null)
|
if (PhysActor != null && m_parentGroup != null)
|
||||||
|
@ -770,7 +769,6 @@ if (m_shape != null) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
TriggerScriptChangedEvent(Changed.SCALE);
|
TriggerScriptChangedEvent(Changed.SCALE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,6 @@ using OpenSim.Region.Interfaces;
|
||||||
using OpenSim.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney;
|
using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney;
|
||||||
using OpenSim.Region.Environment.Modules.World.Land;
|
using OpenSim.Region.Environment.Modules.World.Land;
|
||||||
using OpenSim.Region.Environment.Modules.World.Terrain;
|
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
using OpenSim.Region.Physics.Manager;
|
using OpenSim.Region.Physics.Manager;
|
||||||
using OpenSim.Region.ScriptEngine.Shared;
|
using OpenSim.Region.ScriptEngine.Shared;
|
||||||
|
@ -3369,11 +3368,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public void llModifyLand(int action, int brush)
|
public void llModifyLand(int action, int brush)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
ITerrainModule tm = m_ScriptEngine.World.RequestModuleInterface<ITerrainModule>();
|
World.ExternalChecks.ExternalChecksCanTerraformLand(m_host.OwnerID, new Vector3(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y, 0));
|
||||||
if (tm != null)
|
|
||||||
{
|
|
||||||
tm.ModifyTerrain(m_host.AbsolutePosition, (byte) brush, (byte) action, m_host.OwnerID);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void llCollisionSound(string impact_sound, double impact_volume)
|
public void llCollisionSound(string impact_sound, double impact_volume)
|
||||||
|
|
Loading…
Reference in New Issue