Merge branch 'master' of /var/git/opensim/

viewer-2-initial-appearance
opensim mirror account 2010-10-14 20:30:04 -07:00
commit 19fdfc1a97
3 changed files with 75 additions and 24 deletions

View File

@ -31,8 +31,10 @@ using System.Collections.Generic;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Physics.Manager; using OpenSim.Region.Physics.Manager;
using OpenMetaverse; using OpenMetaverse;
using OpenMetaverse.StructuredData;
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.IO.Compression;
using PrimMesher; using PrimMesher;
using log4net; using log4net;
using Nini.Config; using Nini.Config;
@ -268,6 +270,69 @@ namespace OpenSim.Region.Physics.Meshing
{ {
// add code for mesh physics proxy generation here // add code for mesh physics proxy generation here
m_log.Debug("[MESH]: mesh proxy generation not implemented yet "); m_log.Debug("[MESH]: mesh proxy generation not implemented yet ");
OSD meshOsd;
if (primShape.SculptData.Length > 0)
{
m_log.Debug("[MESH]: asset data length: " + primShape.SculptData.Length.ToString());
byte[] header = Util.StringToBytes256("<? LLSD/Binary ?>");
////dump to debugging file
//string filename = System.IO.Path.Combine(decodedSculptMapPath, "mesh_" + primShape.SculptTexture.ToString());
//BinaryWriter writer = new BinaryWriter(File.Open(filename, FileMode.Create));
//writer.Write(primShape.SculptData);
//writer.Close();
}
else
{
m_log.Error("[MESH]: asset data is zero length");
return null;
}
try
{
meshOsd = OSDParser.DeserializeLLSDBinary(primShape.SculptData, true);
}
catch (Exception e)
{
m_log.Error("[MESH]: exception decoding mesh asset: " + e.ToString());
return null;
}
if (meshOsd is OSDMap)
{
OSDMap map = (OSDMap)meshOsd;
//foreach (string name in map.Keys)
// m_log.Debug("[MESH]: key:" + name + " value:" + map[name].AsString());
OSDMap physicsParms = (OSDMap)map["physics_shape"];
int physOffset = physicsParms["offset"].AsInteger();
int physSize = physicsParms["size"].AsInteger();
if (physOffset < 0 || physSize == 0)
return null; // no mesh data in asset
m_log.Debug("[MESH]: physOffset:" + physOffset.ToString() + " physSize:" + physSize.ToString());
//MemoryStream ms = new MemoryStream(primShape.SculptData, physOffset, physSize);
//GZipStream gzStream = new GZipStream(ms, CompressionMode.Decompress);
//int maxSize = physSize * 5; // arbitrary guess
//byte[] readBuffer = new byte[maxSize];
//int bytesRead = gzStream.Read(readBuffer, 0, maxSize);
//OSD physMeshOsd = OSDParser.DeserializeLLSDBinary(readBuffer);
}
//just bail out for now until mesh code is finished
return null; return null;
} }

View File

@ -135,33 +135,17 @@
</member> </member>
<member name="M:OpenMetaverse.StructuredData.OSDParser.DeserializeLLSDBinary(System.Byte[])"> <member name="M:OpenMetaverse.StructuredData.OSDParser.DeserializeLLSDBinary(System.Byte[])">
<summary> <summary>
Deserializes binary LLSD
</summary> </summary>
<param name="binaryData">Serialized data</param> <param name="binaryData"></param>
<returns>OSD containting deserialized data</returns> <returns></returns>
</member>
<member name="M:OpenMetaverse.StructuredData.OSDParser.DeserializeLLSDBinary(System.Byte[],System.Boolean)">
<summary>
Deserializes binary LLSD
</summary>
<param name="binaryData">Serialized data</param>
<param name="headerOptional">Treat LLSD binary header as optional</param>
<returns>OSD containting deserialized data</returns>
</member> </member>
<member name="M:OpenMetaverse.StructuredData.OSDParser.DeserializeLLSDBinary(System.IO.Stream)"> <member name="M:OpenMetaverse.StructuredData.OSDParser.DeserializeLLSDBinary(System.IO.Stream)">
<summary> <summary>
Deserializes binary LLSD
</summary> </summary>
<param name="stream">Stream to read the data from</param> <param name="stream"></param>
<returns>OSD containting deserialized data</returns> <returns></returns>
</member>
<member name="M:OpenMetaverse.StructuredData.OSDParser.DeserializeLLSDBinary(System.IO.Stream,System.Boolean)">
<summary>
Deserializes binary LLSD
</summary>
<param name="stream">Stream to read the data from</param>
<param name="headerOptional">Treat LLSD binary header as optional</param>
<returns>OSD containting deserialized data</returns>
</member> </member>
<member name="M:OpenMetaverse.StructuredData.OSDParser.SerializeLLSDBinary(OpenMetaverse.StructuredData.OSD)"> <member name="M:OpenMetaverse.StructuredData.OSDParser.SerializeLLSDBinary(OpenMetaverse.StructuredData.OSD)">
<summary> <summary>

View File

@ -587,9 +587,11 @@
<ReferencePath>../../../../bin/</ReferencePath> <ReferencePath>../../../../bin/</ReferencePath>
<Reference name="System"/> <Reference name="System"/>
<Reference name="System.Drawing"/> <Reference name="System.Drawing"/>
<Reference name="System.IO.Compression;"/>
<Reference name="CSJ2K" path="../../../../bin/"/> <Reference name="CSJ2K" path="../../../../bin/"/>
<Reference name="OpenMetaverseTypes" path="../../../../bin/"/> <Reference name="OpenMetaverseTypes" path="../../../../bin/"/>
<Reference name="OpenMetaverse" path="../../../../bin/"/> <Reference name="OpenMetaverse" path="../../../../bin/"/>
<Reference name="OpenMetaverse.StructuredData" path="../../../../bin/"/>
<Reference name="Nini" path="../../../../bin/"/> <Reference name="Nini" path="../../../../bin/"/>
<Reference name="OpenSim.Framework"/> <Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Console"/> <Reference name="OpenSim.Framework.Console"/>