varregion: serious rework of TerrainChannel:

-- addition of varaible region size in X and Y
    -- internal storage of heightmap changed from double[] to short[]
    -- helper routines for handling internal structure while keeping existing API
    -- to and from XML that adds region size information (for downward compatibility,
        output in the legacy XML format if X and Y are 256)
Updated and commented Constants.RegionSize but didn't change the name for compatibility.
This commit is contained in:
Robert Adams
2013-09-25 17:21:20 -07:00
parent aea5d3a842
commit 8c1d80fdfd
9 changed files with 255 additions and 143 deletions

View File

@@ -134,26 +134,26 @@ namespace OpenSim.Region.Framework.Interfaces
Dictionary<string, string> GetExtra(UUID regionID);
void Shutdown();
}
// The terrain is stored as a blob in the database with a 'revision' field.
// Some implementations of terrain storage would fill the revision field with
// the time the terrain was stored. When real revisions were added and this
// feature removed, that left some old entries with the time in the revision
// field.
// Thus, if revision is greater than 'RevisionHigh' then terrain db entry is
// left over and it is presumed to be 'Legacy256'.
// Numbers are arbitrary and are chosen to to reduce possible mis-interpretation.
// If a revision does not match any of these, it is assumed to be Legacy256.
public enum DBTerrainRevision
{
// Terrain is 'double[256,256]'
Legacy256 = 11,
// Terrain is 'int32, int32, float[,]' where the shorts are X and Y dimensions
// The dimensions are presumed to be multiples of 16 and, more likely, multiples of 256.
Variable2D = 22,
// A revision that is not listed above or any revision greater than this value is 'Legacy256'.
RevisionHigh = 1234
}
// The terrain is stored as a blob in the database with a 'revision' field.
// Some implementations of terrain storage would fill the revision field with
// the time the terrain was stored. When real revisions were added and this
// feature removed, that left some old entries with the time in the revision
// field.
// Thus, if revision is greater than 'RevisionHigh' then terrain db entry is
// left over and it is presumed to be 'Legacy256'.
// Numbers are arbitrary and are chosen to to reduce possible mis-interpretation.
// If a revision does not match any of these, it is assumed to be Legacy256.
public enum DBTerrainRevision
{
// Terrain is 'double[256,256]'
Legacy256 = 11,
// Terrain is 'int32, int32, float[,]' where the shorts are X and Y dimensions
// The dimensions are presumed to be multiples of 16 and, more likely, multiples of 256.
Variable2D = 22,
// A revision that is not listed above or any revision greater than this value is 'Legacy256'.
RevisionHigh = 1234
}
}

View File

@@ -29,15 +29,21 @@ namespace OpenSim.Region.Framework.Interfaces
{
public interface ITerrainChannel
{
int Height { get; }
int Width { get;} // X dimension
int Height { get;} // Y dimension
int Altitude { get;} // Z dimension
double this[int x, int y] { get; set; }
int Width { get; }
/// <summary>
/// Squash the entire heightmap into a single dimensioned array
/// </summary>
/// <returns></returns>
float[] GetFloatsSerialised();
// Get version of map as a single dimensioned array and each value compressed
// into an int (compressedHeight = (int)(floatHeight * Constants.TerrainCompression);)
// This is done to make the map smaller as it can get pretty larger for variable sized regions.
short[] GetCompressedMap();
double[,] GetDoubles();
bool Tainted(int x, int y);