Merge branch 'master' of git://opensimulator.org/git/opensim

viewer-2-initial-appearance
Jonathan Freedman 2010-10-18 23:00:48 -04:00
commit 12128f1917
13 changed files with 118 additions and 62 deletions

View File

@ -167,6 +167,7 @@ This software uses components from the following developers:
* GlynnTucker.Cache (http://gtcache.sourceforge.net/) * GlynnTucker.Cache (http://gtcache.sourceforge.net/)
* NDesk.Options 0.2.1 (http://www.ndesk.org/Options) * NDesk.Options 0.2.1 (http://www.ndesk.org/Options)
* Json.NET 3.5 Release 6. The binary used is actually Newtonsoft.Json.Net20.dll for Mono 2.4 compatability (http://james.newtonking.com/projects/json-net.aspx) * Json.NET 3.5 Release 6. The binary used is actually Newtonsoft.Json.Net20.dll for Mono 2.4 compatability (http://james.newtonking.com/projects/json-net.aspx)
* zlib.net for C# 1.0.4 (http://www.componentace.com/zlib_.NET.htm)
Some plugins are based on Cable Beach Some plugins are based on Cable Beach
Cable Beach is Copyright (c) 2008 Intel Corporation Cable Beach is Copyright (c) 2008 Intel Corporation

View File

@ -62,6 +62,8 @@ namespace OpenSim.Data.MySQL
if (scopeID != UUID.Zero) if (scopeID != UUID.Zero)
command += " and ScopeID = ?scopeID"; command += " and ScopeID = ?scopeID";
command += " order by regionName";
using (MySqlCommand cmd = new MySqlCommand(command)) using (MySqlCommand cmd = new MySqlCommand(command))
{ {
cmd.Parameters.AddWithValue("?regionName", regionName); cmd.Parameters.AddWithValue("?regionName", regionName);

View File

@ -14,7 +14,7 @@ CREATE INDEX UserID ON Presence(UserID);
COMMIT; COMMIT;
:VERSION 1 # -------------------------- :VERSION 2 # --------------------------
BEGIN; BEGIN;

View File

@ -159,9 +159,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
private void OnInstantMessage(IClientAPI client, GridInstantMessage im) private void OnInstantMessage(IClientAPI client, GridInstantMessage im)
{ {
m_log.DebugFormat( // m_log.DebugFormat(
"[INVENTORY TRANSFER]: {0} IM type received from {1}", // "[INVENTORY TRANSFER]: {0} IM type received from {1}",
(InstantMessageDialog)im.dialog, client.Name); // (InstantMessageDialog)im.dialog, client.Name);
Scene scene = FindClientScene(client.AgentId); Scene scene = FindClientScene(client.AgentId);

View File

@ -1363,7 +1363,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
} }
else else
{ {
m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element {0}", nodeName); // m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element {0}", nodeName);
reader.ReadOuterXml(); // ignore reader.ReadOuterXml(); // ignore
} }
@ -1438,7 +1438,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
p(item, reader); p(item, reader);
else else
{ {
m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element in TaskInventory {0}, {1}", reader.Name, reader.Value); // m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element in TaskInventory {0}, {1}", reader.Name, reader.Value);
reader.ReadOuterXml(); reader.ReadOuterXml();
} }
} }
@ -1467,7 +1467,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
p(shape, reader); p(shape, reader);
else else
{ {
m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element in Shape {0}", reader.Name); // m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element in Shape {0}", reader.Name);
reader.ReadOuterXml(); reader.ReadOuterXml();
} }
} }

View File

@ -212,11 +212,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
public void SendMessageToGroup(GridInstantMessage im, UUID groupID) public void SendMessageToGroup(GridInstantMessage im, UUID groupID)
{ {
List<GroupMembersData> groupMembers = m_groupData.GetGroupMembers(new UUID(im.fromAgentID), groupID);
if (m_debugEnabled) if (m_debugEnabled)
m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); m_log.DebugFormat(
"[GROUPS-MESSAGING]: SendMessageToGroup called for group {0} with {1} visible members",
groupID, groupMembers.Count);
foreach (GroupMembersData member in groupMembers)
foreach (GroupMembersData member in m_groupData.GetGroupMembers(UUID.Zero, groupID))
{ {
if (m_groupData.hasAgentDroppedGroupChatSession(member.AgentID, groupID)) if (m_groupData.hasAgentDroppedGroupChatSession(member.AgentID, groupID))
{ {
@ -264,8 +267,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
void OnClientLogin(IClientAPI client) void OnClientLogin(IClientAPI client)
{ {
if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: OnInstantMessage registered for {0}", client.Name); if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: OnInstantMessage registered for {0}", client.Name);
} }
private void OnNewClient(IClientAPI client) private void OnNewClient(IClientAPI client)

View File

@ -599,7 +599,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
public List<GroupMembersData> GroupMembersRequest(IClientAPI remoteClient, UUID groupID) public List<GroupMembersData> GroupMembersRequest(IClientAPI remoteClient, UUID groupID)
{ {
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); if (m_debugEnabled)
m_log.DebugFormat(
"[GROUPS]: GroupMembersRequest called for {0} from client {1}", groupID, remoteClient.Name);
List<GroupMembersData> data = m_groupData.GetGroupMembers(GetRequestingAgentID(remoteClient), groupID); List<GroupMembersData> data = m_groupData.GetGroupMembers(GetRequestingAgentID(remoteClient), groupID);
if (m_debugEnabled) if (m_debugEnabled)

View File

@ -641,11 +641,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
} }
return Roles; return Roles;
} }
public List<GroupMembersData> GetGroupMembers(UUID requestingAgentID, UUID GroupID) public List<GroupMembersData> GetGroupMembers(UUID requestingAgentID, UUID GroupID)
{ {
Hashtable param = new Hashtable(); Hashtable param = new Hashtable();
@ -988,8 +985,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
} }
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: An error has occured while attempting to access the XmlRpcGroups server method: {0}", function); m_log.ErrorFormat(
m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0} ", e.ToString()); "[XMLRPC-GROUPS-CONNECTOR]: An error has occured while attempting to access the XmlRpcGroups server method {0} at {1}",
function, m_groupsServerURI);
m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0}{1}", e.Message, e.StackTrace);
foreach (string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine }, StringSplitOptions.None)) foreach (string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine }, StringSplitOptions.None))
{ {

View File

@ -40,6 +40,7 @@ using log4net;
using Nini.Config; using Nini.Config;
using System.Reflection; using System.Reflection;
using System.IO; using System.IO;
using ComponentAce.Compression.Libs.zlib;
namespace OpenSim.Region.Physics.Meshing namespace OpenSim.Region.Physics.Meshing
{ {
@ -74,6 +75,7 @@ namespace OpenSim.Region.Physics.Meshing
private bool cacheSculptMaps = true; private bool cacheSculptMaps = true;
private string decodedSculptMapPath = null; private string decodedSculptMapPath = null;
private bool useMeshiesPhysicsMesh = false;
private float minSizeForComplexMesh = 0.2f; // prims with all dimensions smaller than this will have a bounding box mesh private float minSizeForComplexMesh = 0.2f; // prims with all dimensions smaller than this will have a bounding box mesh
@ -85,6 +87,7 @@ namespace OpenSim.Region.Physics.Meshing
decodedSculptMapPath = start_config.GetString("DecodedSculptMapPath","j2kDecodeCache"); decodedSculptMapPath = start_config.GetString("DecodedSculptMapPath","j2kDecodeCache");
cacheSculptMaps = start_config.GetBoolean("CacheSculptMaps", cacheSculptMaps); cacheSculptMaps = start_config.GetBoolean("CacheSculptMaps", cacheSculptMaps);
useMeshiesPhysicsMesh = start_config.GetBoolean("UseMeshiesPhysicsMesh", useMeshiesPhysicsMesh);
try try
{ {
@ -268,73 +271,113 @@ namespace OpenSim.Region.Physics.Meshing
{ {
if (((OpenMetaverse.SculptType)primShape.SculptType) == SculptType.Mesh) if (((OpenMetaverse.SculptType)primShape.SculptType) == SculptType.Mesh)
{ {
// add code for mesh physics proxy generation here if (!useMeshiesPhysicsMesh)
m_log.Debug("[MESH]: mesh proxy generation not implemented yet "); return null;
m_log.Debug("[MESH]: experimental mesh proxy generation");
OSD meshOsd; OSD meshOsd;
if (primShape.SculptData.Length > 0) if (primShape.SculptData.Length <= 0)
{
m_log.Debug("[MESH]: asset data length: " + primShape.SculptData.Length.ToString());
byte[] header = Util.StringToBytes256("<? LLSD/Binary ?>");
////dump to debugging file
//string filename = System.IO.Path.Combine(decodedSculptMapPath, "mesh_" + primShape.SculptTexture.ToString());
//BinaryWriter writer = new BinaryWriter(File.Open(filename, FileMode.Create));
//writer.Write(primShape.SculptData);
//writer.Close();
}
else
{ {
m_log.Error("[MESH]: asset data is zero length"); m_log.Error("[MESH]: asset data is zero length");
return null; return null;
} }
try long start = 0;
using (MemoryStream data = new MemoryStream(primShape.SculptData))
{ {
meshOsd = OSDParser.DeserializeLLSDBinary(primShape.SculptData, true); meshOsd = (OSDMap)OSDParser.DeserializeLLSDBinary(data, true);
} start = data.Position;
catch (Exception e)
{
m_log.Error("[MESH]: exception decoding mesh asset: " + e.ToString());
return null;
} }
if (meshOsd is OSDMap) if (meshOsd is OSDMap)
{ {
OSDMap map = (OSDMap)meshOsd; OSDMap map = (OSDMap)meshOsd;
//foreach (string name in map.Keys)
// m_log.Debug("[MESH]: key:" + name + " value:" + map[name].AsString());
OSDMap physicsParms = (OSDMap)map["physics_shape"]; OSDMap physicsParms = (OSDMap)map["physics_shape"];
int physOffset = physicsParms["offset"].AsInteger(); int physOffset = physicsParms["offset"].AsInteger() + (int)start;
int physSize = physicsParms["size"].AsInteger(); int physSize = physicsParms["size"].AsInteger();
if (physOffset < 0 || physSize == 0) if (physOffset < 0 || physSize == 0)
return null; // no mesh data in asset return null; // no mesh data in asset
m_log.Debug("[MESH]: physOffset:" + physOffset.ToString() + " physSize:" + physSize.ToString()); OSD decodedMeshOsd = new OSD();
//MemoryStream ms = new MemoryStream(primShape.SculptData, physOffset, physSize); byte[] meshBytes = new byte[physSize];
//GZipStream gzStream = new GZipStream(ms, CompressionMode.Decompress); System.Buffer.BlockCopy(primShape.SculptData, physOffset, meshBytes, 0, physSize);
byte[] decompressed = new byte[physSize * 5];
//int maxSize = physSize * 5; // arbitrary guess try
//byte[] readBuffer = new byte[maxSize]; {
using (MemoryStream inMs = new MemoryStream(meshBytes))
//int bytesRead = gzStream.Read(readBuffer, 0, maxSize); {
using (MemoryStream outMs = new MemoryStream())
//OSD physMeshOsd = OSDParser.DeserializeLLSDBinary(readBuffer); {
using (ZOutputStream zOut = new ZOutputStream(outMs))
{
byte[] readBuffer = new byte[2048];
int readLen = 0;
while ((readLen = inMs.Read(readBuffer, 0, readBuffer.Length)) > 0)
{
zOut.Write(readBuffer, 0, readLen);
}
zOut.Flush();
outMs.Seek(0, SeekOrigin.Begin);
byte[] decompressedBuf = outMs.GetBuffer();
decodedMeshOsd = OSDParser.DeserializeLLSDBinary(decompressedBuf, true);
}
}
}
}
catch (Exception e)
{
m_log.Error("[MESH]: exception decoding physical mesh: " + e.ToString());
return null;
} }
//just bail out for now until mesh code is finished OSDArray decodedMeshOsdArray = null;
return null;
// physics_shape is an array of OSDMaps, one for each submesh
if (decodedMeshOsd is OSDArray)
{
decodedMeshOsdArray = (OSDArray)decodedMeshOsd;
foreach (OSD subMeshOsd in decodedMeshOsdArray)
{
if (subMeshOsd is OSDMap)
{
OSDMap subMeshMap = (OSDMap)subMeshOsd;
OpenMetaverse.Vector3 posMax = ((OSDMap)subMeshMap["PositionDomain"])["Max"].AsVector3();
OpenMetaverse.Vector3 posMin = ((OSDMap)subMeshMap["PositionDomain"])["Min"].AsVector3();
byte[] posBytes = subMeshMap["Position"].AsBinary();
for (int i = 0; i < posBytes.Length; i += 6)
{
ushort uX = Utils.BytesToUInt16(posBytes, i);
ushort uY = Utils.BytesToUInt16(posBytes, i + 2);
ushort uZ = Utils.BytesToUInt16(posBytes, i + 4);
Coord c = new Coord(
Utils.UInt16ToFloat(uX, posMin.X, posMax.X) * size.X,
Utils.UInt16ToFloat(uY, posMin.Y, posMax.Y) * size.Y,
Utils.UInt16ToFloat(uZ, posMin.Z, posMax.Z) * size.Z);
coords.Add(c);
}
byte[] triangleBytes = subMeshMap["TriangleList"].AsBinary();
for (int i = 0; i < triangleBytes.Length; i += 6)
{
ushort v1 = Utils.BytesToUInt16(triangleBytes, i);
ushort v2 = Utils.BytesToUInt16(triangleBytes, i + 2);
ushort v3 = Utils.BytesToUInt16(triangleBytes, i + 4);
Face f = new Face(v1, v2, v3);
faces.Add(f);
}
}
}
}
}
} }
else else
{ {

View File

@ -323,7 +323,7 @@ namespace OpenSim.Services.GridService
{ {
m_log.DebugFormat("[GRID SERVICE]: GetRegionsByName {0}", name); m_log.DebugFormat("[GRID SERVICE]: GetRegionsByName {0}", name);
List<RegionData> rdatas = m_Database.Get("%" + name + "%", scopeID); List<RegionData> rdatas = m_Database.Get(name + "%", scopeID);
int count = 0; int count = 0;
List<GridRegion> rinfos = new List<GridRegion>(); List<GridRegion> rinfos = new List<GridRegion>();

View File

@ -147,6 +147,12 @@
; to false if you have compatibility problems. ; to false if you have compatibility problems.
;CacheSculptMaps = true ;CacheSculptMaps = true
; if you use Meshmerizer and want collisions for meshies, setting this to true
; will cause OpenSim to attempt to decode meshies assets, extract the physics
; mesh, and use it for collisions. This is currently experimental code and enabling
; it may cause unexpected physics problems.
;UseMeshiesPhysicsMesh = false
; Choose one of the physics engines below ; Choose one of the physics engines below
; OpenDynamicsEngine is by some distance the most developed physics engine ; OpenDynamicsEngine is by some distance the most developed physics engine
; basicphysics effectively does not model physics at all, making all objects phantom ; basicphysics effectively does not model physics at all, making all objects phantom

BIN
bin/zlib.net.dll Normal file

Binary file not shown.

View File

@ -587,7 +587,6 @@
<ReferencePath>../../../../bin/</ReferencePath> <ReferencePath>../../../../bin/</ReferencePath>
<Reference name="System"/> <Reference name="System"/>
<Reference name="System.Drawing"/> <Reference name="System.Drawing"/>
<Reference name="System.IO.Compression;"/>
<Reference name="CSJ2K" path="../../../../bin/"/> <Reference name="CSJ2K" path="../../../../bin/"/>
<Reference name="OpenMetaverseTypes" path="../../../../bin/"/> <Reference name="OpenMetaverseTypes" path="../../../../bin/"/>
<Reference name="OpenMetaverse" path="../../../../bin/"/> <Reference name="OpenMetaverse" path="../../../../bin/"/>
@ -597,6 +596,7 @@
<Reference name="OpenSim.Framework.Console"/> <Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Region.Physics.Manager"/> <Reference name="OpenSim.Region.Physics.Manager"/>
<Reference name="log4net" path="../../../../bin/"/> <Reference name="log4net" path="../../../../bin/"/>
<Reference name="zlib.net" path="../../../../bin/"/>
<Files> <Files>
<Match pattern="*.cs" recurse="true"/> <Match pattern="*.cs" recurse="true"/>