From bcdd03c1cfcfab72d6ee4199bd1232ff3a748d6e Mon Sep 17 00:00:00 2001
From: dahlia
Date: Thu, 14 Oct 2010 20:25:31 -0700
Subject: more work in progress on mesh physics - still non-functional
---
OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 69 ++++++++++++++++++++++++++-
bin/OpenMetaverse.StructuredData.XML | 28 +++--------
prebuild.xml | 2 +
3 files changed, 75 insertions(+), 24 deletions(-)
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
index e1203ea..df44be3 100644
--- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
@@ -30,9 +30,11 @@ using System;
using System.Collections.Generic;
using OpenSim.Framework;
using OpenSim.Region.Physics.Manager;
-using OpenMetaverse;
+using OpenMetaverse;
+using OpenMetaverse.StructuredData;
using System.Drawing;
-using System.Drawing.Imaging;
+using System.Drawing.Imaging;
+using System.IO.Compression;
using PrimMesher;
using log4net;
using Nini.Config;
@@ -268,6 +270,69 @@ namespace OpenSim.Region.Physics.Meshing
{
// add code for mesh physics proxy generation here
m_log.Debug("[MESH]: mesh proxy generation not implemented yet ");
+
+ OSD meshOsd;
+
+ 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");
+ return null;
+ }
+
+ try
+ {
+ meshOsd = OSDParser.DeserializeLLSDBinary(primShape.SculptData, true);
+ }
+ catch (Exception e)
+ {
+ m_log.Error("[MESH]: exception decoding mesh asset: " + e.ToString());
+ return null;
+ }
+
+ if (meshOsd is OSDMap)
+ {
+ 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"];
+ int physOffset = physicsParms["offset"].AsInteger();
+ int physSize = physicsParms["size"].AsInteger();
+
+ if (physOffset < 0 || physSize == 0)
+ return null; // no mesh data in asset
+
+ m_log.Debug("[MESH]: physOffset:" + physOffset.ToString() + " physSize:" + physSize.ToString());
+ //MemoryStream ms = new MemoryStream(primShape.SculptData, physOffset, physSize);
+ //GZipStream gzStream = new GZipStream(ms, CompressionMode.Decompress);
+
+ //int maxSize = physSize * 5; // arbitrary guess
+ //byte[] readBuffer = new byte[maxSize];
+
+ //int bytesRead = gzStream.Read(readBuffer, 0, maxSize);
+
+ //OSD physMeshOsd = OSDParser.DeserializeLLSDBinary(readBuffer);
+
+
+
+
+
+ }
+
+ //just bail out for now until mesh code is finished
return null;
}
diff --git a/bin/OpenMetaverse.StructuredData.XML b/bin/OpenMetaverse.StructuredData.XML
index 35f2864..2a0426c 100644
--- a/bin/OpenMetaverse.StructuredData.XML
+++ b/bin/OpenMetaverse.StructuredData.XML
@@ -135,33 +135,17 @@
- Deserializes binary LLSD
-
- Serialized data
- OSD containting deserialized data
-
-
-
- Deserializes binary LLSD
+
- Serialized data
- Treat LLSD binary header as optional
- OSD containting deserialized data
+
+
- Deserializes binary LLSD
-
- Stream to read the data from
- OSD containting deserialized data
-
-
-
- Deserializes binary LLSD
+
- Stream to read the data from
- Treat LLSD binary header as optional
- OSD containting deserialized data
+
+
diff --git a/prebuild.xml b/prebuild.xml
index abe6934..cc0424a 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -587,9 +587,11 @@
../../../../bin/
+
+
--
cgit v1.1