Merge commit '440905ad14d4261df9da0fd2ce7e20a350982af1' into careminster

avinationmerge
Melanie 2013-05-25 02:00:02 +01:00
commit 2b87fb73a9
1 changed files with 83 additions and 53 deletions

View File

@ -386,9 +386,40 @@ namespace OpenSim.Region.Physics.Meshing
if (map.ContainsKey("physics_convex"))
{ // pull this out also in case physics engine can use it
OSD convexBlockOsd = null;
try
{
OSDMap convexBlock = (OSDMap)map["physics_convex"];
{
int convexOffset = convexBlock["offset"].AsInteger() + (int)start;
int convexSize = convexBlock["size"].AsInteger();
byte[] convexBytes = new byte[convexSize];
System.Buffer.BlockCopy(primShape.SculptData, convexOffset, convexBytes, 0, convexSize);
try
{
convexBlockOsd = DecompressOsd(convexBytes);
}
catch (Exception e)
{
m_log.ErrorFormat("{0} prim='{1}': exception decoding convex block: {2}", LogHeader, primName, e);
//return false;
}
}
if (convexBlockOsd != null && convexBlockOsd is OSDMap)
{
convexBlock = convexBlockOsd as OSDMap;
if (debugDetail)
{
string keys = "[MESH]: keys found in convexBlock: ";
foreach (KeyValuePair<string, OSD> kvp in convexBlock)
keys += "'" + kvp.Key + "' ";
m_log.Debug(keys);
}
Vector3 min = new Vector3(-0.5f, -0.5f, -0.5f);
if (convexBlock.ContainsKey("Min")) min = convexBlock["Min"].AsVector3();
@ -399,8 +430,7 @@ namespace OpenSim.Region.Physics.Meshing
if (convexBlock.ContainsKey("BoundingVerts"))
{
// decompress and decode bounding hull points
byte[] boundingVertsBytes = DecompressOsd(convexBlock["BoundingVerts"].AsBinary()).AsBinary();
byte[] boundingVertsBytes = convexBlock["BoundingVerts"].AsBinary();
boundingHull = new List<Vector3>();
for (int i = 0; i < boundingVertsBytes.Length; )
{
@ -418,15 +448,14 @@ namespace OpenSim.Region.Physics.Meshing
}
mBoundingHull = boundingHull;
if (debugDetail) m_log.DebugFormat("{0} prim='{1}': parsed bounding hull. nHulls={2}", LogHeader, primName, mBoundingHull.Count);
if (debugDetail) m_log.DebugFormat("{0} prim='{1}': parsed bounding hull. nVerts={2}", LogHeader, primName, mBoundingHull.Count);
}
if (convexBlock.ContainsKey("HullList"))
{
byte[] hullList = convexBlock["HullList"].AsBinary();
// decompress and decode hull points
byte[] posBytes = DecompressOsd(convexBlock["Positions"].AsBinary()).AsBinary();
byte[] posBytes = convexBlock["Positions"].AsBinary();
List<List<Vector3>> hulls = new List<List<Vector3>>();
int posNdx = 0;
@ -462,6 +491,7 @@ namespace OpenSim.Region.Physics.Meshing
if (debugDetail) m_log.DebugFormat("{0} prim='{1}' has physics_convex but no HullList", LogHeader, primName);
}
}
}
catch (Exception e)
{
m_log.WarnFormat("{0} exception decoding convex block: {1}", LogHeader, e);