From 2dea3dbd6bb4e382dfb1a7dddd5c104dc889e83c Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sun, 15 Jul 2007 15:51:09 +0000 Subject: * Terrain now uses the new StorageManager. --- OpenSim/Region/Environment/Scenes/Scene.cs | 8 +++---- .../OpenSim.DataStore.NullStorage/NullDataStore.cs | 4 ++-- .../Region/Terrain.BasicTerrain/TerrainEngine.cs | 26 ++++++++++++++++++++++ 3 files changed, 32 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index de39261..839a75a 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -352,7 +352,7 @@ namespace OpenSim.Region.Environment.Scenes { try { - float[] map = this.localStorage.LoadWorld(); + double[,] map = this.storageManager.DataStore.LoadTerrain(); if (map == null) { if (string.IsNullOrEmpty(this.m_regInfo.estateSettings.terrainFile)) @@ -360,7 +360,7 @@ namespace OpenSim.Region.Environment.Scenes Console.WriteLine("No default terrain, procedurally generating..."); this.Terrain.hills(); - this.localStorage.SaveMap(this.Terrain.getHeights1D()); + this.storageManager.DataStore.StoreTerrain(this.Terrain.getHeights2DD()); } else { @@ -374,12 +374,12 @@ namespace OpenSim.Region.Environment.Scenes Console.WriteLine("Unable to load default terrain, procedurally generating instead..."); Terrain.hills(); } - this.localStorage.SaveMap(this.Terrain.getHeights1D()); + this.storageManager.DataStore.StoreTerrain(this.Terrain.getHeights2DD()); } } else { - this.Terrain.setHeights1D(map); + this.Terrain.setHeights2D(map); } CreateTerrainTexture(); diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs index b67ba93..8542ef3 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs @@ -29,7 +29,7 @@ namespace OpenSim.DataStore.NullStorage public List LoadObjects() { - return null; + return new List(); } public void StoreTerrain(double[,] ter) @@ -54,7 +54,7 @@ namespace OpenSim.DataStore.NullStorage public List LoadParcels() { - return null; + return new List(); } public void Shutdown() diff --git a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs index d177ed5..f017e44 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs @@ -124,6 +124,15 @@ namespace OpenSim.Region.Terrain } /// + /// Converts the heightmap to a 256x256 value 2D floating point array. Double precision version. + /// + /// An array of 256,256 values containing the heightmap + public double[,] getHeights2DD() + { + return heightmap.map; + } + + /// /// Imports a 1D floating point array into the 2D heightmap array /// /// The array to import (must have 65536 members) @@ -156,6 +165,23 @@ namespace OpenSim.Region.Terrain } /// + /// Loads a 2D array of values into the heightmap (Double Precision Version) + /// + /// An array of 256,256 float values + public void setHeights2D(double[,] heights) + { + int x, y; + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + heightmap.set(x, y, heights[x, y]); + } + } + tainted++; + } + + /// /// Swaps the two heightmap buffers (the 'revert map' and the heightmap) /// public void swapRevertMaps() -- cgit v1.1