use System.IO.Compression.DeflateStream for mesh decompression like master, since ACE zlib does seem to fail to decompress some meshs present at OSG, (possible same issue happens with map with option to draw prims)

avinationmerge
UbitUmarov 2015-10-11 23:04:22 +01:00
parent 88763178c5
commit af5ea18f33
2 changed files with 9 additions and 10 deletions

View File

@ -43,7 +43,6 @@ using log4net;
using Nini.Config; using Nini.Config;
using System.Reflection; using System.Reflection;
using System.IO; using System.IO;
using ComponentAce.Compression.Libs.zlib;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Serialization.Formatters.Binary;
@ -449,22 +448,23 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
{ {
using (MemoryStream outMs = new MemoryStream()) using (MemoryStream outMs = new MemoryStream())
{ {
using (ZOutputStream zOut = new ZOutputStream(outMs)) using (DeflateStream decompressionStream = new DeflateStream(inMs, CompressionMode.Decompress))
{ {
byte[] readBuffer = new byte[2048]; byte[] readBuffer = new byte[2048];
inMs.Read(readBuffer, 0, 2); // skip first 2 bytes in header
int readLen = 0; int readLen = 0;
while ((readLen = inMs.Read(readBuffer, 0, readBuffer.Length)) > 0)
{ while ((readLen = decompressionStream.Read(readBuffer, 0, readBuffer.Length)) > 0)
zOut.Write(readBuffer, 0, readLen); outMs.Write(readBuffer, 0, readLen);
}
zOut.Flush(); outMs.Flush();
outMs.Seek(0, SeekOrigin.Begin); outMs.Seek(0, SeekOrigin.Begin);
byte[] decompressedBuf = outMs.GetBuffer(); byte[] decompressedBuf = outMs.GetBuffer();
decodedMeshOsd = OSDParser.DeserializeLLSDBinary(decompressedBuf); decodedMeshOsd = OSDParser.DeserializeLLSDBinary(decompressedBuf);
} }
} }
} }
} }
catch (Exception e) catch (Exception e)

View File

@ -1725,7 +1725,6 @@
<Reference name="OpenSim.Region.PhysicsModules.SharedBase"/> <Reference name="OpenSim.Region.PhysicsModules.SharedBase"/>
<Reference name="OpenSim.Region.Framework"/> <Reference name="OpenSim.Region.Framework"/>
<Reference name="OpenSim.Region.PhysicsModules.ConvexDecompositionDotNet"/> <Reference name="OpenSim.Region.PhysicsModules.ConvexDecompositionDotNet"/>
<Reference name="zlib.net" path="../../../../bin/"/>
<Reference name="Mono.Addins" path="../../../../bin/"/> <Reference name="Mono.Addins" path="../../../../bin/"/>
<Reference name="log4net" path="../../../../bin/"/> <Reference name="log4net" path="../../../../bin/"/>