diff options
author | Melanie Thielker | 2017-01-05 19:07:37 +0000 |
---|---|---|
committer | Melanie Thielker | 2017-01-05 19:07:37 +0000 |
commit | b16abc8166c29585cb76cc55c3bdd76e5833cb4f (patch) | |
tree | 6a34f465a74b7a3a6dc00a3d7aa8dcc25ac3e3a5 /OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs | |
parent | Make it possible to disable the bakes module in the way it is described in co... (diff) | |
download | opensim-SC_OLD-b16abc8166c29585cb76cc55c3bdd76e5833cb4f.zip opensim-SC_OLD-b16abc8166c29585cb76cc55c3bdd76e5833cb4f.tar.gz opensim-SC_OLD-b16abc8166c29585cb76cc55c3bdd76e5833cb4f.tar.bz2 opensim-SC_OLD-b16abc8166c29585cb76cc55c3bdd76e5833cb4f.tar.xz |
Massive tab and trailing space cleanup
Diffstat (limited to 'OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs')
-rw-r--r-- | OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs index 7f0713a..163f439 100644 --- a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs +++ b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs | |||
@@ -58,8 +58,8 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
58 | // Setting baseDir to a path will enable the dumping of raw files | 58 | // Setting baseDir to a path will enable the dumping of raw files |
59 | // raw files can be imported by blender so a visual inspection of the results can be done | 59 | // raw files can be imported by blender so a visual inspection of the results can be done |
60 | 60 | ||
61 | private bool m_Enabled = false; | 61 | private bool m_Enabled = false; |
62 | 62 | ||
63 | public static object diskLock = new object(); | 63 | public static object diskLock = new object(); |
64 | 64 | ||
65 | public bool doMeshFileCache = true; | 65 | public bool doMeshFileCache = true; |
@@ -120,7 +120,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
120 | } | 120 | } |
121 | 121 | ||
122 | CacheExpire = TimeSpan.FromHours(fcache); | 122 | CacheExpire = TimeSpan.FromHours(fcache); |
123 | 123 | ||
124 | lock (diskLock) | 124 | lock (diskLock) |
125 | { | 125 | { |
126 | if(doMeshFileCache && cachePath != "") | 126 | if(doMeshFileCache && cachePath != "") |
@@ -165,9 +165,9 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
165 | if (!m_Enabled) | 165 | if (!m_Enabled) |
166 | return; | 166 | return; |
167 | } | 167 | } |
168 | 168 | ||
169 | #endregion | 169 | #endregion |
170 | 170 | ||
171 | /// <summary> | 171 | /// <summary> |
172 | /// creates a simple box mesh of the specified size. This mesh is of very low vertex count and may | 172 | /// creates a simple box mesh of the specified size. This mesh is of very low vertex count and may |
173 | /// be useful as a backup proxy when level of detail is not needed or when more complex meshes fail | 173 | /// be useful as a backup proxy when level of detail is not needed or when more complex meshes fail |
@@ -266,7 +266,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
266 | private void AddSubMesh(OSDMap subMeshData, List<Coord> coords, List<Face> faces) | 266 | private void AddSubMesh(OSDMap subMeshData, List<Coord> coords, List<Face> faces) |
267 | { | 267 | { |
268 | // Console.WriteLine("subMeshMap for {0} - {1}", primName, Util.GetFormattedXml((OSD)subMeshMap)); | 268 | // Console.WriteLine("subMeshMap for {0} - {1}", primName, Util.GetFormattedXml((OSD)subMeshMap)); |
269 | 269 | ||
270 | // As per http://wiki.secondlife.com/wiki/Mesh/Mesh_Asset_Format, some Mesh Level | 270 | // As per http://wiki.secondlife.com/wiki/Mesh/Mesh_Asset_Format, some Mesh Level |
271 | // of Detail Blocks (maps) contain just a NoGeometry key to signal there is no | 271 | // of Detail Blocks (maps) contain just a NoGeometry key to signal there is no |
272 | // geometry for this submesh. | 272 | // geometry for this submesh. |
@@ -294,15 +294,15 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
294 | ushort uX = Utils.BytesToUInt16(posBytes, i); | 294 | ushort uX = Utils.BytesToUInt16(posBytes, i); |
295 | ushort uY = Utils.BytesToUInt16(posBytes, i + 2); | 295 | ushort uY = Utils.BytesToUInt16(posBytes, i + 2); |
296 | ushort uZ = Utils.BytesToUInt16(posBytes, i + 4); | 296 | ushort uZ = Utils.BytesToUInt16(posBytes, i + 4); |
297 | 297 | ||
298 | Coord c = new Coord( | 298 | Coord c = new Coord( |
299 | Utils.UInt16ToFloat(uX, posMin.X, posMax.X), | 299 | Utils.UInt16ToFloat(uX, posMin.X, posMax.X), |
300 | Utils.UInt16ToFloat(uY, posMin.Y, posMax.Y), | 300 | Utils.UInt16ToFloat(uY, posMin.Y, posMax.Y), |
301 | Utils.UInt16ToFloat(uZ, posMin.Z, posMax.Z)); | 301 | Utils.UInt16ToFloat(uZ, posMin.Z, posMax.Z)); |
302 | 302 | ||
303 | coords.Add(c); | 303 | coords.Add(c); |
304 | } | 304 | } |
305 | 305 | ||
306 | byte[] triangleBytes = subMeshData["TriangleList"].AsBinary(); | 306 | byte[] triangleBytes = subMeshData["TriangleList"].AsBinary(); |
307 | for (int i = 0; i < triangleBytes.Length; i += 6) | 307 | for (int i = 0; i < triangleBytes.Length; i += 6) |
308 | { | 308 | { |
@@ -448,7 +448,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
448 | if (physicsParms != null) | 448 | if (physicsParms != null) |
449 | usemesh = true; | 449 | usemesh = true; |
450 | } | 450 | } |
451 | 451 | ||
452 | if(!usemesh && (map.ContainsKey("physics_convex"))) | 452 | if(!usemesh && (map.ContainsKey("physics_convex"))) |
453 | physicsParms = (OSDMap)map["physics_convex"]; | 453 | physicsParms = (OSDMap)map["physics_convex"]; |
454 | 454 | ||
@@ -488,9 +488,9 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
488 | 488 | ||
489 | byte[] decompressedBuf = outMs.GetBuffer(); | 489 | byte[] decompressedBuf = outMs.GetBuffer(); |
490 | 490 | ||
491 | decodedMeshOsd = OSDParser.DeserializeLLSDBinary(decompressedBuf); | 491 | decodedMeshOsd = OSDParser.DeserializeLLSDBinary(decompressedBuf); |
492 | } | 492 | } |
493 | } | 493 | } |
494 | } | 494 | } |
495 | } | 495 | } |
496 | catch (Exception e) | 496 | catch (Exception e) |
@@ -622,7 +622,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
622 | faces.Add(f); | 622 | faces.Add(f); |
623 | } | 623 | } |
624 | vertsoffset += vs.Count; | 624 | vertsoffset += vs.Count; |
625 | vs.Clear(); | 625 | vs.Clear(); |
626 | continue; | 626 | continue; |
627 | } | 627 | } |
628 | /* | 628 | /* |
@@ -648,7 +648,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
648 | c.Z = hullr.Vertices[i].z; | 648 | c.Z = hullr.Vertices[i].z; |
649 | coords.Add(c); | 649 | coords.Add(c); |
650 | } | 650 | } |
651 | 651 | ||
652 | for (i = 0; i < nindexs; i += 3) | 652 | for (i = 0; i < nindexs; i += 3) |
653 | { | 653 | { |
654 | t1 = hullr.Indices[i]; | 654 | t1 = hullr.Indices[i]; |
@@ -687,7 +687,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
687 | c.Z = vs[i].z; | 687 | c.Z = vs[i].z; |
688 | coords.Add(c); | 688 | coords.Add(c); |
689 | } | 689 | } |
690 | 690 | ||
691 | for (i = 0; i < nindexs; i += 3) | 691 | for (i = 0; i < nindexs; i += 3) |
692 | { | 692 | { |
693 | t1 = indices[i]; | 693 | t1 = indices[i]; |
@@ -707,12 +707,12 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
707 | } | 707 | } |
708 | } | 708 | } |
709 | if (coords.Count > 0 && faces.Count > 0) | 709 | if (coords.Count > 0 && faces.Count > 0) |
710 | return true; | 710 | return true; |
711 | } | 711 | } |
712 | else | 712 | else |
713 | { | 713 | { |
714 | // if neither mesh or decomposition present, warn and use convex | 714 | // if neither mesh or decomposition present, warn and use convex |
715 | m_log.WarnFormat("[MESH]: Data for PRIM shape type ( mesh or decomposition) not found for prim {0}",primName); | 715 | m_log.WarnFormat("[MESH]: Data for PRIM shape type ( mesh or decomposition) not found for prim {0}",primName); |
716 | } | 716 | } |
717 | } | 717 | } |
718 | vs.Clear(); | 718 | vs.Clear(); |
@@ -947,7 +947,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
947 | { | 947 | { |
948 | PrimMesh primMesh; | 948 | PrimMesh primMesh; |
949 | coords = new List<Coord>(); | 949 | coords = new List<Coord>(); |
950 | faces = new List<Face>(); | 950 | faces = new List<Face>(); |
951 | 951 | ||
952 | float pathShearX = primShape.PathShearX < 128 ? (float)primShape.PathShearX * 0.01f : (float)(primShape.PathShearX - 256) * 0.01f; | 952 | float pathShearX = primShape.PathShearX < 128 ? (float)primShape.PathShearX * 0.01f : (float)(primShape.PathShearX - 256) * 0.01f; |
953 | float pathShearY = primShape.PathShearY < 128 ? (float)primShape.PathShearY * 0.01f : (float)(primShape.PathShearY - 256) * 0.01f; | 953 | float pathShearY = primShape.PathShearY < 128 ? (float)primShape.PathShearY * 0.01f : (float)(primShape.PathShearY - 256) * 0.01f; |
@@ -975,7 +975,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
975 | profileHollow = 0.0f; | 975 | profileHollow = 0.0f; |
976 | else if (profileHollow > 0.95f) | 976 | else if (profileHollow > 0.95f) |
977 | profileHollow = 0.95f; | 977 | profileHollow = 0.95f; |
978 | 978 | ||
979 | int sides = 4; | 979 | int sides = 4; |
980 | LevelOfDetail iLOD = (LevelOfDetail)lod; | 980 | LevelOfDetail iLOD = (LevelOfDetail)lod; |
981 | byte profshape = (byte)(primShape.ProfileCurve & 0x07); | 981 | byte profshape = (byte)(primShape.ProfileCurve & 0x07); |
@@ -1033,7 +1033,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
1033 | } | 1033 | } |
1034 | 1034 | ||
1035 | primMesh = new PrimMesh(sides, profileBegin, profileEnd, profileHollow, hollowSides); | 1035 | primMesh = new PrimMesh(sides, profileBegin, profileEnd, profileHollow, hollowSides); |
1036 | 1036 | ||
1037 | if (primMesh.errorMessage != null) | 1037 | if (primMesh.errorMessage != null) |
1038 | if (primMesh.errorMessage.Length > 0) | 1038 | if (primMesh.errorMessage.Length > 0) |
1039 | m_log.Error("[ERROR] " + primMesh.errorMessage); | 1039 | m_log.Error("[ERROR] " + primMesh.errorMessage); |
@@ -1162,7 +1162,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
1162 | for (int i = 0; i < someBytes.Length; i++) | 1162 | for (int i = 0; i < someBytes.Length; i++) |
1163 | hash = mdjb2(hash, someBytes[i]); | 1163 | hash = mdjb2(hash, someBytes[i]); |
1164 | hash = hash << 8; | 1164 | hash = hash << 8; |
1165 | } | 1165 | } |
1166 | 1166 | ||
1167 | if (convex) | 1167 | if (convex) |
1168 | hash |= 4; | 1168 | hash |= 4; |
@@ -1204,7 +1204,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
1204 | { | 1204 | { |
1205 | return CreateMesh(primName, primShape, size, lod, false, false, false); | 1205 | return CreateMesh(primName, primShape, size, lod, false, false, false); |
1206 | } | 1206 | } |
1207 | 1207 | ||
1208 | public IMesh GetMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex) | 1208 | public IMesh GetMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex) |
1209 | { | 1209 | { |
1210 | Mesh mesh = null; | 1210 | Mesh mesh = null; |
@@ -1245,7 +1245,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
1245 | } | 1245 | } |
1246 | 1246 | ||
1247 | private static Vector3 m_MeshUnitSize = new Vector3(1.0f, 1.0f, 1.0f); | 1247 | private static Vector3 m_MeshUnitSize = new Vector3(1.0f, 1.0f, 1.0f); |
1248 | 1248 | ||
1249 | public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex, bool forOde) | 1249 | public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex, bool forOde) |
1250 | { | 1250 | { |
1251 | #if SPAM | 1251 | #if SPAM |
@@ -1348,7 +1348,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
1348 | m_uniqueMeshes.Add(key, mesh); | 1348 | m_uniqueMeshes.Add(key, mesh); |
1349 | } | 1349 | } |
1350 | catch { } | 1350 | catch { } |
1351 | } | 1351 | } |
1352 | 1352 | ||
1353 | return mesh; | 1353 | return mesh; |
1354 | } | 1354 | } |
@@ -1380,7 +1380,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
1380 | m_uniqueReleasedMeshes.Add(mesh.Key, mesh); | 1380 | m_uniqueReleasedMeshes.Add(mesh.Key, mesh); |
1381 | } | 1381 | } |
1382 | catch { } | 1382 | catch { } |
1383 | } | 1383 | } |
1384 | } | 1384 | } |
1385 | } | 1385 | } |
1386 | 1386 | ||
@@ -1447,7 +1447,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
1447 | // BinaryFormatter bformatter = new BinaryFormatter(); | 1447 | // BinaryFormatter bformatter = new BinaryFormatter(); |
1448 | mesh = Mesh.FromStream(stream,key); | 1448 | mesh = Mesh.FromStream(stream,key); |
1449 | } | 1449 | } |
1450 | 1450 | ||
1451 | } | 1451 | } |
1452 | catch (Exception e) | 1452 | catch (Exception e) |
1453 | { | 1453 | { |
@@ -1524,7 +1524,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
1524 | } | 1524 | } |
1525 | } | 1525 | } |
1526 | } | 1526 | } |
1527 | 1527 | ||
1528 | public void ExpireFileCache() | 1528 | public void ExpireFileCache() |
1529 | { | 1529 | { |
1530 | if (!doCacheExpire) | 1530 | if (!doCacheExpire) |
@@ -1543,8 +1543,8 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
1543 | int ndirs = 0; | 1543 | int ndirs = 0; |
1544 | DateTime OlderTime = File.GetLastAccessTimeUtc(controlfile) - CacheExpire; | 1544 | DateTime OlderTime = File.GetLastAccessTimeUtc(controlfile) - CacheExpire; |
1545 | File.SetLastAccessTimeUtc(controlfile, DateTime.UtcNow); | 1545 | File.SetLastAccessTimeUtc(controlfile, DateTime.UtcNow); |
1546 | 1546 | ||
1547 | foreach (string dir in Directory.GetDirectories(cachePath)) | 1547 | foreach (string dir in Directory.GetDirectories(cachePath)) |
1548 | { | 1548 | { |
1549 | try | 1549 | try |
1550 | { | 1550 | { |