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. --- Common/OpenSim.Framework/Types/RegionInfo.cs | 27 +++++++++++++++++++++ .../CommunicationsLocal.cs | 6 ++--- OpenSim/OpenSim.Region/Scenes/Scene.cs | 25 +++++++++++++++++-- .../OpenSim.Terrain.BasicTerrain/TerrainEngine.cs | 3 ++- OpenSim/OpenSim/OpenSimMain.cs | 6 +++-- Prebuild/Prebuild.build | 7 ++++++ Prebuild/Prebuild.sln | 3 +++ bin/TerrainDatafiles/Alien/HOWTO.txt | 19 +++++++++++++++ bin/TerrainDatafiles/Alien/alienworld.bmp | Bin 0 -> 1048630 bytes bin/TerrainDatafiles/Alien/alienworld_0_0.bmp | Bin 0 -> 262198 bytes bin/TerrainDatafiles/Alien/alienworld_0_0.r32 | Bin 0 -> 262144 bytes bin/TerrainDatafiles/Alien/alienworld_0_1.bmp | Bin 0 -> 262198 bytes bin/TerrainDatafiles/Alien/alienworld_0_1.r32 | Bin 0 -> 262144 bytes bin/TerrainDatafiles/Alien/alienworld_0_2.bmp | Bin 0 -> 262198 bytes bin/TerrainDatafiles/Alien/alienworld_0_2.r32 | Bin 0 -> 262144 bytes bin/TerrainDatafiles/Alien/alienworld_1_0.bmp | Bin 0 -> 262198 bytes bin/TerrainDatafiles/Alien/alienworld_1_0.r32 | Bin 0 -> 262144 bytes bin/TerrainDatafiles/Alien/alienworld_1_1.bmp | Bin 0 -> 262198 bytes bin/TerrainDatafiles/Alien/alienworld_1_1.r32 | Bin 0 -> 262144 bytes bin/TerrainDatafiles/Alien/alienworld_1_2.bmp | Bin 0 -> 262198 bytes bin/TerrainDatafiles/Alien/alienworld_1_2.r32 | Bin 0 -> 262144 bytes bin/TerrainDatafiles/Alien/alienworld_2_0.bmp | Bin 0 -> 262198 bytes bin/TerrainDatafiles/Alien/alienworld_2_0.r32 | Bin 0 -> 262144 bytes bin/TerrainDatafiles/Alien/alienworld_2_1.bmp | Bin 0 -> 262198 bytes bin/TerrainDatafiles/Alien/alienworld_2_1.r32 | Bin 0 -> 262144 bytes bin/TerrainDatafiles/Alien/alienworld_2_2.bmp | Bin 0 -> 262198 bytes bin/TerrainDatafiles/Alien/alienworld_2_2.r32 | Bin 0 -> 262144 bytes bin/TerrainDatafiles/Alien/alienworld_gray.bmp | Bin 0 -> 786486 bytes 28 files changed, 88 insertions(+), 8 deletions(-) create mode 100644 bin/TerrainDatafiles/Alien/HOWTO.txt create mode 100644 bin/TerrainDatafiles/Alien/alienworld.bmp create mode 100644 bin/TerrainDatafiles/Alien/alienworld_0_0.bmp create mode 100644 bin/TerrainDatafiles/Alien/alienworld_0_0.r32 create mode 100644 bin/TerrainDatafiles/Alien/alienworld_0_1.bmp create mode 100644 bin/TerrainDatafiles/Alien/alienworld_0_1.r32 create mode 100644 bin/TerrainDatafiles/Alien/alienworld_0_2.bmp create mode 100644 bin/TerrainDatafiles/Alien/alienworld_0_2.r32 create mode 100644 bin/TerrainDatafiles/Alien/alienworld_1_0.bmp create mode 100644 bin/TerrainDatafiles/Alien/alienworld_1_0.r32 create mode 100644 bin/TerrainDatafiles/Alien/alienworld_1_1.bmp create mode 100644 bin/TerrainDatafiles/Alien/alienworld_1_1.r32 create mode 100644 bin/TerrainDatafiles/Alien/alienworld_1_2.bmp create mode 100644 bin/TerrainDatafiles/Alien/alienworld_1_2.r32 create mode 100644 bin/TerrainDatafiles/Alien/alienworld_2_0.bmp create mode 100644 bin/TerrainDatafiles/Alien/alienworld_2_0.r32 create mode 100644 bin/TerrainDatafiles/Alien/alienworld_2_1.bmp create mode 100644 bin/TerrainDatafiles/Alien/alienworld_2_1.r32 create mode 100644 bin/TerrainDatafiles/Alien/alienworld_2_2.bmp create mode 100644 bin/TerrainDatafiles/Alien/alienworld_2_2.r32 create mode 100644 bin/TerrainDatafiles/Alien/alienworld_gray.bmp diff --git a/Common/OpenSim.Framework/Types/RegionInfo.cs b/Common/OpenSim.Framework/Types/RegionInfo.cs index ad1399d..2c24327 100644 --- a/Common/OpenSim.Framework/Types/RegionInfo.cs +++ b/Common/OpenSim.Framework/Types/RegionInfo.cs @@ -28,6 +28,7 @@ using System; using System.Collections.Generic; using System.Text; +using System.Globalization; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Utilities; using OpenSim.Framework.Console; @@ -178,6 +179,32 @@ namespace OpenSim.Framework.Types this.IPListenAddr = attri; } } + + attri = ""; + attri = configData.GetAttribute("TerrainFile"); + if (attri == "") + { + this.estateSettings.terrainFile = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("GENERAL SETTING: Default Terrain File", "default.r32"); + configData.SetAttribute("TerrainFile", this.estateSettings.terrainFile); + } + else + { + this.estateSettings.terrainFile = attri; + } + + attri = ""; + attri = configData.GetAttribute("TerrainMultiplier"); + if (attri == "") + { + string re = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("GENERAL SETTING: Terrain Height Multiplier", "60.0"); + this.estateSettings.terrainMultiplier = Convert.ToDouble(re, CultureInfo.InvariantCulture); + configData.SetAttribute("TerrainMultiplier", this.estateSettings.terrainMultiplier.ToString()); + } + else + { + this.estateSettings.terrainMultiplier = Convert.ToDouble(attri); + } + attri = ""; attri = configData.GetAttribute("MasterAvatarFirstName"); if (attri == "") 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); } diff --git a/Prebuild/Prebuild.build b/Prebuild/Prebuild.build index c6c4660..395fb31 100644 --- a/Prebuild/Prebuild.build +++ b/Prebuild/Prebuild.build @@ -12,6 +12,13 @@ + + + + + + + diff --git a/Prebuild/Prebuild.sln b/Prebuild/Prebuild.sln index 440c8ba..449896b 100644 --- a/Prebuild/Prebuild.sln +++ b/Prebuild/Prebuild.sln @@ -5,10 +5,13 @@ EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {92E80C1C-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {92E80C1C-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {92E80C1C-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {92E80C1C-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/bin/TerrainDatafiles/Alien/HOWTO.txt b/bin/TerrainDatafiles/Alien/HOWTO.txt new file mode 100644 index 0000000..00a65d7 --- /dev/null +++ b/bin/TerrainDatafiles/Alien/HOWTO.txt @@ -0,0 +1,19 @@ +Use the "terrain load" command to import these datafiles. +They are stored as Float-32 arrays, use the F32 import type. + +These files are formatted on a scale of 0 to 1, they are designed for a range of 0..58.81 +use the 'multiply' command to multiply them by 58.81 to achieve correct height values. + +Example ------------------ +Region# : terrain load f32 c:\opensim\datafiles\output_x0_y0.r32 +Region# : terrain multiply 58.81 + + + + 0,0 - 1,0 - 2,0 + 0,1 - 1,1 - 2,1 + 0,2 - 1,2, 2,2 + + +for a 3x3 area on the grid + diff --git a/bin/TerrainDatafiles/Alien/alienworld.bmp b/bin/TerrainDatafiles/Alien/alienworld.bmp new file mode 100644 index 0000000..0e2405e Binary files /dev/null and b/bin/TerrainDatafiles/Alien/alienworld.bmp differ diff --git a/bin/TerrainDatafiles/Alien/alienworld_0_0.bmp b/bin/TerrainDatafiles/Alien/alienworld_0_0.bmp new file mode 100644 index 0000000..0a3afc0 Binary files /dev/null and b/bin/TerrainDatafiles/Alien/alienworld_0_0.bmp differ diff --git a/bin/TerrainDatafiles/Alien/alienworld_0_0.r32 b/bin/TerrainDatafiles/Alien/alienworld_0_0.r32 new file mode 100644 index 0000000..299dc8c Binary files /dev/null and b/bin/TerrainDatafiles/Alien/alienworld_0_0.r32 differ diff --git a/bin/TerrainDatafiles/Alien/alienworld_0_1.bmp b/bin/TerrainDatafiles/Alien/alienworld_0_1.bmp new file mode 100644 index 0000000..ec3b5d2 Binary files /dev/null and b/bin/TerrainDatafiles/Alien/alienworld_0_1.bmp differ diff --git a/bin/TerrainDatafiles/Alien/alienworld_0_1.r32 b/bin/TerrainDatafiles/Alien/alienworld_0_1.r32 new file mode 100644 index 0000000..0dd41fc Binary files /dev/null and b/bin/TerrainDatafiles/Alien/alienworld_0_1.r32 differ diff --git a/bin/TerrainDatafiles/Alien/alienworld_0_2.bmp b/bin/TerrainDatafiles/Alien/alienworld_0_2.bmp new file mode 100644 index 0000000..ce341e5 Binary files /dev/null and b/bin/TerrainDatafiles/Alien/alienworld_0_2.bmp differ diff --git a/bin/TerrainDatafiles/Alien/alienworld_0_2.r32 b/bin/TerrainDatafiles/Alien/alienworld_0_2.r32 new file mode 100644 index 0000000..28df00a Binary files /dev/null and b/bin/TerrainDatafiles/Alien/alienworld_0_2.r32 differ diff --git a/bin/TerrainDatafiles/Alien/alienworld_1_0.bmp b/bin/TerrainDatafiles/Alien/alienworld_1_0.bmp new file mode 100644 index 0000000..7fb3d96 Binary files /dev/null and b/bin/TerrainDatafiles/Alien/alienworld_1_0.bmp differ diff --git a/bin/TerrainDatafiles/Alien/alienworld_1_0.r32 b/bin/TerrainDatafiles/Alien/alienworld_1_0.r32 new file mode 100644 index 0000000..99d5072 Binary files /dev/null and b/bin/TerrainDatafiles/Alien/alienworld_1_0.r32 differ diff --git a/bin/TerrainDatafiles/Alien/alienworld_1_1.bmp b/bin/TerrainDatafiles/Alien/alienworld_1_1.bmp new file mode 100644 index 0000000..bd5d31a Binary files /dev/null and b/bin/TerrainDatafiles/Alien/alienworld_1_1.bmp differ diff --git a/bin/TerrainDatafiles/Alien/alienworld_1_1.r32 b/bin/TerrainDatafiles/Alien/alienworld_1_1.r32 new file mode 100644 index 0000000..fdb3acf Binary files /dev/null and b/bin/TerrainDatafiles/Alien/alienworld_1_1.r32 differ diff --git a/bin/TerrainDatafiles/Alien/alienworld_1_2.bmp b/bin/TerrainDatafiles/Alien/alienworld_1_2.bmp new file mode 100644 index 0000000..a5a719d Binary files /dev/null and b/bin/TerrainDatafiles/Alien/alienworld_1_2.bmp differ diff --git a/bin/TerrainDatafiles/Alien/alienworld_1_2.r32 b/bin/TerrainDatafiles/Alien/alienworld_1_2.r32 new file mode 100644 index 0000000..4e0155b Binary files /dev/null and b/bin/TerrainDatafiles/Alien/alienworld_1_2.r32 differ diff --git a/bin/TerrainDatafiles/Alien/alienworld_2_0.bmp b/bin/TerrainDatafiles/Alien/alienworld_2_0.bmp new file mode 100644 index 0000000..a5c6792 Binary files /dev/null and b/bin/TerrainDatafiles/Alien/alienworld_2_0.bmp differ diff --git a/bin/TerrainDatafiles/Alien/alienworld_2_0.r32 b/bin/TerrainDatafiles/Alien/alienworld_2_0.r32 new file mode 100644 index 0000000..0c12470 Binary files /dev/null and b/bin/TerrainDatafiles/Alien/alienworld_2_0.r32 differ diff --git a/bin/TerrainDatafiles/Alien/alienworld_2_1.bmp b/bin/TerrainDatafiles/Alien/alienworld_2_1.bmp new file mode 100644 index 0000000..e1f6376 Binary files /dev/null and b/bin/TerrainDatafiles/Alien/alienworld_2_1.bmp differ diff --git a/bin/TerrainDatafiles/Alien/alienworld_2_1.r32 b/bin/TerrainDatafiles/Alien/alienworld_2_1.r32 new file mode 100644 index 0000000..96534b8 Binary files /dev/null and b/bin/TerrainDatafiles/Alien/alienworld_2_1.r32 differ diff --git a/bin/TerrainDatafiles/Alien/alienworld_2_2.bmp b/bin/TerrainDatafiles/Alien/alienworld_2_2.bmp new file mode 100644 index 0000000..eabdd93 Binary files /dev/null and b/bin/TerrainDatafiles/Alien/alienworld_2_2.bmp differ diff --git a/bin/TerrainDatafiles/Alien/alienworld_2_2.r32 b/bin/TerrainDatafiles/Alien/alienworld_2_2.r32 new file mode 100644 index 0000000..20724c3 Binary files /dev/null and b/bin/TerrainDatafiles/Alien/alienworld_2_2.r32 differ diff --git a/bin/TerrainDatafiles/Alien/alienworld_gray.bmp b/bin/TerrainDatafiles/Alien/alienworld_gray.bmp new file mode 100644 index 0000000..9cc3699 Binary files /dev/null and b/bin/TerrainDatafiles/Alien/alienworld_gray.bmp differ -- cgit v1.1