aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs51
1 files changed, 24 insertions, 27 deletions
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
218 // geometry for this submesh. 218 // geometry for this submesh.
219 if (subMeshData.ContainsKey("NoGeometry") && ((OSDBoolean)subMeshData["NoGeometry"])) 219 if (subMeshData.ContainsKey("NoGeometry") && ((OSDBoolean)subMeshData["NoGeometry"]))
220 return; 220 return;
221 221
222 OpenMetaverse.Vector3 posMax = ((OSDMap)subMeshData["PositionDomain"])["Max"].AsVector3(); 222 OpenMetaverse.Vector3 posMax;
223 OpenMetaverse.Vector3 posMin = ((OSDMap)subMeshData["PositionDomain"])["Min"].AsVector3(); 223 OpenMetaverse.Vector3 posMin;
224 if (subMeshData.ContainsKey("PositionDomain"))
225 {
226 posMax = ((OSDMap)subMeshData["PositionDomain"])["Max"].AsVector3();
227 posMin = ((OSDMap)subMeshData["PositionDomain"])["Min"].AsVector3();
228 }
229 else
230 {
231 posMax = new Vector3(0.5f, 0.5f, 0.5f);
232 posMin = new Vector3(-0.5f, -0.5f, -0.5f);
233 }
234
224 ushort faceIndexOffset = (ushort)coords.Count; 235 ushort faceIndexOffset = (ushort)coords.Count;
225 236
226 byte[] posBytes = subMeshData["Position"].AsBinary(); 237 byte[] posBytes = subMeshData["Position"].AsBinary();
@@ -280,18 +291,14 @@ namespace OpenSim.Region.Physics.Meshing
280 { 291 {
281 if (!GenerateCoordsAndFacesFromPrimSculptData(primName, primShape, size, lod, out coords, out faces)) 292 if (!GenerateCoordsAndFacesFromPrimSculptData(primName, primShape, size, lod, out coords, out faces))
282 return null; 293 return null;
283 // Remove the reference to any JPEG2000 sculpt data so it can be GCed
284 // don't loose it
285 // primShape.SculptData = Utils.EmptyBytes;
286 } 294 }
287// primShape.SculptDataLoaded = true;
288 } 295 }
289 else 296 else
290 { 297 {
291 if (!GenerateCoordsAndFacesFromPrimShapeData(primName, primShape, size, lod, out coords, out faces)) 298 if (!GenerateCoordsAndFacesFromPrimShapeData(primName, primShape, size, lod, out coords, out faces))
292 return null; 299 return null;
293 } 300 }
294 // keep compatible 301
295 primShape.SculptData = Utils.EmptyBytes; 302 primShape.SculptData = Utils.EmptyBytes;
296 303
297 int numCoords = coords.Count; 304 int numCoords = coords.Count;
@@ -307,10 +314,6 @@ namespace OpenSim.Region.Physics.Meshing
307 coords[f.v3].X, coords[f.v3].Y, coords[f.v3].Z)); 314 coords[f.v3].X, coords[f.v3].Y, coords[f.v3].Z));
308 } 315 }
309 316
310
311// mesh.DumpRaw("c:\\lixo", "lixo", "lixo");
312 mesh.DumpRaw(".", "lixo", "lixo");
313
314 return mesh; 317 return mesh;
315 } 318 }
316 319
@@ -452,22 +455,20 @@ namespace OpenSim.Region.Physics.Meshing
452 return false; 455 return false;
453 456
454 byte[] data; 457 byte[] data;
455 const float invMaxU16 = 1.0f / 65535f;
456 int t1;
457 int t2;
458 int t3;
459 int i;
460 458
461 List<float3> vs = new List<float3>(); 459 List<float3> vs = new List<float3>();
462
463 float3 f3;
464 PHullResult hullr = new PHullResult(); 460 PHullResult hullr = new PHullResult();
465 461 float3 f3;
466 Coord c; 462 Coord c;
467 Face f; 463 Face f;
468
469 Vector3 range; 464 Vector3 range;
470 Vector3 min; 465 Vector3 min;
466
467 const float invMaxU16 = 1.0f / 65535f;
468 int t1;
469 int t2;
470 int t3;
471 int i;
471 int nverts; 472 int nverts;
472 int nindexs; 473 int nindexs;
473 474
@@ -576,8 +577,7 @@ namespace OpenSim.Region.Physics.Meshing
576 c.Z = hullr.Vertices[i].z; 577 c.Z = hullr.Vertices[i].z;
577 coords.Add(c); 578 coords.Add(c);
578 } 579 }
579 580
580
581 for (i = 0; i < nindexs; i += 3) 581 for (i = 0; i < nindexs; i += 3)
582 { 582 {
583 t1 = hullr.Indices[i]; 583 t1 = hullr.Indices[i];
@@ -597,8 +597,7 @@ namespace OpenSim.Region.Physics.Meshing
597 } 597 }
598 } 598 }
599 if (coords.Count > 0 && faces.Count > 0) 599 if (coords.Count > 0 && faces.Count > 0)
600 return true; 600 return true;
601
602 } 601 }
603 602
604 vs.Clear(); 603 vs.Clear();
@@ -642,7 +641,6 @@ namespace OpenSim.Region.Physics.Meshing
642 641
643 if (vs.Count == 4) 642 if (vs.Count == 4)
644 { 643 {
645 // not sure about orientation..
646 f = new Face(0, 2, 3); 644 f = new Face(0, 2, 3);
647 faces.Add(f); 645 faces.Add(f);
648 f = new Face(0, 3, 1); 646 f = new Face(0, 3, 1);
@@ -690,7 +688,6 @@ namespace OpenSim.Region.Physics.Meshing
690 } 688 }
691 else 689 else
692 return false; 690 return false;
693
694 } 691 }
695 } 692 }
696 693