diff options
-rw-r--r-- | OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 69 | ||||
-rw-r--r-- | bin/OpenMetaverse.StructuredData.XML | 28 | ||||
-rw-r--r-- | 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; | |||
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
32 | using OpenSim.Region.Physics.Manager; | 32 | using OpenSim.Region.Physics.Manager; |
33 | using OpenMetaverse; | 33 | using OpenMetaverse; |
34 | using OpenMetaverse.StructuredData; | ||
34 | using System.Drawing; | 35 | using System.Drawing; |
35 | using System.Drawing.Imaging; | 36 | using System.Drawing.Imaging; |
37 | using System.IO.Compression; | ||
36 | using PrimMesher; | 38 | using PrimMesher; |
37 | using log4net; | 39 | using log4net; |
38 | using Nini.Config; | 40 | using Nini.Config; |
@@ -268,6 +270,69 @@ namespace OpenSim.Region.Physics.Meshing | |||
268 | { | 270 | { |
269 | // add code for mesh physics proxy generation here | 271 | // add code for mesh physics proxy generation here |
270 | m_log.Debug("[MESH]: mesh proxy generation not implemented yet "); | 272 | m_log.Debug("[MESH]: mesh proxy generation not implemented yet "); |
273 | |||
274 | OSD meshOsd; | ||
275 | |||
276 | if (primShape.SculptData.Length > 0) | ||
277 | { | ||
278 | |||
279 | |||
280 | m_log.Debug("[MESH]: asset data length: " + primShape.SculptData.Length.ToString()); | ||
281 | byte[] header = Util.StringToBytes256("<? LLSD/Binary ?>"); | ||
282 | |||
283 | ////dump to debugging file | ||
284 | //string filename = System.IO.Path.Combine(decodedSculptMapPath, "mesh_" + primShape.SculptTexture.ToString()); | ||
285 | //BinaryWriter writer = new BinaryWriter(File.Open(filename, FileMode.Create)); | ||
286 | //writer.Write(primShape.SculptData); | ||
287 | //writer.Close(); | ||
288 | |||
289 | } | ||
290 | else | ||
291 | { | ||
292 | m_log.Error("[MESH]: asset data is zero length"); | ||
293 | return null; | ||
294 | } | ||
295 | |||
296 | try | ||
297 | { | ||
298 | meshOsd = OSDParser.DeserializeLLSDBinary(primShape.SculptData, true); | ||
299 | } | ||
300 | catch (Exception e) | ||
301 | { | ||
302 | m_log.Error("[MESH]: exception decoding mesh asset: " + e.ToString()); | ||
303 | return null; | ||
304 | } | ||
305 | |||
306 | if (meshOsd is OSDMap) | ||
307 | { | ||
308 | OSDMap map = (OSDMap)meshOsd; | ||
309 | //foreach (string name in map.Keys) | ||
310 | // m_log.Debug("[MESH]: key:" + name + " value:" + map[name].AsString()); | ||
311 | OSDMap physicsParms = (OSDMap)map["physics_shape"]; | ||
312 | int physOffset = physicsParms["offset"].AsInteger(); | ||
313 | int physSize = physicsParms["size"].AsInteger(); | ||
314 | |||
315 | if (physOffset < 0 || physSize == 0) | ||
316 | return null; // no mesh data in asset | ||
317 | |||
318 | m_log.Debug("[MESH]: physOffset:" + physOffset.ToString() + " physSize:" + physSize.ToString()); | ||
319 | //MemoryStream ms = new MemoryStream(primShape.SculptData, physOffset, physSize); | ||
320 | //GZipStream gzStream = new GZipStream(ms, CompressionMode.Decompress); | ||
321 | |||
322 | //int maxSize = physSize * 5; // arbitrary guess | ||
323 | //byte[] readBuffer = new byte[maxSize]; | ||
324 | |||
325 | //int bytesRead = gzStream.Read(readBuffer, 0, maxSize); | ||
326 | |||
327 | //OSD physMeshOsd = OSDParser.DeserializeLLSDBinary(readBuffer); | ||
328 | |||
329 | |||
330 | |||
331 | |||
332 | |||
333 | } | ||
334 | |||
335 | //just bail out for now until mesh code is finished | ||
271 | return null; | 336 | return null; |
272 | 337 | ||
273 | } | 338 | } |
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 @@ | |||
135 | </member> | 135 | </member> |
136 | <member name="M:OpenMetaverse.StructuredData.OSDParser.DeserializeLLSDBinary(System.Byte[])"> | 136 | <member name="M:OpenMetaverse.StructuredData.OSDParser.DeserializeLLSDBinary(System.Byte[])"> |
137 | <summary> | 137 | <summary> |
138 | Deserializes binary LLSD | 138 | |
139 | </summary> | ||
140 | <param name="binaryData">Serialized data</param> | ||
141 | <returns>OSD containting deserialized data</returns> | ||
142 | </member> | ||
143 | <member name="M:OpenMetaverse.StructuredData.OSDParser.DeserializeLLSDBinary(System.Byte[],System.Boolean)"> | ||
144 | <summary> | ||
145 | Deserializes binary LLSD | ||
146 | </summary> | 139 | </summary> |
147 | <param name="binaryData">Serialized data</param> | 140 | <param name="binaryData"></param> |
148 | <param name="headerOptional">Treat LLSD binary header as optional</param> | 141 | <returns></returns> |
149 | <returns>OSD containting deserialized data</returns> | ||
150 | </member> | 142 | </member> |
151 | <member name="M:OpenMetaverse.StructuredData.OSDParser.DeserializeLLSDBinary(System.IO.Stream)"> | 143 | <member name="M:OpenMetaverse.StructuredData.OSDParser.DeserializeLLSDBinary(System.IO.Stream)"> |
152 | <summary> | 144 | <summary> |
153 | Deserializes binary LLSD | 145 | |
154 | </summary> | ||
155 | <param name="stream">Stream to read the data from</param> | ||
156 | <returns>OSD containting deserialized data</returns> | ||
157 | </member> | ||
158 | <member name="M:OpenMetaverse.StructuredData.OSDParser.DeserializeLLSDBinary(System.IO.Stream,System.Boolean)"> | ||
159 | <summary> | ||
160 | Deserializes binary LLSD | ||
161 | </summary> | 146 | </summary> |
162 | <param name="stream">Stream to read the data from</param> | 147 | <param name="stream"></param> |
163 | <param name="headerOptional">Treat LLSD binary header as optional</param> | 148 | <returns></returns> |
164 | <returns>OSD containting deserialized data</returns> | ||
165 | </member> | 149 | </member> |
166 | <member name="M:OpenMetaverse.StructuredData.OSDParser.SerializeLLSDBinary(OpenMetaverse.StructuredData.OSD)"> | 150 | <member name="M:OpenMetaverse.StructuredData.OSDParser.SerializeLLSDBinary(OpenMetaverse.StructuredData.OSD)"> |
167 | <summary> | 151 | <summary> |
diff --git a/prebuild.xml b/prebuild.xml index abe6934..cc0424a 100644 --- a/prebuild.xml +++ b/prebuild.xml | |||
@@ -587,9 +587,11 @@ | |||
587 | <ReferencePath>../../../../bin/</ReferencePath> | 587 | <ReferencePath>../../../../bin/</ReferencePath> |
588 | <Reference name="System"/> | 588 | <Reference name="System"/> |
589 | <Reference name="System.Drawing"/> | 589 | <Reference name="System.Drawing"/> |
590 | <Reference name="System.IO.Compression;"/> | ||
590 | <Reference name="CSJ2K" path="../../../../bin/"/> | 591 | <Reference name="CSJ2K" path="../../../../bin/"/> |
591 | <Reference name="OpenMetaverseTypes" path="../../../../bin/"/> | 592 | <Reference name="OpenMetaverseTypes" path="../../../../bin/"/> |
592 | <Reference name="OpenMetaverse" path="../../../../bin/"/> | 593 | <Reference name="OpenMetaverse" path="../../../../bin/"/> |
594 | <Reference name="OpenMetaverse.StructuredData" path="../../../../bin/"/> | ||
593 | <Reference name="Nini" path="../../../../bin/"/> | 595 | <Reference name="Nini" path="../../../../bin/"/> |
594 | <Reference name="OpenSim.Framework"/> | 596 | <Reference name="OpenSim.Framework"/> |
595 | <Reference name="OpenSim.Framework.Console"/> | 597 | <Reference name="OpenSim.Framework.Console"/> |