aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/Meshing
diff options
context:
space:
mode:
authordahlia2010-10-14 20:25:31 -0700
committerdahlia2010-10-14 20:25:31 -0700
commitbcdd03c1cfcfab72d6ee4199bd1232ff3a748d6e (patch)
tree69490e4ac18a743b862ea6d031a1c8fd9a66ae1d /OpenSim/Region/Physics/Meshing
parentlibomv update to support headerless llsd binary deserialization needed for me... (diff)
downloadopensim-SC_OLD-bcdd03c1cfcfab72d6ee4199bd1232ff3a748d6e.zip
opensim-SC_OLD-bcdd03c1cfcfab72d6ee4199bd1232ff3a748d6e.tar.gz
opensim-SC_OLD-bcdd03c1cfcfab72d6ee4199bd1232ff3a748d6e.tar.bz2
opensim-SC_OLD-bcdd03c1cfcfab72d6ee4199bd1232ff3a748d6e.tar.xz
more work in progress on mesh physics - still non-functional
Diffstat (limited to 'OpenSim/Region/Physics/Meshing')
-rw-r--r--OpenSim/Region/Physics/Meshing/Meshmerizer.cs69
1 files changed, 67 insertions, 2 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;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Region.Physics.Manager; 32using OpenSim.Region.Physics.Manager;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenMetaverse.StructuredData;
34using System.Drawing; 35using System.Drawing;
35using System.Drawing.Imaging; 36using System.Drawing.Imaging;
37using System.IO.Compression;
36using PrimMesher; 38using PrimMesher;
37using log4net; 39using log4net;
38using Nini.Config; 40using 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 }