* Renamed a number of TerrainEngine functions to conform naming standards better.
parent
f22b8b6f04
commit
7d61705c3c
|
@ -685,7 +685,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
private void UpdateTerrain()
|
private void UpdateTerrain()
|
||||||
{
|
{
|
||||||
if (Terrain.Tainted() && !Terrain.StillEditing())
|
if (Terrain.IsTainted() && !Terrain.IsUserStillEditing())
|
||||||
{
|
{
|
||||||
CreateTerrainTexture(true);
|
CreateTerrainTexture(true);
|
||||||
|
|
||||||
|
@ -706,7 +706,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
for (int y = 0; y < 16; y++)
|
for (int y = 0; y < 16; y++)
|
||||||
{
|
{
|
||||||
if (Terrain.Tainted(x*16, y*16))
|
if (Terrain.IsTainted(x*16, y*16))
|
||||||
{
|
{
|
||||||
client.SendLayerData(x, y, terData);
|
client.SendLayerData(x, y, terData);
|
||||||
}
|
}
|
||||||
|
@ -807,6 +807,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
public void LoadWorldMap(string filename)
|
public void LoadWorldMap(string filename)
|
||||||
{
|
{
|
||||||
Terrain.LoadFromFileF32(filename);
|
Terrain.LoadFromFileF32(filename);
|
||||||
|
Terrain.SaveRevertMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -823,7 +824,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
if (string.IsNullOrEmpty(m_regInfo.EstateSettings.terrainFile))
|
if (string.IsNullOrEmpty(m_regInfo.EstateSettings.terrainFile))
|
||||||
{
|
{
|
||||||
MainLog.Instance.Verbose("TERRAIN", "No default terrain. Generating a new terrain.");
|
MainLog.Instance.Verbose("TERRAIN", "No default terrain. Generating a new terrain.");
|
||||||
Terrain.HillsGenerator();
|
Terrain.SetDefaultTerrain();
|
||||||
|
|
||||||
m_storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(), RegionInfo.RegionID);
|
m_storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(), RegionInfo.RegionID);
|
||||||
}
|
}
|
||||||
|
@ -838,7 +839,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
MainLog.Instance.Verbose("TERRAIN",
|
MainLog.Instance.Verbose("TERRAIN",
|
||||||
"No terrain found in database or default. Generating a new terrain.");
|
"No terrain found in database or default. Generating a new terrain.");
|
||||||
Terrain.HillsGenerator();
|
Terrain.SetDefaultTerrain();
|
||||||
}
|
}
|
||||||
m_storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(), RegionInfo.RegionID);
|
m_storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(), RegionInfo.RegionID);
|
||||||
}
|
}
|
||||||
|
@ -885,7 +886,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
public void CreateTerrainTexture(bool temporary)
|
public void CreateTerrainTexture(bool temporary)
|
||||||
{
|
{
|
||||||
//create a texture asset of the terrain
|
//create a texture asset of the terrain
|
||||||
byte[] data = Terrain.ExportJpegImage("defaultstripe.png");
|
byte[] data = Terrain.WriteJpegImage("defaultstripe.png");
|
||||||
m_regInfo.EstateSettings.terrainImageID = LLUUID.Random();
|
m_regInfo.EstateSettings.terrainImageID = LLUUID.Random();
|
||||||
AssetBase asset = new AssetBase();
|
AssetBase asset = new AssetBase();
|
||||||
asset.FullID = m_regInfo.EstateSettings.terrainImageID;
|
asset.FullID = m_regInfo.EstateSettings.terrainImageID;
|
||||||
|
|
|
@ -123,12 +123,12 @@ namespace OpenSim.Region.Terrain
|
||||||
tainted++;
|
tainted++;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Tainted()
|
public bool IsTainted()
|
||||||
{
|
{
|
||||||
return (tainted != 0);
|
return (tainted != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool StillEditing()
|
public bool IsUserStillEditing()
|
||||||
{
|
{
|
||||||
TimeSpan gap = DateTime.Now - lastEdit;
|
TimeSpan gap = DateTime.Now - lastEdit;
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ namespace OpenSim.Region.Terrain
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Tainted(int x, int y)
|
public bool IsTainted(int x, int y)
|
||||||
{
|
{
|
||||||
return (heightmap.diff[x/16, y/16] != 0);
|
return (heightmap.diff[x/16, y/16] != 0);
|
||||||
}
|
}
|
||||||
|
@ -284,7 +284,7 @@ namespace OpenSim.Region.Terrain
|
||||||
{
|
{
|
||||||
for (int y = 0; y < 16; y++)
|
for (int y = 0; y < 16; y++)
|
||||||
{
|
{
|
||||||
if (Tainted(x*16, y*16))
|
if (IsTainted(x*16, y*16))
|
||||||
{
|
{
|
||||||
remoteUser.SendLayerData(x, y, GetHeights1D());
|
remoteUser.SendLayerData(x, y, GetHeights1D());
|
||||||
}
|
}
|
||||||
|
@ -300,7 +300,7 @@ namespace OpenSim.Region.Terrain
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks to make sure the terrain is within baked values +/- maxRaise/minLower
|
/// Checks to make sure the terrain is within baked values +/- maxRaise/minLower
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void CheckHeightValues()
|
private void SetTerrainWithinBounds()
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
for (x = 0; x < w; x++)
|
for (x = 0; x < w; x++)
|
||||||
|
@ -518,7 +518,7 @@ namespace OpenSim.Region.Terrain
|
||||||
return ConsoleHills(args, ref resultText);
|
return ConsoleHills(args, ref resultText);
|
||||||
|
|
||||||
case "regenerate":
|
case "regenerate":
|
||||||
HillsGenerator();
|
SetDefaultTerrain();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "rescale":
|
case "rescale":
|
||||||
|
@ -618,9 +618,9 @@ namespace OpenSim.Region.Terrain
|
||||||
|
|
||||||
case "grdmap":
|
case "grdmap":
|
||||||
if (args.Length >= 4)
|
if (args.Length >= 4)
|
||||||
ExportImage(filename, args[3]);
|
WriteImage(filename, args[3]);
|
||||||
else
|
else
|
||||||
ExportImage(filename, "defaultstripe.png");
|
WriteImage(filename, "defaultstripe.png");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "png":
|
case "png":
|
||||||
|
@ -1272,7 +1272,7 @@ namespace OpenSim.Region.Terrain
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generates a simple set of hills in the shape of an island
|
/// Generates a simple set of hills in the shape of an island
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void HillsGenerator()
|
public void SetDefaultTerrain()
|
||||||
{
|
{
|
||||||
lock (heightmap)
|
lock (heightmap)
|
||||||
{
|
{
|
||||||
|
@ -1317,7 +1317,7 @@ namespace OpenSim.Region.Terrain
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="filename">The destination filename for the image</param>
|
/// <param name="filename">The destination filename for the image</param>
|
||||||
/// <param name="gradientmap">A 1x*height* image which contains the colour gradient to export with. Must be at least 1x2 pixels, 1x256 or more is ideal.</param>
|
/// <param name="gradientmap">A 1x*height* image which contains the colour gradient to export with. Must be at least 1x2 pixels, 1x256 or more is ideal.</param>
|
||||||
public void ExportImage(string filename, string gradientmap)
|
public void WriteImage(string filename, string gradientmap)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1335,7 +1335,7 @@ namespace OpenSim.Region.Terrain
|
||||||
/// Exports the current heightmap in Jpeg2000 format to a byte[]
|
/// Exports the current heightmap in Jpeg2000 format to a byte[]
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="gradientmap">A 1x*height* image which contains the colour gradient to export with. Must be at least 1x2 pixels, 1x256 or more is ideal.</param>
|
/// <param name="gradientmap">A 1x*height* image which contains the colour gradient to export with. Must be at least 1x2 pixels, 1x256 or more is ideal.</param>
|
||||||
public byte[] ExportJpegImage(string gradientmap)
|
public byte[] WriteJpegImage(string gradientmap)
|
||||||
{
|
{
|
||||||
byte[] imageData = null;
|
byte[] imageData = null;
|
||||||
try
|
try
|
||||||
|
|
Loading…
Reference in New Issue