* New Terrain Module (disabled, search for 'usingTerrainModule = false' to reenable)
* *Much* faster terraforming (woot!) * New "Brushes" design, so you can create custom terraforming brushes then apply those inplace of the standard tools. (ie an Erode Brush for example) * New specialised "Flood Brushes" to do large area effects, ie, raise-area, now takes a bitmap rather than repeats the ordinary raise brush a thousand times. * New modular file Load/Save systems -- write importers/exporters for multiple formats without having to hard code the whole thing in. * Coming soon - effects system, ie the old Erosion functions, etc. for one-shot effects.0.6.0-stable
parent
0926239541
commit
f64611862a
|
@ -34,5 +34,6 @@ namespace OpenSim.Region.Environment.Interfaces
|
|||
double this[int x, int y] { get; set; }
|
||||
int Width { get; }
|
||||
float[] GetFloatsSerialised();
|
||||
bool Tainted(int x, int y);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
|
|||
|
||||
#region ITerrainPaintableEffect Members
|
||||
|
||||
public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength)
|
||||
public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)
|
||||
{
|
||||
int x, y;
|
||||
double[,] tweak = new double[map.Width, map.Height];
|
||||
|
@ -106,7 +106,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
|
|||
{
|
||||
for (y = 0; y < map.Height; y++)
|
||||
{
|
||||
double z = SphericalFactor(x, y, rx, ry, strength);
|
||||
double z = SphericalFactor(x, y, rx, ry, strength) * duration;
|
||||
|
||||
if (z > 0) // add in non-zero amount
|
||||
{
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
|
|||
{
|
||||
#region ITerrainPaintableEffect Members
|
||||
|
||||
public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength)
|
||||
public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)
|
||||
{
|
||||
int x, y;
|
||||
for (x = 0; x < map.Width; x++)
|
||||
|
@ -55,7 +55,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
|
|||
z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry));
|
||||
|
||||
if (z > 0.0)
|
||||
map[x, y] -= z;
|
||||
map[x, y] -= z * duration;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
|
|||
{
|
||||
#region ITerrainPaintableEffect Members
|
||||
|
||||
public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength)
|
||||
public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)
|
||||
{
|
||||
int x, y;
|
||||
for (x = 0; x < map.Width; x++)
|
||||
|
@ -63,7 +63,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
|
|||
}
|
||||
|
||||
if (z > 0.0)
|
||||
map[x, y] += (noise - 0.5) * z;
|
||||
map[x, y] += (noise - 0.5) * z * duration;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
|
|||
{
|
||||
#region ITerrainPaintableEffect Members
|
||||
|
||||
public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength)
|
||||
public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)
|
||||
{
|
||||
int x, y;
|
||||
for (x = 0; x < map.Width; x++)
|
||||
|
@ -55,7 +55,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
|
|||
z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry));
|
||||
|
||||
if (z > 0.0)
|
||||
map[x, y] += z;
|
||||
map[x, y] += z * duration;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
|
|||
|
||||
#region ITerrainPaintableEffect Members
|
||||
|
||||
public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength)
|
||||
public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)
|
||||
{
|
||||
int x, y;
|
||||
double[,] tweak = new double[map.Width, map.Height];
|
||||
|
@ -116,7 +116,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
|
|||
{
|
||||
double da = z;
|
||||
double a = (map[x, y] - tweak[x, y]) * da;
|
||||
double newz = map[x, y] - a;
|
||||
double newz = map[x, y] - (a * duration);
|
||||
|
||||
if (newz > 0.0)
|
||||
map[x, y] = newz;
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain
|
|||
{
|
||||
public interface ITerrainPaintableEffect
|
||||
{
|
||||
void PaintEffect(ITerrainChannel map, double x, double y, double strength);
|
||||
void PaintEffect(ITerrainChannel map, double x, double y, double strength, double duration);
|
||||
}
|
||||
|
||||
public interface ITerrainFloodEffect
|
||||
|
@ -63,6 +63,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain
|
|||
public class TerrainChannel : ITerrainChannel
|
||||
{
|
||||
private double[,] map;
|
||||
private bool[,] taint;
|
||||
|
||||
public int Width
|
||||
{
|
||||
|
@ -103,29 +104,41 @@ namespace OpenSim.Region.Environment.Modules.Terrain
|
|||
}
|
||||
set
|
||||
{
|
||||
taint[x / 16, y / 16] = true;
|
||||
map[x, y] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Tainted(int x, int y)
|
||||
{
|
||||
return taint[x / 16, y / 16];
|
||||
}
|
||||
|
||||
public TerrainChannel()
|
||||
{
|
||||
map = new double[Constants.RegionSize, Constants.RegionSize];
|
||||
taint = new bool[Constants.RegionSize / 16, Constants.RegionSize / 16];
|
||||
}
|
||||
|
||||
public TerrainChannel(double[,] import)
|
||||
{
|
||||
map = import;
|
||||
taint = new bool[import.GetLength(0), import.GetLength(1)];
|
||||
}
|
||||
|
||||
public TerrainChannel(bool createMap)
|
||||
{
|
||||
if (createMap)
|
||||
{
|
||||
map = new double[Constants.RegionSize, Constants.RegionSize];
|
||||
taint = new bool[Constants.RegionSize / 16, Constants.RegionSize / 16];
|
||||
}
|
||||
}
|
||||
|
||||
public TerrainChannel(int w, int h)
|
||||
{
|
||||
map = new double[w, h];
|
||||
taint = new bool[w / 16, h / 16];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -246,7 +259,14 @@ namespace OpenSim.Region.Environment.Modules.Terrain
|
|||
if (m_painteffects.ContainsKey((StandardTerrainEffects)action))
|
||||
{
|
||||
m_painteffects[(StandardTerrainEffects)action].PaintEffect(
|
||||
m_channel, west, south, Math.Pow(size, 2.0));
|
||||
m_channel, west, south, Math.Pow(size, 2.0), seconds);
|
||||
|
||||
bool usingTerrainModule = false;
|
||||
|
||||
if (usingTerrainModule)
|
||||
{
|
||||
remoteClient.SendLayerData(m_channel.GetFloatsSerialised());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -258,20 +278,32 @@ namespace OpenSim.Region.Environment.Modules.Terrain
|
|||
if (m_floodeffects.ContainsKey((StandardTerrainEffects)action))
|
||||
{
|
||||
bool[,] fillArea = new bool[m_channel.Width, m_channel.Height];
|
||||
|
||||
fillArea.Initialize();
|
||||
|
||||
int x, y;
|
||||
|
||||
for (x = 0; x < m_channel.Width; x++)
|
||||
{
|
||||
for (y = 0; y < m_channel.Height; y++)
|
||||
{
|
||||
fillArea[x, y] = true;
|
||||
if (x < east && x > west)
|
||||
{
|
||||
if (y < south && y > north)
|
||||
{
|
||||
fillArea[x, y] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_floodeffects[(StandardTerrainEffects)action].FloodEffect(
|
||||
m_channel, fillArea, Math.Pow(size, 2.0));
|
||||
bool usingTerrainModule = false;
|
||||
|
||||
if (usingTerrainModule)
|
||||
{
|
||||
remoteClient.SendLayerData(m_channel.GetFloatsSerialised());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -869,7 +869,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
|
||||
public void SendTerrainUpdate(bool checkForTainted)
|
||||
{
|
||||
float[] terData = Terrain.GetHeights1D();
|
||||
float[] terData = Heightmap.GetFloatsSerialised();
|
||||
|
||||
Broadcast(delegate(IClientAPI client)
|
||||
{
|
||||
|
|
|
@ -112,7 +112,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
/// <param name="RemoteClient">Client to send to</param>
|
||||
public virtual void SendLayerData(IClientAPI RemoteClient)
|
||||
{
|
||||
bool usingTerrainModule = true;
|
||||
bool usingTerrainModule = false;
|
||||
|
||||
if (usingTerrainModule)
|
||||
{
|
||||
|
|
|
@ -297,9 +297,14 @@ namespace OpenSim.Region.Terrain
|
|||
{
|
||||
for (int y = 0; y < 16; y++)
|
||||
{
|
||||
if (IsTainted(x*16, y*16))
|
||||
if (IsTainted(x * 16, y * 16))
|
||||
{
|
||||
remoteUser.SendLayerData(x, y, GetHeights1D());
|
||||
bool usingTerrainModule = false;
|
||||
|
||||
if (!usingTerrainModule)
|
||||
{
|
||||
remoteUser.SendLayerData(x, y, GetHeights1D());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue