From 7416809077227f35ab70ed44060e51f2bcf66937 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Wed, 2 Oct 2013 16:59:37 -0700 Subject: varregion: plug in TerrainData class and modify TerrainModule and LLClientView to use same. This passes a terrain info class around rather than passing a one dimensional array thus allowing variable regions. Update the database storage for variable region sizes. This should be downward compatible (same format for 256x256 regions). --- .../CoreModules/World/Terrain/TerrainModule.cs | 29 ++++++++++++---------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region/CoreModules/World') diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index 2fff4c1..eb6187b 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs @@ -30,10 +30,14 @@ using System.Collections.Generic; using System.IO; using System.Reflection; using System.Net; + using log4net; using Nini.Config; + using OpenMetaverse; using Mono.Addins; + +using OpenSim.Data; using OpenSim.Framework; using OpenSim.Region.CoreModules.Framework.InterfaceCommander; using OpenSim.Region.CoreModules.World.Terrain.FileLoaders; @@ -130,8 +134,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain { if (m_scene.Heightmap == null) { - m_channel = new TerrainChannel(m_InitialTerrain, - m_scene.RegionInfo.RegionSizeX, m_scene.RegionInfo.RegionSizeY, m_scene.RegionInfo.RegionSizeZ); + m_channel = new TerrainChannel(m_InitialTerrain, (int)m_scene.RegionInfo.RegionSizeX, + (int)m_scene.RegionInfo.RegionSizeY, + (int)m_scene.RegionInfo.RegionSizeZ); m_scene.Heightmap = m_channel; UpdateRevertMap(); } @@ -707,7 +712,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain private void CheckForTerrainUpdates(bool respectEstateSettings) { bool shouldTaint = false; - float[] serialised = m_channel.GetFloatsSerialised(); + float[] terrData = m_channel.GetFloatsSerialised(); int x; for (x = 0; x < m_channel.Width; x += Constants.TerrainPatchSize) { @@ -716,16 +721,16 @@ namespace OpenSim.Region.CoreModules.World.Terrain { if (m_channel.Tainted(x, y)) { - // if we should respect the estate settings then - // fixup and height deltas that don't respect them + // If we should respect the estate settings then + // fixup and height deltas that don't respect them. + // Note that LimitChannelChanges() modifies the TerrainChannel with the limited height values. if (respectEstateSettings && LimitChannelChanges(x, y)) { - // this has been vetoed, so update - // what we are going to send to the client - serialised = m_channel.GetFloatsSerialised(); + // Terrain heights were modified. Refetch the terrain info. + terrData = m_channel.GetFloatsSerialised(); } - SendToClients(serialised, x, y); + SendToClients(terrData, x, y); shouldTaint = true; } } @@ -794,13 +799,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain /// A copy of the terrain as a 1D float array of size w*h /// The patch corner to send /// The patch corner to send - private void SendToClients(float[] serialised, int x, int y) + private void SendToClients(float[] heightMap, int x, int y) { m_scene.ForEachClient( delegate(IClientAPI controller) - { controller.SendLayerData( - x / Constants.TerrainPatchSize, y / Constants.TerrainPatchSize, serialised); - } + { controller.SendLayerData( x / Constants.TerrainPatchSize, y / Constants.TerrainPatchSize, heightMap); } ); } -- cgit v1.1