From f64611862a46c91f416134146cb53fa720a96ec5 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Wed, 5 Mar 2008 00:52:35 +0000 Subject: * 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. --- .../Environment/Modules/Terrain/TerrainModule.cs | 40 +++++++++++++++++++--- 1 file changed, 36 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs') diff --git a/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs b/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs index 1542230..2cf77ff 100644 --- a/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs +++ b/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs @@ -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 { -- cgit v1.1