Merge branch 'master' of /home/opensim/var/repo/opensim
commit
b6f6f05e1a
|
@ -662,11 +662,11 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw {0}", e);
|
m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw {0}{1}", e.Message, e.StackTrace);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw {0}", e.StackTrace);
|
m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw {0}{1}", e.Message, e.StackTrace);
|
||||||
SendHTML500(response);
|
SendHTML500(response);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|
|
@ -151,11 +151,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
|
||||||
Scene scene = (Scene)(client.Scene);
|
Scene scene = (Scene)(client.Scene);
|
||||||
ScenePresence presence = scene.GetScenePresence(client.AgentId);
|
ScenePresence presence = scene.GetScenePresence(client.AgentId);
|
||||||
|
|
||||||
|
// Round up Z co-ordinate rather than round-down by casting. This stops tall avatars from being given
|
||||||
|
// a teleport Z co-ordinate by short avatars that drops them through or embeds them in thin floors on
|
||||||
|
// arrival.
|
||||||
|
//
|
||||||
|
// Ideally we would give the exact float position adjusting for the relative height of the two avatars
|
||||||
|
// but it looks like a float component isn't possible with a parcel ID.
|
||||||
UUID dest = Util.BuildFakeParcelID(
|
UUID dest = Util.BuildFakeParcelID(
|
||||||
scene.RegionInfo.RegionHandle,
|
scene.RegionInfo.RegionHandle,
|
||||||
(uint)presence.AbsolutePosition.X,
|
(uint)presence.AbsolutePosition.X,
|
||||||
(uint)presence.AbsolutePosition.Y,
|
(uint)presence.AbsolutePosition.Y,
|
||||||
(uint)presence.AbsolutePosition.Z);
|
(uint)Math.Ceiling(presence.AbsolutePosition.Z));
|
||||||
|
|
||||||
m_log.DebugFormat("TP invite with message {0}", message);
|
m_log.DebugFormat("TP invite with message {0}", message);
|
||||||
|
|
||||||
|
|
|
@ -59,28 +59,32 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
||||||
/// <returns>A terrain channel generated from the image.</returns>
|
/// <returns>A terrain channel generated from the image.</returns>
|
||||||
public virtual ITerrainChannel LoadFile(string filename)
|
public virtual ITerrainChannel LoadFile(string filename)
|
||||||
{
|
{
|
||||||
return LoadBitmap(new Bitmap(filename));
|
using (Bitmap b = new Bitmap(filename))
|
||||||
|
return LoadBitmap(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual ITerrainChannel LoadFile(string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int w, int h)
|
public virtual ITerrainChannel LoadFile(string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int w, int h)
|
||||||
{
|
{
|
||||||
Bitmap bitmap = new Bitmap(filename);
|
using (Bitmap bitmap = new Bitmap(filename))
|
||||||
ITerrainChannel retval = new TerrainChannel(true);
|
|
||||||
|
|
||||||
for (int x = 0; x < retval.Width; x++)
|
|
||||||
{
|
{
|
||||||
for (int y = 0; y < retval.Height; y++)
|
ITerrainChannel retval = new TerrainChannel(true);
|
||||||
{
|
|
||||||
retval[x, y] = bitmap.GetPixel(offsetX * retval.Width + x, (bitmap.Height - (retval.Height * (offsetY + 1))) + retval.Height - y - 1).GetBrightness() * 128;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return retval;
|
for (int x = 0; x < retval.Width; x++)
|
||||||
|
{
|
||||||
|
for (int y = 0; y < retval.Height; y++)
|
||||||
|
{
|
||||||
|
retval[x, y] = bitmap.GetPixel(offsetX * retval.Width + x, (bitmap.Height - (retval.Height * (offsetY + 1))) + retval.Height - y - 1).GetBrightness() * 128;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual ITerrainChannel LoadStream(Stream stream)
|
public virtual ITerrainChannel LoadStream(Stream stream)
|
||||||
{
|
{
|
||||||
return LoadBitmap(new Bitmap(stream));
|
using (Bitmap b = new Bitmap(stream))
|
||||||
|
return LoadBitmap(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual ITerrainChannel LoadBitmap(Bitmap bitmap)
|
protected virtual ITerrainChannel LoadBitmap(Bitmap bitmap)
|
||||||
|
@ -134,35 +138,50 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
||||||
// "Saving the image to the same file it was constructed from is not allowed and throws an exception."
|
// "Saving the image to the same file it was constructed from is not allowed and throws an exception."
|
||||||
string tempName = Path.GetTempFileName();
|
string tempName = Path.GetTempFileName();
|
||||||
|
|
||||||
Bitmap entireBitmap = null;
|
Bitmap existingBitmap = null;
|
||||||
Bitmap thisBitmap = null;
|
Bitmap thisBitmap;
|
||||||
if (File.Exists(filename))
|
Bitmap newBitmap;
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
File.Copy(filename, tempName, true);
|
if (File.Exists(filename))
|
||||||
entireBitmap = new Bitmap(tempName);
|
|
||||||
if (entireBitmap.Width != fileWidth * regionSizeX || entireBitmap.Height != fileHeight * regionSizeY)
|
|
||||||
{
|
{
|
||||||
// old file, let's overwrite it
|
File.Copy(filename, tempName, true);
|
||||||
entireBitmap = new Bitmap(fileWidth * regionSizeX, fileHeight * regionSizeY);
|
existingBitmap = new Bitmap(tempName);
|
||||||
|
if (existingBitmap.Width != fileWidth * regionSizeX || existingBitmap.Height != fileHeight * regionSizeY)
|
||||||
|
{
|
||||||
|
// old file, let's overwrite it
|
||||||
|
newBitmap = new Bitmap(fileWidth * regionSizeX, fileHeight * regionSizeY);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newBitmap = existingBitmap;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newBitmap = new Bitmap(fileWidth * regionSizeX, fileHeight * regionSizeY);
|
||||||
|
}
|
||||||
|
|
||||||
|
thisBitmap = CreateGrayscaleBitmapFromMap(m_channel);
|
||||||
|
// Console.WriteLine("offsetX=" + offsetX + " offsetY=" + offsetY);
|
||||||
|
for (int x = 0; x < regionSizeX; x++)
|
||||||
|
for (int y = 0; y < regionSizeY; y++)
|
||||||
|
newBitmap.SetPixel(x + offsetX * regionSizeX, y + (fileHeight - 1 - offsetY) * regionSizeY, thisBitmap.GetPixel(x, y));
|
||||||
|
|
||||||
|
Save(newBitmap, filename);
|
||||||
}
|
}
|
||||||
else
|
finally
|
||||||
{
|
{
|
||||||
entireBitmap = new Bitmap(fileWidth * regionSizeX, fileHeight * regionSizeY);
|
if (existingBitmap != null)
|
||||||
|
existingBitmap.Dispose();
|
||||||
|
|
||||||
|
thisBitmap.Dispose();
|
||||||
|
newBitmap.Dispose();
|
||||||
|
|
||||||
|
if (File.Exists(tempName))
|
||||||
|
File.Delete(tempName);
|
||||||
}
|
}
|
||||||
|
|
||||||
thisBitmap = CreateGrayscaleBitmapFromMap(m_channel);
|
|
||||||
// Console.WriteLine("offsetX=" + offsetX + " offsetY=" + offsetY);
|
|
||||||
for (int x = 0; x < regionSizeX; x++)
|
|
||||||
for (int y = 0; y < regionSizeY; y++)
|
|
||||||
entireBitmap.SetPixel(x + offsetX * regionSizeX, y + (fileHeight - 1 - offsetY) * regionSizeY, thisBitmap.GetPixel(x, y));
|
|
||||||
|
|
||||||
Save(entireBitmap, filename);
|
|
||||||
thisBitmap.Dispose();
|
|
||||||
entireBitmap.Dispose();
|
|
||||||
|
|
||||||
if (File.Exists(tempName))
|
|
||||||
File.Delete(tempName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void Save(Bitmap bmp, string filename)
|
protected virtual void Save(Bitmap bmp, string filename)
|
||||||
|
@ -226,16 +245,21 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
||||||
/// <returns>A System.Drawing.Bitmap containing a coloured image</returns>
|
/// <returns>A System.Drawing.Bitmap containing a coloured image</returns>
|
||||||
protected static Bitmap CreateBitmapFromMap(ITerrainChannel map)
|
protected static Bitmap CreateBitmapFromMap(ITerrainChannel map)
|
||||||
{
|
{
|
||||||
Bitmap gradientmapLd = new Bitmap("defaultstripe.png");
|
int pallete;
|
||||||
|
Bitmap bmp;
|
||||||
|
Color[] colours;
|
||||||
|
|
||||||
int pallete = gradientmapLd.Height;
|
using (Bitmap gradientmapLd = new Bitmap("defaultstripe.png"))
|
||||||
|
|
||||||
Bitmap bmp = new Bitmap(map.Width, map.Height);
|
|
||||||
Color[] colours = new Color[pallete];
|
|
||||||
|
|
||||||
for (int i = 0; i < pallete; i++)
|
|
||||||
{
|
{
|
||||||
colours[i] = gradientmapLd.GetPixel(0, i);
|
pallete = gradientmapLd.Height;
|
||||||
|
|
||||||
|
bmp = new Bitmap(map.Width, map.Height);
|
||||||
|
colours = new Color[pallete];
|
||||||
|
|
||||||
|
for (int i = 0; i < pallete; i++)
|
||||||
|
{
|
||||||
|
colours[i] = gradientmapLd.GetPixel(0, i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int y = 0; y < map.Height; y++)
|
for (int y = 0; y < map.Height; y++)
|
||||||
|
|
|
@ -99,16 +99,21 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
||||||
|
|
||||||
private static Bitmap CreateBitmapFromMap(ITerrainChannel map)
|
private static Bitmap CreateBitmapFromMap(ITerrainChannel map)
|
||||||
{
|
{
|
||||||
Bitmap gradientmapLd = new Bitmap("defaultstripe.png");
|
int pallete;
|
||||||
|
Bitmap bmp;
|
||||||
|
Color[] colours;
|
||||||
|
|
||||||
int pallete = gradientmapLd.Height;
|
using (Bitmap gradientmapLd = new Bitmap("defaultstripe.png"))
|
||||||
|
|
||||||
Bitmap bmp = new Bitmap(map.Width, map.Height);
|
|
||||||
Color[] colours = new Color[pallete];
|
|
||||||
|
|
||||||
for (int i = 0; i < pallete; i++)
|
|
||||||
{
|
{
|
||||||
colours[i] = gradientmapLd.GetPixel(0, i);
|
pallete = gradientmapLd.Height;
|
||||||
|
|
||||||
|
bmp = new Bitmap(map.Width, map.Height);
|
||||||
|
colours = new Color[pallete];
|
||||||
|
|
||||||
|
for (int i = 0; i < pallete; i++)
|
||||||
|
{
|
||||||
|
colours[i] = gradientmapLd.GetPixel(0, i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int y = 0; y < map.Height; y++)
|
for (int y = 0; y < map.Height; y++)
|
||||||
|
|
|
@ -154,7 +154,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
|
||||||
|
|
||||||
UUID mapTile = m_HGMapImage;
|
UUID mapTile = m_HGMapImage;
|
||||||
string filename = string.Empty;
|
string filename = string.Empty;
|
||||||
Bitmap bitmap = null;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
WebClient c = new WebClient();
|
WebClient c = new WebClient();
|
||||||
|
@ -167,11 +167,18 @@ namespace OpenSim.Services.Connectors.Hypergrid
|
||||||
c.DownloadFile(imageURL, filename);
|
c.DownloadFile(imageURL, filename);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: using cached image");
|
m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: using cached image");
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] imageData = null;
|
||||||
|
|
||||||
|
using (Bitmap bitmap = new Bitmap(filename))
|
||||||
|
{
|
||||||
|
//m_log.Debug("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width);
|
||||||
|
imageData = OpenJPEG.EncodeFromImage(bitmap, true);
|
||||||
|
}
|
||||||
|
|
||||||
bitmap = new Bitmap(filename);
|
|
||||||
//m_log.Debug("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width);
|
|
||||||
byte[] imageData = OpenJPEG.EncodeFromImage(bitmap, true);
|
|
||||||
AssetBase ass = new AssetBase(UUID.Random(), "region " + name, (sbyte)AssetType.Texture, regionID.ToString());
|
AssetBase ass = new AssetBase(UUID.Random(), "region " + name, (sbyte)AssetType.Texture, regionID.ToString());
|
||||||
|
|
||||||
// !!! for now
|
// !!! for now
|
||||||
|
|
Loading…
Reference in New Issue