From 4f593fa8c3733cfccc69782bfa3fbd91543a146b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 21 Mar 2012 21:17:00 +0000 Subject: minor clean --- OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs | 51 +++++++++++------------ 1 file changed, 24 insertions(+), 27 deletions(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs b/OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs index df08381..8e903e8 100644 --- a/OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs @@ -218,9 +218,20 @@ namespace OpenSim.Region.Physics.Meshing // geometry for this submesh. if (subMeshData.ContainsKey("NoGeometry") && ((OSDBoolean)subMeshData["NoGeometry"])) return; - - OpenMetaverse.Vector3 posMax = ((OSDMap)subMeshData["PositionDomain"])["Max"].AsVector3(); - OpenMetaverse.Vector3 posMin = ((OSDMap)subMeshData["PositionDomain"])["Min"].AsVector3(); + + OpenMetaverse.Vector3 posMax; + OpenMetaverse.Vector3 posMin; + if (subMeshData.ContainsKey("PositionDomain")) + { + posMax = ((OSDMap)subMeshData["PositionDomain"])["Max"].AsVector3(); + posMin = ((OSDMap)subMeshData["PositionDomain"])["Min"].AsVector3(); + } + else + { + posMax = new Vector3(0.5f, 0.5f, 0.5f); + posMin = new Vector3(-0.5f, -0.5f, -0.5f); + } + ushort faceIndexOffset = (ushort)coords.Count; byte[] posBytes = subMeshData["Position"].AsBinary(); @@ -280,18 +291,14 @@ namespace OpenSim.Region.Physics.Meshing { if (!GenerateCoordsAndFacesFromPrimSculptData(primName, primShape, size, lod, out coords, out faces)) return null; - // Remove the reference to any JPEG2000 sculpt data so it can be GCed - // don't loose it - // primShape.SculptData = Utils.EmptyBytes; } -// primShape.SculptDataLoaded = true; } else { if (!GenerateCoordsAndFacesFromPrimShapeData(primName, primShape, size, lod, out coords, out faces)) return null; } - // keep compatible + primShape.SculptData = Utils.EmptyBytes; int numCoords = coords.Count; @@ -307,10 +314,6 @@ namespace OpenSim.Region.Physics.Meshing coords[f.v3].X, coords[f.v3].Y, coords[f.v3].Z)); } - -// mesh.DumpRaw("c:\\lixo", "lixo", "lixo"); - mesh.DumpRaw(".", "lixo", "lixo"); - return mesh; } @@ -452,22 +455,20 @@ namespace OpenSim.Region.Physics.Meshing return false; byte[] data; - const float invMaxU16 = 1.0f / 65535f; - int t1; - int t2; - int t3; - int i; List vs = new List(); - - float3 f3; PHullResult hullr = new PHullResult(); - + float3 f3; Coord c; Face f; - Vector3 range; Vector3 min; + + const float invMaxU16 = 1.0f / 65535f; + int t1; + int t2; + int t3; + int i; int nverts; int nindexs; @@ -576,8 +577,7 @@ namespace OpenSim.Region.Physics.Meshing c.Z = hullr.Vertices[i].z; coords.Add(c); } - - + for (i = 0; i < nindexs; i += 3) { t1 = hullr.Indices[i]; @@ -597,8 +597,7 @@ namespace OpenSim.Region.Physics.Meshing } } if (coords.Count > 0 && faces.Count > 0) - return true; - + return true; } vs.Clear(); @@ -642,7 +641,6 @@ namespace OpenSim.Region.Physics.Meshing if (vs.Count == 4) { - // not sure about orientation.. f = new Face(0, 2, 3); faces.Add(f); f = new Face(0, 3, 1); @@ -690,7 +688,6 @@ namespace OpenSim.Region.Physics.Meshing } else return false; - } } -- cgit v1.1