From 99a308007c6c13dc13a2184eb34014de94d75ea8 Mon Sep 17 00:00:00 2001 From: MW Date: Sun, 17 Jun 2007 19:25:04 +0000 Subject: Fixed inverted map texture problem. Added(from trunk) the loading of terrain files defined in the region.xml files. --- .../CommunicationsLocal.cs | 6 +++--- OpenSim/OpenSim.Region/Scenes/Scene.cs | 25 ++++++++++++++++++++-- .../OpenSim.Terrain.BasicTerrain/TerrainEngine.cs | 3 ++- OpenSim/OpenSim/OpenSimMain.cs | 6 ++++-- 4 files changed, 32 insertions(+), 8 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/OpenSim.LocalCommunications/CommunicationsLocal.cs b/OpenSim/OpenSim.LocalCommunications/CommunicationsLocal.cs index 2293608..9b811ae 100644 --- a/OpenSim/OpenSim.LocalCommunications/CommunicationsLocal.cs +++ b/OpenSim/OpenSim.LocalCommunications/CommunicationsLocal.cs @@ -39,13 +39,13 @@ namespace OpenSim.LocalCommunications { public class CommunicationsLocal : CommunicationsManager { - public LocalBackEndServices SandManager = new LocalBackEndServices(); + public LocalBackEndServices SandBoxManager = new LocalBackEndServices(); public CommunicationsLocal() { UserServer = null; - GridServer = SandManager; - InterRegion = SandManager; + GridServer = SandBoxManager; + InterRegion = SandBoxManager; } } } diff --git a/OpenSim/OpenSim.Region/Scenes/Scene.cs b/OpenSim/OpenSim.Region/Scenes/Scene.cs index ca9a112..5744f1f 100644 --- a/OpenSim/OpenSim.Region/Scenes/Scene.cs +++ b/OpenSim/OpenSim.Region/Scenes/Scene.cs @@ -415,10 +415,31 @@ namespace OpenSim.Region.Scenes float[] map = this.localStorage.LoadWorld(); if (map == null) { - Console.WriteLine("creating new terrain"); - this.Terrain.hills(); + // Console.WriteLine("creating new terrain"); + // this.Terrain.hills(); // this.localStorage.SaveMap(this.Terrain.getHeights1D()); + if (string.IsNullOrEmpty(this.m_regInfo.estateSettings.terrainFile)) + { + Console.WriteLine("No default terrain, procedurally generating..."); + this.Terrain.hills(); + + // this.localStorage.SaveMap(this.Terrain.getHeights1D()); + } + else + { + try + { + this.Terrain.loadFromFileF32(this.m_regInfo.estateSettings.terrainFile); + this.Terrain *= this.m_regInfo.estateSettings.terrainMultiplier; + } + catch + { + Console.WriteLine("Unable to load default terrain, procedurally generating instead..."); + Terrain.hills(); + } + // this.localStorage.SaveMap(this.Terrain.getHeights1D()); + } } else { diff --git a/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs index e5831a0..fc4ca24 100644 --- a/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs +++ b/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs @@ -536,7 +536,7 @@ namespace OpenSim.Terrain for (int y = 0; y < copy.h; y++) { // 512 is the largest possible height before colours clamp - int colorindex = (int)(Math.Max(Math.Min(1.0, copy.get(copy.w -x, copy.h - y) / 512.0), 0.0) * pallete); + int colorindex = (int)(Math.Max(Math.Min(1.0, copy.get(copy.h - y, x) / 512.0), 0.0) * pallete); bmp.SetPixel(x, y, colours[colorindex]); } } @@ -549,6 +549,7 @@ namespace OpenSim.Terrain { Console.WriteLine("Failed generating terrain map: " + e.ToString()); } + return imageData; } } diff --git a/OpenSim/OpenSim/OpenSimMain.cs b/OpenSim/OpenSim/OpenSimMain.cs index fb8511d..dddcaea 100644 --- a/OpenSim/OpenSim/OpenSimMain.cs +++ b/OpenSim/OpenSim/OpenSimMain.cs @@ -100,12 +100,14 @@ namespace OpenSim ClientView.TerrainManager = new TerrainManager(new SecondLife()); + CommunicationsLocal sandboxCommunications = null; if (m_sandbox) { this.SetupLocalGridServers(); this.checkServer = new CheckSumServer(12036); this.checkServer.ServerListener(); - this.commsManager = new CommunicationsLocal(); + sandboxCommunications = new CommunicationsLocal(); + this.commsManager = sandboxCommunications; } else { @@ -132,7 +134,7 @@ namespace OpenSim { loginServer = new LoginServer(regionData[0].IPListenAddr, regionData[0].IPListenPort, regionData[0].RegionLocX, regionData[0].RegionLocY, false); loginServer.Startup(); - loginServer.SetSessionHandler(((CommunicationsLocal)this.commsManager).SandManager.AddNewSession); + loginServer.SetSessionHandler(sandboxCommunications.SandBoxManager.AddNewSession); //sandbox mode with loginserver not using accounts httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.XmlRpcLoginMethod); } -- cgit v1.1