* This is the fabled LibOMV update with all of the libOMV types from JHurliman

* This is a HUGE OMG update and will definitely have unknown side effects.. so this is really only for the strong hearted at this point.  Regular people should let the dust settle.
* This has been tested to work with most basic functions. However..   make sure you back up 'everything' before using this.  It's that big!  
* Essentially we're back at square 1 in the testing phase..  so lets identify things that broke.
This commit is contained in:
Teravus Ovares
2008-09-06 07:52:41 +00:00
parent cbec2bf22b
commit 7d89e12293
388 changed files with 6811 additions and 7138 deletions

View File

@@ -32,13 +32,12 @@ using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Reflection;
using Axiom.Math;
using Nini.Config;
using OpenMetaverse.Imaging;
using log4net;
using OpenJPEGNet;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
using libsecondlife;
using OpenMetaverse;
namespace OpenSim.Region.Environment.Modules.World.WorldMap
{
@@ -252,7 +251,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
if (part.Shape.Textures.DefaultTexture == null)
continue;
LLColor texcolor = part.Shape.Textures.DefaultTexture.RGBA;
Color4 texcolor = part.Shape.Textures.DefaultTexture.RGBA;
// Not sure why some of these are null, oh well.
@@ -265,7 +264,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
//Try to set the map spot color
try
{
// If the color gets goofy somehow, skip it *shakes fist at LLColor
// If the color gets goofy somehow, skip it *shakes fist at Color4
mapdotspot = Color.FromArgb(colorr, colorg, colorb);
}
catch (ArgumentException)
@@ -282,7 +281,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
// Mono Array
}
LLVector3 pos = part.GetWorldPosition();
Vector3 pos = part.GetWorldPosition();
// skip prim outside of retion
if (pos.X < 0f || pos.X > 256f || pos.Y < 0f || pos.Y > 256f)
@@ -312,20 +311,20 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
Vector3 tScale = new Vector3();
Vector3 axPos = new Vector3(pos.X,pos.Y,pos.Z);
LLQuaternion llrot = part.GetWorldRotation();
Quaternion llrot = part.GetWorldRotation();
Quaternion rot = new Quaternion(llrot.W, llrot.X, llrot.Y, llrot.Z);
scale = rot * lscale;
scale = lscale * rot;
// negative scales don't work in this situation
scale.x = Math.Abs(scale.x);
scale.y = Math.Abs(scale.y);
scale.z = Math.Abs(scale.z);
scale.X = Math.Abs(scale.X);
scale.Y = Math.Abs(scale.Y);
scale.Z = Math.Abs(scale.Z);
// This scaling isn't very accurate and doesn't take into account the face rotation :P
int mapdrawstartX = (int)(pos.X - scale.x);
int mapdrawstartY = (int)(pos.Y - scale.y);
int mapdrawendX = (int)(pos.X + scale.x);
int mapdrawendY = (int)(pos.Y + scale.y);
int mapdrawstartX = (int)(pos.X - scale.X);
int mapdrawstartY = (int)(pos.Y - scale.Y);
int mapdrawendX = (int)(pos.X + scale.X);
int mapdrawendY = (int)(pos.Y + scale.Y);
// If object is beyond the edge of the map, don't draw it to avoid errors
if (mapdrawstartX < 0 || mapdrawstartX > 255 || mapdrawendX < 0 || mapdrawendX > 255
@@ -342,9 +341,9 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
Vector3[] FaceC = new Vector3[6]; // vertex C for Facei
Vector3[] FaceD = new Vector3[6]; // vertex D for Facei
tScale = new Vector3(lscale.x, -lscale.y, lscale.z);
scale = ((rot * tScale));
vertexes[0] = (new Vector3((pos.X + scale.x), (pos.Y + scale.y), (pos.Z + scale.z)));
tScale = new Vector3(lscale.X, -lscale.Y, lscale.Z);
scale = ((tScale * rot));
vertexes[0] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
// vertexes[0].x = pos.X + vertexes[0].x;
//vertexes[0].y = pos.Y + vertexes[0].y;
//vertexes[0].z = pos.Z + vertexes[0].z;
@@ -354,8 +353,8 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
FaceA[4] = vertexes[0];
tScale = lscale;
scale = ((rot * tScale));
vertexes[1] = (new Vector3((pos.X + scale.x), (pos.Y + scale.y), (pos.Z + scale.z)));
scale = ((tScale * rot));
vertexes[1] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
// vertexes[1].x = pos.X + vertexes[1].x;
// vertexes[1].y = pos.Y + vertexes[1].y;
@@ -365,10 +364,10 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
FaceA[1] = vertexes[1];
FaceC[4] = vertexes[1];
tScale = new Vector3(lscale.x, -lscale.y, -lscale.z);
scale = ((rot * tScale));
tScale = new Vector3(lscale.X, -lscale.Y, -lscale.Z);
scale = ((tScale * rot));
vertexes[2] = (new Vector3((pos.X + scale.x), (pos.Y + scale.y), (pos.Z + scale.z)));
vertexes[2] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
//vertexes[2].x = pos.X + vertexes[2].x;
//vertexes[2].y = pos.Y + vertexes[2].y;
@@ -378,9 +377,9 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
FaceD[3] = vertexes[2];
FaceC[5] = vertexes[2];
tScale = new Vector3(lscale.x, lscale.y, -lscale.z);
scale = ((rot * tScale));
vertexes[3] = (new Vector3((pos.X + scale.x), (pos.Y + scale.y), (pos.Z + scale.z)));
tScale = new Vector3(lscale.X, lscale.Y, -lscale.Z);
scale = ((tScale * rot));
vertexes[3] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
//vertexes[3].x = pos.X + vertexes[3].x;
// vertexes[3].y = pos.Y + vertexes[3].y;
@@ -390,9 +389,9 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
FaceC[1] = vertexes[3];
FaceA[5] = vertexes[3];
tScale = new Vector3(-lscale.x, lscale.y, lscale.z);
scale = ((rot * tScale));
vertexes[4] = (new Vector3((pos.X + scale.x), (pos.Y + scale.y), (pos.Z + scale.z)));
tScale = new Vector3(-lscale.X, lscale.Y, lscale.Z);
scale = ((tScale * rot));
vertexes[4] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
// vertexes[4].x = pos.X + vertexes[4].x;
// vertexes[4].y = pos.Y + vertexes[4].y;
@@ -402,9 +401,9 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
FaceA[2] = vertexes[4];
FaceD[4] = vertexes[4];
tScale = new Vector3(-lscale.x, lscale.y, -lscale.z);
scale = ((rot * tScale));
vertexes[5] = (new Vector3((pos.X + scale.x), (pos.Y + scale.y), (pos.Z + scale.z)));
tScale = new Vector3(-lscale.X, lscale.Y, -lscale.Z);
scale = ((tScale * rot));
vertexes[5] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
// vertexes[5].x = pos.X + vertexes[5].x;
// vertexes[5].y = pos.Y + vertexes[5].y;
@@ -414,9 +413,9 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
FaceC[2] = vertexes[5];
FaceB[5] = vertexes[5];
tScale = new Vector3(-lscale.x, -lscale.y, lscale.z);
scale = ((rot * tScale));
vertexes[6] = (new Vector3((pos.X + scale.x), (pos.Y + scale.y), (pos.Z + scale.z)));
tScale = new Vector3(-lscale.X, -lscale.Y, lscale.Z);
scale = ((tScale * rot));
vertexes[6] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
// vertexes[6].x = pos.X + vertexes[6].x;
// vertexes[6].y = pos.Y + vertexes[6].y;
@@ -426,9 +425,9 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
FaceA[3] = vertexes[6];
FaceB[4] = vertexes[6];
tScale = new Vector3(-lscale.x, -lscale.y, -lscale.z);
scale = ((rot * tScale));
vertexes[7] = (new Vector3((pos.X + scale.x), (pos.Y + scale.y), (pos.Z + scale.z)));
tScale = new Vector3(-lscale.X, -lscale.Y, -lscale.Z);
scale = ((tScale * rot));
vertexes[7] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
// vertexes[7].x = pos.X + vertexes[7].x;
// vertexes[7].y = pos.Y + vertexes[7].y;
@@ -533,8 +532,8 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
//Vector3 topos = new Vector3(0, 0, 0);
// float z = -point3d.z - topos.z;
returnpt.X = (int)point3d.x;//(int)((topos.x - point3d.x) / z * d);
returnpt.Y = (int)(255 - point3d.y);//(int)(255 - (((topos.y - point3d.y) / z * d)));
returnpt.X = (int)point3d.X;//(int)((topos.x - point3d.x) / z * d);
returnpt.Y = (int)(255 - point3d.Y);//(int)(255 - (((topos.y - point3d.y) / z * d)));
return returnpt;
}

View File

@@ -32,13 +32,12 @@ using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Reflection;
using Axiom.Math;
using OpenMetaverse;
using OpenMetaverse.Imaging;
using Nini.Config;
using log4net;
using OpenJPEGNet;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
using libsecondlife;
namespace OpenSim.Region.Environment.Modules.World.WorldMap
{

View File

@@ -32,15 +32,14 @@ using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Reflection;
using Axiom.Math;
using OpenMetaverse;
using Nini.Config;
using log4net;
using OpenJPEGNet;
using OpenMetaverse.Imaging;
using OpenSim.Framework;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Modules.World.Terrain;
using libsecondlife;
namespace OpenSim.Region.Environment.Modules.World.WorldMap
{
@@ -122,15 +121,15 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
// some hardcoded terrain UUIDs that work with SL 1.20 (the four default textures and "Blank").
// The color-values were choosen because they "look right" (at least to me) ;-)
private static readonly LLUUID defaultTerrainTexture1 = new LLUUID("0bc58228-74a0-7e83-89bc-5c23464bcec5");
private static readonly UUID defaultTerrainTexture1 = new UUID("0bc58228-74a0-7e83-89bc-5c23464bcec5");
private static readonly Color defaultColor1 = Color.FromArgb(165, 137, 118);
private static readonly LLUUID defaultTerrainTexture2 = new LLUUID("63338ede-0037-c4fd-855b-015d77112fc8");
private static readonly UUID defaultTerrainTexture2 = new UUID("63338ede-0037-c4fd-855b-015d77112fc8");
private static readonly Color defaultColor2 = Color.FromArgb(69, 89, 49);
private static readonly LLUUID defaultTerrainTexture3 = new LLUUID("303cd381-8560-7579-23f1-f0a880799740");
private static readonly UUID defaultTerrainTexture3 = new UUID("303cd381-8560-7579-23f1-f0a880799740");
private static readonly Color defaultColor3 = Color.FromArgb(162, 154, 141);
private static readonly LLUUID defaultTerrainTexture4 = new LLUUID("53a2f406-4895-1d13-d541-d2e3b86bc19c");
private static readonly UUID defaultTerrainTexture4 = new UUID("53a2f406-4895-1d13-d541-d2e3b86bc19c");
private static readonly Color defaultColor4 = Color.FromArgb(200, 200, 200);
private static readonly LLUUID blankTerrainTexture = new LLUUID("5748decc-f629-461c-9a36-a35a221fe21f");
private static readonly UUID blankTerrainTexture = new UUID("5748decc-f629-461c-9a36-a35a221fe21f");
#endregion
@@ -142,14 +141,14 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
// added when the terrain textures are changed in the estate dialog and a new map is generated (and will stay in
// that map until the region-server restarts. This could be considered a memory-leak, but it's a *very* small one.
// TODO does it make sense to use a "real" cache and regenerate missing entries on fetch?
private Dictionary<LLUUID, Color> m_mapping;
private Dictionary<UUID, Color> m_mapping;
public void Initialise(Scene scene, IConfigSource source)
{
m_scene = scene;
// m_config = source; // not used currently
m_mapping = new Dictionary<LLUUID,Color>();
m_mapping = new Dictionary<UUID,Color>();
m_mapping.Add(defaultTerrainTexture1, defaultColor1);
m_mapping.Add(defaultTerrainTexture2, defaultColor2);
m_mapping.Add(defaultTerrainTexture3, defaultColor3);
@@ -164,12 +163,18 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
// TODO (- on "map" command: We are in the command-line thread, we will wait for completion anyway)
// TODO (- on "automatic" update after some change: We are called from the mapUpdateTimer here and
// will wait anyway)
private Bitmap fetchTexture(LLUUID id)
private Bitmap fetchTexture(UUID id)
{
AssetBase asset = m_scene.AssetCache.GetAsset(id, true);
m_log.DebugFormat("Fetched texture {0}, found: {1}", id, asset != null);
if (asset == null) return null;
return new Bitmap(OpenJPEG.DecodeToImage(asset.Data));
ManagedImage managedImage;
Image image;
if (OpenJPEG.DecodeToImage(asset.Data, out managedImage, out image))
return new Bitmap(image);
else
return null;
}
// Compute the average color of a texture.
@@ -196,8 +201,8 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
// return either the average color of the texture, or the defaultColor if the texturID is invalid
// or the texture couldn't be found
private Color computeAverageColor(LLUUID textureID, Color defaultColor) {
if (textureID == LLUUID.Zero) return defaultColor; // not set
private Color computeAverageColor(UUID textureID, Color defaultColor) {
if (textureID == UUID.Zero) return defaultColor; // not set
if (m_mapping.ContainsKey(textureID)) return m_mapping[textureID]; // one of the predefined textures
Bitmap bmp = fetchTexture(textureID);

View File

@@ -32,8 +32,8 @@ using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Reflection;
using libsecondlife;
using OpenJPEGNet;
using OpenMetaverse;
using OpenMetaverse.Imaging;
using log4net;
using Nini.Config;
using OpenSim.Framework;
@@ -103,7 +103,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
#endregion
public void OnRegisterCaps(LLUUID agentID, Caps caps)
public void OnRegisterCaps(UUID agentID, Caps caps)
{
m_log.DebugFormat("[VOICE] OnRegisterCaps: agentID {0} caps {1}", agentID, caps);
string capsBase = "/CAPS/" + caps.CapsObjectPath;
@@ -127,7 +127,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
/// <param name="caps"></param>
/// <returns></returns>
public string MapLayerRequest(string request, string path, string param,
LLUUID agentID, Caps caps)
UUID agentID, Caps caps)
{
//try
//{
@@ -197,7 +197,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
LLSDMapLayer mapLayer = new LLSDMapLayer();
mapLayer.Right = 5000;
mapLayer.Top = 5000;
mapLayer.ImageID = new LLUUID("00000000-0000-1111-9999-000000000006");
mapLayer.ImageID = new UUID("00000000-0000-1111-9999-000000000006");
return mapLayer;
}
@@ -223,7 +223,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
//doFriendListUpdateOnline(client.AgentId);
client.OnRequestMapBlocks += RequestMapBlocks;
}
private void ClientLoggedOut(LLUUID AgentId)
private void ClientLoggedOut(UUID AgentId)
{
}
@@ -248,15 +248,14 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
m_log.Info("[WEBMAP]: Sending map image jpeg");
Hashtable reply = new Hashtable();
int statuscode = 200;
byte[] jpeg;
byte[] jpeg = new byte[0];
if (myMapImageJPEG.Length == 0)
{
MemoryStream imgstream = new MemoryStream();
Bitmap mapTexture = new Bitmap(1,1);
System.Drawing.Image image = (System.Drawing.Image)mapTexture;
ManagedImage managedImage;
Image image = (Image)mapTexture;
try
{
@@ -268,21 +267,24 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
AssetBase mapasset = m_scene.AssetCache.GetAsset(m_scene.RegionInfo.lastMapUUID, true);
// Decode image to System.Drawing.Image
image = OpenJPEG.DecodeToImage(mapasset.Data);
if (OpenJPEG.DecodeToImage(mapasset.Data, out managedImage, out image))
{
// Save to bitmap
mapTexture = new Bitmap(image);
// Save to bitmap
mapTexture = new Bitmap(image);
ImageCodecInfo myImageCodecInfo;
ImageCodecInfo myImageCodecInfo;
Encoder myEncoder;
Encoder myEncoder;
EncoderParameter myEncoderParameter;
EncoderParameters myEncoderParameters = new EncoderParameters();
EncoderParameter myEncoderParameter;
EncoderParameters myEncoderParameters = new EncoderParameters();
myImageCodecInfo = GetEncoderInfo("image/jpeg");
myImageCodecInfo = GetEncoderInfo("image/jpeg");
myEncoder = Encoder.Quality;
myEncoder = Encoder.Quality;
myEncoderParameter = new EncoderParameter(myEncoder, 95L);
myEncoderParameters.Param[0] = myEncoderParameter;
myEncoderParameter = new EncoderParameter(myEncoder, 95L);
myEncoderParameters.Param[0] = myEncoderParameter;
@@ -290,14 +292,14 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
// Save bitmap to stream
mapTexture.Save(imgstream, myImageCodecInfo, myEncoderParameters);
// Write the stream to a byte array for output
jpeg = imgstream.ToArray();
myMapImageJPEG = jpeg;
// Write the stream to a byte array for output
jpeg = imgstream.ToArray();
myMapImageJPEG = jpeg;
}
}
catch (Exception)
{
// Dummy!
jpeg = new byte[0];
m_log.Warn("[WEBMAP]: Unable to generate Map image");
}
finally
@@ -314,7 +316,6 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
// Use cached version so we don't have to loose our mind
jpeg = myMapImageJPEG;
}
//jpeg = new byte[0];
reply["str_response_string"] = Convert.ToBase64String(jpeg);
reply["int_response_code"] = statuscode;