diff options
Diffstat (limited to 'OpenSim/Region/Physics/Meshing/Meshmerizer.cs')
-rw-r--r-- | OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index 3bd15ce..3c4f737 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs | |||
@@ -74,6 +74,8 @@ namespace OpenSim.Region.Physics.Meshing | |||
74 | #endif | 74 | #endif |
75 | 75 | ||
76 | private bool cacheSculptMaps = true; | 76 | private bool cacheSculptMaps = true; |
77 | private bool cacheSculptAlphaMaps = true; | ||
78 | |||
77 | private string decodedSculptMapPath = null; | 79 | private string decodedSculptMapPath = null; |
78 | private bool useMeshiesPhysicsMesh = false; | 80 | private bool useMeshiesPhysicsMesh = false; |
79 | 81 | ||
@@ -87,7 +89,16 @@ namespace OpenSim.Region.Physics.Meshing | |||
87 | IConfig mesh_config = config.Configs["Mesh"]; | 89 | IConfig mesh_config = config.Configs["Mesh"]; |
88 | 90 | ||
89 | decodedSculptMapPath = start_config.GetString("DecodedSculptMapPath","j2kDecodeCache"); | 91 | decodedSculptMapPath = start_config.GetString("DecodedSculptMapPath","j2kDecodeCache"); |
92 | |||
90 | cacheSculptMaps = start_config.GetBoolean("CacheSculptMaps", cacheSculptMaps); | 93 | cacheSculptMaps = start_config.GetBoolean("CacheSculptMaps", cacheSculptMaps); |
94 | |||
95 | if (Environment.OSVersion.Platform == PlatformID.Unix) | ||
96 | { | ||
97 | cacheSculptAlphaMaps = false; | ||
98 | } | ||
99 | else | ||
100 | cacheSculptAlphaMaps = cacheSculptMaps; | ||
101 | |||
91 | if(mesh_config != null) | 102 | if(mesh_config != null) |
92 | useMeshiesPhysicsMesh = mesh_config.GetBoolean("UseMeshiesPhysicsMesh", useMeshiesPhysicsMesh); | 103 | useMeshiesPhysicsMesh = mesh_config.GetBoolean("UseMeshiesPhysicsMesh", useMeshiesPhysicsMesh); |
93 | 104 | ||
@@ -268,15 +279,18 @@ namespace OpenSim.Region.Physics.Meshing | |||
268 | { | 279 | { |
269 | if (!GenerateCoordsAndFacesFromPrimSculptData(primName, primShape, size, lod, out coords, out faces)) | 280 | if (!GenerateCoordsAndFacesFromPrimSculptData(primName, primShape, size, lod, out coords, out faces)) |
270 | return null; | 281 | return null; |
282 | // Remove the reference to any JPEG2000 sculpt data so it can be GCed | ||
283 | // don't loose it | ||
284 | // primShape.SculptData = Utils.EmptyBytes; | ||
271 | } | 285 | } |
286 | // primShape.SculptDataLoaded = true; | ||
272 | } | 287 | } |
273 | else | 288 | else |
274 | { | 289 | { |
275 | if (!GenerateCoordsAndFacesFromPrimShapeData(primName, primShape, size, lod, out coords, out faces)) | 290 | if (!GenerateCoordsAndFacesFromPrimShapeData(primName, primShape, size, lod, out coords, out faces)) |
276 | return null; | 291 | return null; |
277 | } | 292 | } |
278 | 293 | // keep compatible | |
279 | // Remove the reference to any JPEG2000 sculpt data so it can be GCed | ||
280 | primShape.SculptData = Utils.EmptyBytes; | 294 | primShape.SculptData = Utils.EmptyBytes; |
281 | 295 | ||
282 | int numCoords = coords.Count; | 296 | int numCoords = coords.Count; |
@@ -321,7 +335,7 @@ namespace OpenSim.Region.Physics.Meshing | |||
321 | 335 | ||
322 | if (primShape.SculptData.Length <= 0) | 336 | if (primShape.SculptData.Length <= 0) |
323 | { | 337 | { |
324 | m_log.ErrorFormat("[MESH]: asset data for {0} is zero length", primName); | 338 | m_log.InfoFormat("[MESH]: asset data for {0} is zero length", primName); |
325 | return false; | 339 | return false; |
326 | } | 340 | } |
327 | 341 | ||
@@ -482,7 +496,8 @@ namespace OpenSim.Region.Physics.Meshing | |||
482 | 496 | ||
483 | //idata = CSJ2K.J2kImage.FromBytes(primShape.SculptData); | 497 | //idata = CSJ2K.J2kImage.FromBytes(primShape.SculptData); |
484 | 498 | ||
485 | if (cacheSculptMaps) | 499 | if (cacheSculptMaps && (cacheSculptAlphaMaps || (((ImageFlags)(idata.Flags) & ImageFlags.HasAlpha) ==0))) |
500 | // don't cache images with alpha channel in linux since mono can't load them correctly) | ||
486 | { | 501 | { |
487 | try { idata.Save(decodedSculptFileName, ImageFormat.MemoryBmp); } | 502 | try { idata.Save(decodedSculptFileName, ImageFormat.MemoryBmp); } |
488 | catch (Exception e) { m_log.Error("[SCULPT]: unable to cache sculpt map " + decodedSculptFileName + " " + e.Message); } | 503 | catch (Exception e) { m_log.Error("[SCULPT]: unable to cache sculpt map " + decodedSculptFileName + " " + e.Message); } |
@@ -702,6 +717,11 @@ namespace OpenSim.Region.Physics.Meshing | |||
702 | return CreateMesh(primName, primShape, size, lod, false); | 717 | return CreateMesh(primName, primShape, size, lod, false); |
703 | } | 718 | } |
704 | 719 | ||
720 | public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex) | ||
721 | { | ||
722 | return CreateMesh(primName, primShape, size, lod, false); | ||
723 | } | ||
724 | |||
705 | public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical) | 725 | public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical) |
706 | { | 726 | { |
707 | #if SPAM | 727 | #if SPAM |
@@ -743,5 +763,7 @@ namespace OpenSim.Region.Physics.Meshing | |||
743 | 763 | ||
744 | return mesh; | 764 | return mesh; |
745 | } | 765 | } |
766 | public void ReleaseMesh(IMesh imesh) { } | ||
767 | public void ExpireReleaseMeshs() { } | ||
746 | } | 768 | } |
747 | } | 769 | } |