Fixed inverted map texture problem.

Added(from trunk) the loading of terrain files defined in the region.xml files.
This commit is contained in:
MW
2007-06-17 19:25:04 +00:00
parent ef494fdf9c
commit 99a308007c
28 changed files with 88 additions and 8 deletions

View File

@@ -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;
}
}
}

View File

@@ -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
{

View File

@@ -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;
}
}

View File

@@ -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);
}