diff options
Diffstat (limited to 'OpenSim/Region/Physics/Meshing')
-rw-r--r-- | OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 142 |
1 files changed, 71 insertions, 71 deletions
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index df44be3..3e3a0f0 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs | |||
@@ -30,10 +30,10 @@ 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 OpenMetaverse.StructuredData; |
35 | using System.Drawing; | 35 | using System.Drawing; |
36 | using System.Drawing.Imaging; | 36 | using System.Drawing.Imaging; |
37 | using System.IO.Compression; | 37 | using System.IO.Compression; |
38 | using PrimMesher; | 38 | using PrimMesher; |
39 | using log4net; | 39 | using log4net; |
@@ -266,75 +266,75 @@ namespace OpenSim.Region.Physics.Meshing | |||
266 | 266 | ||
267 | if (primShape.SculptEntry) | 267 | if (primShape.SculptEntry) |
268 | { | 268 | { |
269 | if (((OpenMetaverse.SculptType)primShape.SculptType) == SculptType.Mesh) | 269 | if (((OpenMetaverse.SculptType)primShape.SculptType) == SculptType.Mesh) |
270 | { | 270 | { |
271 | // add code for mesh physics proxy generation here | 271 | // add code for mesh physics proxy generation here |
272 | m_log.Debug("[MESH]: mesh proxy generation not implemented yet "); | 272 | m_log.Debug("[MESH]: mesh proxy generation not implemented yet "); |
273 | 273 | ||
274 | OSD meshOsd; | 274 | OSD meshOsd; |
275 | 275 | ||
276 | if (primShape.SculptData.Length > 0) | 276 | if (primShape.SculptData.Length > 0) |
277 | { | 277 | { |
278 | 278 | ||
279 | 279 | ||
280 | m_log.Debug("[MESH]: asset data length: " + primShape.SculptData.Length.ToString()); | 280 | m_log.Debug("[MESH]: asset data length: " + primShape.SculptData.Length.ToString()); |
281 | byte[] header = Util.StringToBytes256("<? LLSD/Binary ?>"); | 281 | byte[] header = Util.StringToBytes256("<? LLSD/Binary ?>"); |
282 | 282 | ||
283 | ////dump to debugging file | 283 | ////dump to debugging file |
284 | //string filename = System.IO.Path.Combine(decodedSculptMapPath, "mesh_" + primShape.SculptTexture.ToString()); | 284 | //string filename = System.IO.Path.Combine(decodedSculptMapPath, "mesh_" + primShape.SculptTexture.ToString()); |
285 | //BinaryWriter writer = new BinaryWriter(File.Open(filename, FileMode.Create)); | 285 | //BinaryWriter writer = new BinaryWriter(File.Open(filename, FileMode.Create)); |
286 | //writer.Write(primShape.SculptData); | 286 | //writer.Write(primShape.SculptData); |
287 | //writer.Close(); | 287 | //writer.Close(); |
288 | 288 | ||
289 | } | 289 | } |
290 | else | 290 | else |
291 | { | 291 | { |
292 | m_log.Error("[MESH]: asset data is zero length"); | 292 | m_log.Error("[MESH]: asset data is zero length"); |
293 | return null; | 293 | return null; |
294 | } | 294 | } |
295 | 295 | ||
296 | try | 296 | try |
297 | { | 297 | { |
298 | meshOsd = OSDParser.DeserializeLLSDBinary(primShape.SculptData, true); | 298 | meshOsd = OSDParser.DeserializeLLSDBinary(primShape.SculptData, true); |
299 | } | 299 | } |
300 | catch (Exception e) | 300 | catch (Exception e) |
301 | { | 301 | { |
302 | m_log.Error("[MESH]: exception decoding mesh asset: " + e.ToString()); | 302 | m_log.Error("[MESH]: exception decoding mesh asset: " + e.ToString()); |
303 | return null; | 303 | return null; |
304 | } | 304 | } |
305 | 305 | ||
306 | if (meshOsd is OSDMap) | 306 | if (meshOsd is OSDMap) |
307 | { | 307 | { |
308 | OSDMap map = (OSDMap)meshOsd; | 308 | OSDMap map = (OSDMap)meshOsd; |
309 | //foreach (string name in map.Keys) | 309 | //foreach (string name in map.Keys) |
310 | // m_log.Debug("[MESH]: key:" + name + " value:" + map[name].AsString()); | 310 | // m_log.Debug("[MESH]: key:" + name + " value:" + map[name].AsString()); |
311 | OSDMap physicsParms = (OSDMap)map["physics_shape"]; | 311 | OSDMap physicsParms = (OSDMap)map["physics_shape"]; |
312 | int physOffset = physicsParms["offset"].AsInteger(); | 312 | int physOffset = physicsParms["offset"].AsInteger(); |
313 | int physSize = physicsParms["size"].AsInteger(); | 313 | int physSize = physicsParms["size"].AsInteger(); |
314 | 314 | ||
315 | if (physOffset < 0 || physSize == 0) | 315 | if (physOffset < 0 || physSize == 0) |
316 | return null; // no mesh data in asset | 316 | return null; // no mesh data in asset |
317 | 317 | ||
318 | m_log.Debug("[MESH]: physOffset:" + physOffset.ToString() + " physSize:" + physSize.ToString()); | 318 | m_log.Debug("[MESH]: physOffset:" + physOffset.ToString() + " physSize:" + physSize.ToString()); |
319 | //MemoryStream ms = new MemoryStream(primShape.SculptData, physOffset, physSize); | 319 | //MemoryStream ms = new MemoryStream(primShape.SculptData, physOffset, physSize); |
320 | //GZipStream gzStream = new GZipStream(ms, CompressionMode.Decompress); | 320 | //GZipStream gzStream = new GZipStream(ms, CompressionMode.Decompress); |
321 | 321 | ||
322 | //int maxSize = physSize * 5; // arbitrary guess | 322 | //int maxSize = physSize * 5; // arbitrary guess |
323 | //byte[] readBuffer = new byte[maxSize]; | 323 | //byte[] readBuffer = new byte[maxSize]; |
324 | 324 | ||
325 | //int bytesRead = gzStream.Read(readBuffer, 0, maxSize); | 325 | //int bytesRead = gzStream.Read(readBuffer, 0, maxSize); |
326 | 326 | ||
327 | //OSD physMeshOsd = OSDParser.DeserializeLLSDBinary(readBuffer); | 327 | //OSD physMeshOsd = OSDParser.DeserializeLLSDBinary(readBuffer); |
328 | 328 | ||
329 | 329 | ||
330 | 330 | ||
331 | 331 | ||
332 | 332 | ||
333 | } | 333 | } |
334 | 334 | ||
335 | //just bail out for now until mesh code is finished | 335 | //just bail out for now until mesh code is finished |
336 | return null; | 336 | return null; |
337 | 337 | ||
338 | } | 338 | } |
339 | else | 339 | else |
340 | { | 340 | { |