aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
diff options
context:
space:
mode:
authorKittoFlora2009-10-27 22:42:55 +0100
committerKittoFlora2009-10-27 22:42:55 +0100
commit1113b3b6ebba3e358326a7be90b338d8c95af688 (patch)
treed923340600e5a2699ceaceeb52fd6c45994f334a /OpenSim/Region/Physics/Meshing/Meshmerizer.cs
parentllRotLookAt Pt 2 (diff)
parentMerge branch 'master' into vehicles (diff)
downloadopensim-SC_OLD-1113b3b6ebba3e358326a7be90b338d8c95af688.zip
opensim-SC_OLD-1113b3b6ebba3e358326a7be90b338d8c95af688.tar.gz
opensim-SC_OLD-1113b3b6ebba3e358326a7be90b338d8c95af688.tar.bz2
opensim-SC_OLD-1113b3b6ebba3e358326a7be90b338d8c95af688.tar.xz
Merge branch 'vehicles' into tests
Conflicts: OpenSim/Region/Physics/Manager/PhysicsActor.cs OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
Diffstat (limited to 'OpenSim/Region/Physics/Meshing/Meshmerizer.cs')
-rw-r--r--OpenSim/Region/Physics/Meshing/Meshmerizer.cs27
1 files changed, 10 insertions, 17 deletions
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
index f609e73..fbe1949 100644
--- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
@@ -31,7 +31,6 @@ using System.Collections.Generic;
31using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Region.Physics.Manager; 32using OpenSim.Region.Physics.Manager;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenMetaverse.Imaging;
35using System.Drawing; 34using System.Drawing;
36using System.Drawing.Imaging; 35using System.Drawing.Imaging;
37using PrimMesher; 36using PrimMesher;
@@ -61,7 +60,6 @@ namespace OpenSim.Region.Physics.Meshing
61 public class Meshmerizer : IMesher 60 public class Meshmerizer : IMesher
62 { 61 {
63 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 62 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
64 //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
65 63
66 // Setting baseDir to a path will enable the dumping of raw files 64 // Setting baseDir to a path will enable the dumping of raw files
67 // raw files can be imported by blender so a visual inspection of the results can be done 65 // raw files can be imported by blender so a visual inspection of the results can be done
@@ -160,7 +158,7 @@ namespace OpenSim.Region.Physics.Meshing
160 float minZ = float.MaxValue; 158 float minZ = float.MaxValue;
161 float maxZ = float.MinValue; 159 float maxZ = float.MinValue;
162 160
163 foreach (Vertex v in meshIn.getVertexList()) 161 foreach (Vector3 v in meshIn.getVertexList())
164 { 162 {
165 if (v != null) 163 if (v != null)
166 { 164 {
@@ -185,7 +183,7 @@ namespace OpenSim.Region.Physics.Meshing
185 183
186 } 184 }
187 185
188 private ulong GetMeshKey(PrimitiveBaseShape pbs, PhysicsVector size, float lod) 186 private ulong GetMeshKey(PrimitiveBaseShape pbs, Vector3 size, float lod)
189 { 187 {
190 ulong hash = 5381; 188 ulong hash = 5381;
191 189
@@ -245,9 +243,9 @@ namespace OpenSim.Region.Physics.Meshing
245 hash = ((hash << 5) + hash) + (ulong)((byte)c); 243 hash = ((hash << 5) + hash) + (ulong)((byte)c);
246 return ((hash << 5) + hash) + (ulong)(c >> 8); 244 return ((hash << 5) + hash) + (ulong)(c >> 8);
247 } 245 }
248
249 246
250 private Mesh CreateMeshFromPrimMesher(string primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod) 247
248 private Mesh CreateMeshFromPrimMesher(string primName, PrimitiveBaseShape primShape, Vector3 size, float lod)
251 { 249 {
252 PrimMesh primMesh; 250 PrimMesh primMesh;
253 PrimMesher.SculptMesh sculptMesh; 251 PrimMesher.SculptMesh sculptMesh;
@@ -281,16 +279,12 @@ namespace OpenSim.Region.Physics.Meshing
281 279
282 if (idata == null) 280 if (idata == null)
283 { 281 {
284 if (primShape.SculptData.Length == 0) 282 if (primShape.SculptData == null || primShape.SculptData.Length == 0)
285 return null; 283 return null;
286 284
287 try 285 try
288 { 286 {
289 ManagedImage managedImage; // we never use this 287 idata = CSJ2K.J2kImage.FromBytes(primShape.SculptData);
290 OpenJPEG.DecodeToImage(primShape.SculptData, out managedImage, out idata);
291
292 // Remove the reference to the encoded JPEG2000 data so it can be GCed
293 primShape.SculptData = Utils.EmptyBytes;
294 288
295 if (cacheSculptMaps) 289 if (cacheSculptMaps)
296 { 290 {
@@ -315,8 +309,6 @@ namespace OpenSim.Region.Physics.Meshing
315 } 309 }
316 } 310 }
317 311
318
319
320 PrimMesher.SculptMesh.SculptType sculptType; 312 PrimMesher.SculptMesh.SculptType sculptType;
321 switch ((OpenMetaverse.SculptType)primShape.SculptType) 313 switch ((OpenMetaverse.SculptType)primShape.SculptType)
322 { 314 {
@@ -351,7 +343,6 @@ namespace OpenSim.Region.Physics.Meshing
351 coords = sculptMesh.coords; 343 coords = sculptMesh.coords;
352 faces = sculptMesh.faces; 344 faces = sculptMesh.faces;
353 } 345 }
354
355 else 346 else
356 { 347 {
357 float pathShearX = primShape.PathShearX < 128 ? (float)primShape.PathShearX * 0.01f : (float)(primShape.PathShearX - 256) * 0.01f; 348 float pathShearX = primShape.PathShearX < 128 ? (float)primShape.PathShearX * 0.01f : (float)(primShape.PathShearX - 256) * 0.01f;
@@ -466,6 +457,8 @@ namespace OpenSim.Region.Physics.Meshing
466 faces = primMesh.faces; 457 faces = primMesh.faces;
467 } 458 }
468 459
460 // Remove the reference to any JPEG2000 sculpt data so it can be GCed
461 primShape.SculptData = Utils.EmptyBytes;
469 462
470 int numCoords = coords.Count; 463 int numCoords = coords.Count;
471 int numFaces = faces.Count; 464 int numFaces = faces.Count;
@@ -488,12 +481,12 @@ namespace OpenSim.Region.Physics.Meshing
488 return mesh; 481 return mesh;
489 } 482 }
490 483
491 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod) 484 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod)
492 { 485 {
493 return CreateMesh(primName, primShape, size, lod, false); 486 return CreateMesh(primName, primShape, size, lod, false);
494 } 487 }
495 488
496 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod, bool isPhysical) 489 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical)
497 { 490 {
498 Mesh mesh = null; 491 Mesh mesh = null;
499 ulong key = 0; 492 ulong key = 0;