From b18ef976ff0e8bf2bc2fd8d8002007fcaafd0ed7 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 8 Jul 2011 19:43:22 +0100
Subject: Fix interpretation of physics mesh proxies from mesh data
As per http://wiki.secondlife.com/wiki/Mesh/Mesh_Asset_Format, some submesh blocks may just have the flag "NoGeometry" to signal that they provide no mesh data.
If a block contains this, ignore it for meshing purposes rather than suffer a ClassCastException
This fixes physics proxy meshing, so you can now walk through mesh doorways, properly stand on the trailer of mesh trucks, etc.
To get mesh physics proxy, the UseMeshiesPhysicsMesh must be true in a [Mesh] config section in OpenSim.ini (example in OpenSimDefaults.ini).
Convex hull physics not currently supported.
---
OpenSim/Framework/Util.cs | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index e5ff27a..039b926 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -324,10 +324,25 @@ namespace OpenSim.Framework
}
///
+ /// Debug utility function to convert OSD into formatted XML for debugging purposes.
+ ///
+ ///
+ /// A
+ ///
+ ///
+ /// A
+ ///
+ public static string GetFormattedXml(OSD osd)
+ {
+ return GetFormattedXml(OSDParser.SerializeLLSDXmlString(osd));
+ }
+
+ ///
/// Debug utility function to convert unbroken strings of XML into something human readable for occasional debugging purposes.
- ///
- /// Please don't delete me even if I appear currently unused!
///
+ ///
+ /// Please don't delete me even if I appear currently unused!
+ ///
///
///
public static string GetFormattedXml(string rawXml)
--
cgit v1.1
From c3d82bdcb1ac2ee0e0bdad75fbf8779252ef31c4 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 8 Jul 2011 22:53:19 +0100
Subject: When loading library asset set, only store an asset if it's different
from an existing one with the same id.
We compare existing and loaded asset by doing an SHA1 on both, so that a changed library asset will still update the store.
This cuts asset library load time from 10 seconds to <1 sec.
Note, a fix on the previous commit revealed a bug where a library script cannot be copied except on the first login after a cache clear.
This is unrelated to this commit and needs to be fixed at some subsequent time.
---
OpenSim/Framework/Util.cs | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 039b926..fce8999 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -440,20 +440,30 @@ namespace OpenSim.Framework
}
///
- /// Return an SHA1 hash of the given string
+ /// Return an SHA1 hash
///
///
///
public static string SHA1Hash(string data)
{
+ return SHA1Hash(Encoding.Default.GetBytes(data));
+ }
+
+ ///
+ /// Return an SHA1 hash
+ ///
+ ///
+ ///
+ public static string SHA1Hash(byte[] data)
+ {
byte[] hash = ComputeSHA1Hash(data);
return BitConverter.ToString(hash).Replace("-", String.Empty);
}
- private static byte[] ComputeSHA1Hash(string src)
+ private static byte[] ComputeSHA1Hash(byte[] src)
{
SHA1CryptoServiceProvider SHA1 = new SHA1CryptoServiceProvider();
- return SHA1.ComputeHash(Encoding.Default.GetBytes(src));
+ return SHA1.ComputeHash(src);
}
public static int fast_distance2d(int x, int y)
--
cgit v1.1
From 5e8900dfd058bd103cb6dcf8a57dc94683efd878 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 9 Jul 2011 00:35:30 +0100
Subject: minor: code tidy and inserted log lines for future use.
Unable to get to the bottom of why resizing a mesh fails to properly reset the physics proxy, when toggling phantom does
After a mesh is generated, the existing sculptdata is set to zero in PrimitiveBaseShape to save memory
When phantom is toggled, the sculptdata is regenerated before remeshing.
But on resize, the sculptdata is not regenerated.
So clearly, resetting sculptdata is possible, but haven't quite been able to pin down how this is being done when phantom is toggled.
---
OpenSim/Framework/PrimitiveBaseShape.cs | 46 ++++++++++++++++++++++-----------
1 file changed, 31 insertions(+), 15 deletions(-)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs
index 7b5fb2e..8489ad8 100644
--- a/OpenSim/Framework/PrimitiveBaseShape.cs
+++ b/OpenSim/Framework/PrimitiveBaseShape.cs
@@ -213,6 +213,8 @@ namespace OpenSim.Framework
///
public PrimitiveBaseShape(Primitive prim)
{
+// m_log.DebugFormat("[PRIMITIVE BASE SHAPE]: Creating from {0}", prim.ID);
+
PCode = (byte)prim.PrimData.PCode;
ExtraParams = new byte[1];
@@ -613,29 +615,39 @@ namespace OpenSim.Framework
}
}
- public byte SculptType {
- get {
+ public byte SculptType
+ {
+ get
+ {
return _sculptType;
}
- set {
+ set
+ {
_sculptType = value;
}
}
- public byte[] SculptData {
- get {
+ public byte[] SculptData
+ {
+ get
+ {
return _sculptData;
}
- set {
+ set
+ {
+// m_log.DebugFormat("[PRIMITIVE BASE SHAPE]: Setting SculptData to data with length {0}", value.Length);
_sculptData = value;
}
}
- public int FlexiSoftness {
- get {
+ public int FlexiSoftness
+ {
+ get
+ {
return _flexiSoftness;
}
- set {
+ set
+ {
_flexiSoftness = value;
}
}
@@ -849,6 +861,8 @@ namespace OpenSim.Framework
public byte[] ExtraParamsToBytes()
{
+// m_log.DebugFormat("[EXTRAPARAMS]: Called ExtraParamsToBytes()");
+
ushort FlexiEP = 0x10;
ushort LightEP = 0x20;
ushort SculptEP = 0x30;
@@ -864,18 +878,21 @@ namespace OpenSim.Framework
TotalBytesLength += 16;// data
TotalBytesLength += 2 + 4; // type
}
+
if (_lightEntry)
{
ExtraParamsNum++;
TotalBytesLength += 16;// data
TotalBytesLength += 2 + 4; // type
}
+
if (_sculptEntry)
{
ExtraParamsNum++;
TotalBytesLength += 17;// data
TotalBytesLength += 2 + 4; // type
}
+
if (_projectionEntry)
{
ExtraParamsNum++;
@@ -885,7 +902,6 @@ namespace OpenSim.Framework
byte[] returnbytes = new byte[TotalBytesLength];
-
// uint paramlength = ExtraParamsNum;
// Stick in the number of parameters
@@ -905,6 +921,7 @@ namespace OpenSim.Framework
Array.Copy(FlexiData, 0, returnbytes, i, FlexiData.Length);
i += FlexiData.Length;
}
+
if (_lightEntry)
{
byte[] LightData = GetLightBytes();
@@ -919,6 +936,7 @@ namespace OpenSim.Framework
Array.Copy(LightData, 0, returnbytes, i, LightData.Length);
i += LightData.Length;
}
+
if (_sculptEntry)
{
byte[] SculptData = GetSculptBytes();
@@ -933,6 +951,7 @@ namespace OpenSim.Framework
Array.Copy(SculptData, 0, returnbytes, i, SculptData.Length);
i += SculptData.Length;
}
+
if (_projectionEntry)
{
byte[] ProjectionData = GetProjectionBytes();
@@ -946,6 +965,7 @@ namespace OpenSim.Framework
Array.Copy(ProjectionData, 0, returnbytes, i, ProjectionData.Length);
i += ProjectionData.Length;
}
+
if (!_flexiEntry && !_lightEntry && !_sculptEntry && !_projectionEntry)
{
byte[] returnbyte = new byte[1];
@@ -953,10 +973,7 @@ namespace OpenSim.Framework
return returnbyte;
}
-
return returnbytes;
- //m_log.Info("[EXTRAPARAMS]: Length = " + m_shape.ExtraParams.Length.ToString());
-
}
public void ReadInUpdateExtraParam(ushort type, bool inUse, byte[] data)
@@ -1027,7 +1044,6 @@ namespace OpenSim.Framework
extraParamCount = data[i++];
}
-
for (int k = 0; k < extraParamCount; k++)
{
ushort epType = Utils.BytesToUInt16(data, i);
@@ -1071,7 +1087,6 @@ namespace OpenSim.Framework
_sculptEntry = false;
if (!lGotFilter)
_projectionEntry = false;
-
}
public void ReadSculptData(byte[] data, int pos)
@@ -1100,6 +1115,7 @@ namespace OpenSim.Framework
if (_sculptType != (byte)1 && _sculptType != (byte)2 && _sculptType != (byte)3 && _sculptType != (byte)4)
_sculptType = 4;
}
+
_sculptTexture = SculptUUID;
_sculptType = SculptTypel;
//m_log.Info("[SCULPT]:" + SculptUUID.ToString());
--
cgit v1.1
From d79c6c8820e7219afa3f01a0910a794bcdbb307d Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 9 Jul 2011 00:42:48 +0100
Subject: Rename SetSculptData() to SetSculptProperties(), since this is what
it does (setting SculptData is done through the property)
---
OpenSim/Framework/PrimitiveBaseShape.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs
index 8489ad8..d873071 100644
--- a/OpenSim/Framework/PrimitiveBaseShape.cs
+++ b/OpenSim/Framework/PrimitiveBaseShape.cs
@@ -378,7 +378,7 @@ namespace OpenSim.Framework
_pathEnd = Primitive.PackEndCut(end);
}
- public void SetSculptData(byte sculptType, UUID SculptTextureUUID)
+ public void SetSculptProperties(byte sculptType, UUID SculptTextureUUID)
{
_sculptType = sculptType;
_sculptTexture = SculptTextureUUID;
--
cgit v1.1