diff options
author | UbitUmarov | 2019-04-02 10:13:26 +0100 |
---|---|---|
committer | UbitUmarov | 2019-04-02 10:13:26 +0100 |
commit | ba66d2d3c125136171dc9fec34bb9d424a6a731d (patch) | |
tree | d5cd06c550f27d73af5cff6cd50036ea7e27ed39 /OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs | |
parent | mantis 8509: replace mesh gzip decompress (diff) | |
download | opensim-SC-ba66d2d3c125136171dc9fec34bb9d424a6a731d.zip opensim-SC-ba66d2d3c125136171dc9fec34bb9d424a6a731d.tar.gz opensim-SC-ba66d2d3c125136171dc9fec34bb9d424a6a731d.tar.bz2 opensim-SC-ba66d2d3c125136171dc9fec34bb9d424a6a731d.tar.xz |
minor cleanup on mesh decompress code
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs index 6950f2d..8449596 100644 --- a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs +++ b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs | |||
@@ -425,31 +425,24 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
425 | return false; // no mesh data in asset | 425 | return false; // no mesh data in asset |
426 | 426 | ||
427 | OSD decodedMeshOsd = new OSD(); | 427 | OSD decodedMeshOsd = new OSD(); |
428 | byte[] meshBytes = new byte[physSize]; | ||
429 | System.Buffer.BlockCopy(primShape.SculptData, physOffset, meshBytes, 0, physSize); | ||
430 | |||
431 | try | 428 | try |
432 | { | 429 | { |
433 | using (MemoryStream inMs = new MemoryStream(meshBytes)) | 430 | using (MemoryStream outMs = new MemoryStream(4 * physSize)) |
434 | { | 431 | { |
435 | using (MemoryStream outMs = new MemoryStream()) | 432 | using (MemoryStream inMs = new MemoryStream(primShape.SculptData, physOffset, physSize)) |
436 | { | 433 | { |
437 | using (DeflateStream decompressionStream = new DeflateStream(inMs, CompressionMode.Decompress)) | 434 | using (DeflateStream decompressionStream = new DeflateStream(inMs, CompressionMode.Decompress)) |
438 | { | 435 | { |
439 | byte[] readBuffer = new byte[2048]; | 436 | byte[] readBuffer = new byte[8192]; |
440 | inMs.Read(readBuffer, 0, 2); // skip first 2 bytes in header | 437 | inMs.Read(readBuffer, 0, 2); // skip first 2 bytes in header |
441 | int readLen = 0; | 438 | int readLen = 0; |
442 | 439 | ||
443 | while ((readLen = decompressionStream.Read(readBuffer, 0, readBuffer.Length)) > 0) | 440 | while ((readLen = decompressionStream.Read(readBuffer, 0, readBuffer.Length)) > 0) |
444 | outMs.Write(readBuffer, 0, readLen); | 441 | outMs.Write(readBuffer, 0, readLen); |
445 | |||
446 | outMs.Seek(0, SeekOrigin.Begin); | ||
447 | |||
448 | byte[] decompressedBuf = outMs.GetBuffer(); | ||
449 | |||
450 | decodedMeshOsd = OSDParser.DeserializeLLSDBinary(decompressedBuf); | ||
451 | } | 442 | } |
452 | } | 443 | } |
444 | outMs.Seek(0, SeekOrigin.Begin); | ||
445 | decodedMeshOsd = OSDParser.DeserializeLLSDBinary(outMs); | ||
453 | } | 446 | } |
454 | } | 447 | } |
455 | catch (Exception e) | 448 | catch (Exception e) |