aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/PhysicsModules/Meshing
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/PhysicsModules/Meshing')
-rw-r--r--OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Mesh.cs12
-rw-r--r--OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Meshmerizer.cs20
-rw-r--r--OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/PrimMesher.cs6
-rw-r--r--OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/SculptMap.cs8
-rw-r--r--OpenSim/Region/PhysicsModules/Meshing/Properties/AssemblyInfo.cs8
5 files changed, 27 insertions, 27 deletions
diff --git a/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Mesh.cs b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Mesh.cs
index e63ad01..42ba37e 100644
--- a/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Mesh.cs
+++ b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Mesh.cs
@@ -102,8 +102,8 @@ namespace OpenSim.Region.PhysicsModule.Meshing
102 if ((triangle.v1.X == triangle.v2.X && triangle.v1.Y == triangle.v2.Y && triangle.v1.Z == triangle.v2.Z) 102 if ((triangle.v1.X == triangle.v2.X && triangle.v1.Y == triangle.v2.Y && triangle.v1.Z == triangle.v2.Z)
103 || (triangle.v1.X == triangle.v3.X && triangle.v1.Y == triangle.v3.Y && triangle.v1.Z == triangle.v3.Z) 103 || (triangle.v1.X == triangle.v3.X && triangle.v1.Y == triangle.v3.Y && triangle.v1.Z == triangle.v3.Z)
104 || (triangle.v2.X == triangle.v3.X && triangle.v2.Y == triangle.v3.Y && triangle.v2.Z == triangle.v3.Z) 104 || (triangle.v2.X == triangle.v3.X && triangle.v2.Y == triangle.v3.Y && triangle.v2.Z == triangle.v3.Z)
105 ) 105 )
106 { 106 {
107 return; 107 return;
108 } 108 }
109 109
@@ -259,7 +259,7 @@ namespace OpenSim.Region.PhysicsModule.Meshing
259 public void getVertexListAsPtrToFloatArray(out IntPtr vertices, out int vertexStride, out int vertexCount) 259 public void getVertexListAsPtrToFloatArray(out IntPtr vertices, out int vertexStride, out int vertexCount)
260 { 260 {
261 // A vertex is 3 floats 261 // A vertex is 3 floats
262 262
263 vertexStride = 3 * sizeof(float); 263 vertexStride = 3 * sizeof(float);
264 264
265 // If there isn't an unmanaged array allocated yet, do it now 265 // If there isn't an unmanaged array allocated yet, do it now
@@ -299,7 +299,7 @@ namespace OpenSim.Region.PhysicsModule.Meshing
299 { 299 {
300 if (m_pinnedIndex.IsAllocated) 300 if (m_pinnedIndex.IsAllocated)
301 return (int[])(m_pinnedIndex.Target); 301 return (int[])(m_pinnedIndex.Target);
302 302
303 int[] result = getIndexListAsInt(); 303 int[] result = getIndexListAsInt();
304 m_pinnedIndex = GCHandle.Alloc(result, GCHandleType.Pinned); 304 m_pinnedIndex = GCHandle.Alloc(result, GCHandleType.Pinned);
305 // Inform the garbage collector of this unmanaged allocation so it can schedule 305 // Inform the garbage collector of this unmanaged allocation so it can schedule
@@ -357,7 +357,7 @@ namespace OpenSim.Region.PhysicsModule.Meshing
357 { 357 {
358 if (m_pinnedIndex.IsAllocated || m_pinnedVertexes.IsAllocated || m_indicesPtr != IntPtr.Zero || m_verticesPtr != IntPtr.Zero) 358 if (m_pinnedIndex.IsAllocated || m_pinnedVertexes.IsAllocated || m_indicesPtr != IntPtr.Zero || m_verticesPtr != IntPtr.Zero)
359 throw new NotSupportedException("Attempt to Append to a pinned Mesh"); 359 throw new NotSupportedException("Attempt to Append to a pinned Mesh");
360 360
361 if (!(newMesh is Mesh)) 361 if (!(newMesh is Mesh))
362 return; 362 return;
363 363
@@ -370,7 +370,7 @@ namespace OpenSim.Region.PhysicsModule.Meshing
370 { 370 {
371 if (m_pinnedIndex.IsAllocated || m_pinnedVertexes.IsAllocated || m_indicesPtr != IntPtr.Zero || m_verticesPtr != IntPtr.Zero) 371 if (m_pinnedIndex.IsAllocated || m_pinnedVertexes.IsAllocated || m_indicesPtr != IntPtr.Zero || m_verticesPtr != IntPtr.Zero)
372 throw new NotSupportedException("Attempt to TransformLinear a pinned Mesh"); 372 throw new NotSupportedException("Attempt to TransformLinear a pinned Mesh");
373 373
374 foreach (Vertex v in m_vertices.Keys) 374 foreach (Vertex v in m_vertices.Keys)
375 { 375 {
376 if (v == null) 376 if (v == null)
diff --git a/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Meshmerizer.cs b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Meshmerizer.cs
index 0d22e96..4f95554 100644
--- a/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Meshmerizer.cs
+++ b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Meshmerizer.cs
@@ -247,13 +247,13 @@ namespace OpenSim.Region.PhysicsModule.Meshing
247 private void AddSubMesh(OSDMap subMeshData, Vector3 size, List<Coord> coords, List<Face> faces) 247 private void AddSubMesh(OSDMap subMeshData, Vector3 size, List<Coord> coords, List<Face> faces)
248 { 248 {
249 // Console.WriteLine("subMeshMap for {0} - {1}", primName, Util.GetFormattedXml((OSD)subMeshMap)); 249 // Console.WriteLine("subMeshMap for {0} - {1}", primName, Util.GetFormattedXml((OSD)subMeshMap));
250 250
251 // As per http://wiki.secondlife.com/wiki/Mesh/Mesh_Asset_Format, some Mesh Level 251 // As per http://wiki.secondlife.com/wiki/Mesh/Mesh_Asset_Format, some Mesh Level
252 // of Detail Blocks (maps) contain just a NoGeometry key to signal there is no 252 // of Detail Blocks (maps) contain just a NoGeometry key to signal there is no
253 // geometry for this submesh. 253 // geometry for this submesh.
254 if (subMeshData.ContainsKey("NoGeometry") && ((OSDBoolean)subMeshData["NoGeometry"])) 254 if (subMeshData.ContainsKey("NoGeometry") && ((OSDBoolean)subMeshData["NoGeometry"]))
255 return; 255 return;
256 256
257 OpenMetaverse.Vector3 posMax = ((OSDMap)subMeshData["PositionDomain"])["Max"].AsVector3(); 257 OpenMetaverse.Vector3 posMax = ((OSDMap)subMeshData["PositionDomain"])["Max"].AsVector3();
258 OpenMetaverse.Vector3 posMin = ((OSDMap)subMeshData["PositionDomain"])["Min"].AsVector3(); 258 OpenMetaverse.Vector3 posMin = ((OSDMap)subMeshData["PositionDomain"])["Min"].AsVector3();
259 ushort faceIndexOffset = (ushort)coords.Count; 259 ushort faceIndexOffset = (ushort)coords.Count;
@@ -264,15 +264,15 @@ namespace OpenSim.Region.PhysicsModule.Meshing
264 ushort uX = Utils.BytesToUInt16(posBytes, i); 264 ushort uX = Utils.BytesToUInt16(posBytes, i);
265 ushort uY = Utils.BytesToUInt16(posBytes, i + 2); 265 ushort uY = Utils.BytesToUInt16(posBytes, i + 2);
266 ushort uZ = Utils.BytesToUInt16(posBytes, i + 4); 266 ushort uZ = Utils.BytesToUInt16(posBytes, i + 4);
267 267
268 Coord c = new Coord( 268 Coord c = new Coord(
269 Utils.UInt16ToFloat(uX, posMin.X, posMax.X) * size.X, 269 Utils.UInt16ToFloat(uX, posMin.X, posMax.X) * size.X,
270 Utils.UInt16ToFloat(uY, posMin.Y, posMax.Y) * size.Y, 270 Utils.UInt16ToFloat(uY, posMin.Y, posMax.Y) * size.Y,
271 Utils.UInt16ToFloat(uZ, posMin.Z, posMax.Z) * size.Z); 271 Utils.UInt16ToFloat(uZ, posMin.Z, posMax.Z) * size.Z);
272 272
273 coords.Add(c); 273 coords.Add(c);
274 } 274 }
275 275
276 byte[] triangleBytes = subMeshData["TriangleList"].AsBinary(); 276 byte[] triangleBytes = subMeshData["TriangleList"].AsBinary();
277 for (int i = 0; i < triangleBytes.Length; i += 6) 277 for (int i = 0; i < triangleBytes.Length; i += 6)
278 { 278 {
@@ -436,9 +436,9 @@ namespace OpenSim.Region.PhysicsModule.Meshing
436 int convexSize = convexBlock["size"].AsInteger(); 436 int convexSize = convexBlock["size"].AsInteger();
437 437
438 byte[] convexBytes = new byte[convexSize]; 438 byte[] convexBytes = new byte[convexSize];
439 439
440 System.Buffer.BlockCopy(primShape.SculptData, convexOffset, convexBytes, 0, convexSize); 440 System.Buffer.BlockCopy(primShape.SculptData, convexOffset, convexBytes, 0, convexSize);
441 441
442 try 442 try
443 { 443 {
444 convexBlockOsd = DecompressOsd(convexBytes); 444 convexBlockOsd = DecompressOsd(convexBytes);
@@ -449,7 +449,7 @@ namespace OpenSim.Region.PhysicsModule.Meshing
449 //return false; 449 //return false;
450 } 450 }
451 } 451 }
452 452
453 if (convexBlockOsd != null && convexBlockOsd is OSDMap) 453 if (convexBlockOsd != null && convexBlockOsd is OSDMap)
454 { 454 {
455 convexBlock = convexBlockOsd as OSDMap; 455 convexBlock = convexBlockOsd as OSDMap;
@@ -762,7 +762,7 @@ namespace OpenSim.Region.PhysicsModule.Meshing
762 { 762 {
763 PrimMesh primMesh; 763 PrimMesh primMesh;
764 coords = new List<Coord>(); 764 coords = new List<Coord>();
765 faces = new List<Face>(); 765 faces = new List<Face>();
766 766
767 float pathShearX = primShape.PathShearX < 128 ? (float)primShape.PathShearX * 0.01f : (float)(primShape.PathShearX - 256) * 0.01f; 767 float pathShearX = primShape.PathShearX < 128 ? (float)primShape.PathShearX * 0.01f : (float)(primShape.PathShearX - 256) * 0.01f;
768 float pathShearY = primShape.PathShearY < 128 ? (float)primShape.PathShearY * 0.01f : (float)(primShape.PathShearY - 256) * 0.01f; 768 float pathShearY = primShape.PathShearY < 128 ? (float)primShape.PathShearY * 0.01f : (float)(primShape.PathShearY - 256) * 0.01f;
@@ -994,7 +994,7 @@ namespace OpenSim.Region.PhysicsModule.Meshing
994 if ((!isPhysical) && size.X < minSizeForComplexMesh && size.Y < minSizeForComplexMesh && size.Z < minSizeForComplexMesh) 994 if ((!isPhysical) && size.X < minSizeForComplexMesh && size.Y < minSizeForComplexMesh && size.Z < minSizeForComplexMesh)
995 { 995 {
996#if SPAM 996#if SPAM
997 m_log.Debug("Meshmerizer: prim " + primName + " has a size of " + size.ToString() + " which is below threshold of " + 997 m_log.Debug("Meshmerizer: prim " + primName + " has a size of " + size.ToString() + " which is below threshold of " +
998 minSizeForComplexMesh.ToString() + " - creating simple bounding box"); 998 minSizeForComplexMesh.ToString() + " - creating simple bounding box");
999#endif 999#endif
1000 mesh = CreateBoundingBoxMesh(mesh); 1000 mesh = CreateBoundingBoxMesh(mesh);
diff --git a/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/PrimMesher.cs b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/PrimMesher.cs
index 4049ee1..fd2b1ea 100644
--- a/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/PrimMesher.cs
+++ b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/PrimMesher.cs
@@ -445,7 +445,7 @@ namespace PrimMesher
445 new Angle(1.0f, 1.0f, 0.0f) 445 new Angle(1.0f, 1.0f, 0.0f)
446 }; 446 };
447 447
448 private static Coord[] normals4 = 448 private static Coord[] normals4 =
449 { 449 {
450 new Coord(0.5f, 0.5f, 0.0f).Normalize(), 450 new Coord(0.5f, 0.5f, 0.0f).Normalize(),
451 new Coord(-0.5f, 0.5f, 0.0f).Normalize(), 451 new Coord(-0.5f, 0.5f, 0.0f).Normalize(),
@@ -2066,7 +2066,7 @@ namespace PrimMesher
2066 /// DEPRICATED - use Extrude(PathType.Linear) instead 2066 /// DEPRICATED - use Extrude(PathType.Linear) instead
2067 /// Extrudes a profile along a straight line path. Used for prim types box, cylinder, and prism. 2067 /// Extrudes a profile along a straight line path. Used for prim types box, cylinder, and prism.
2068 /// </summary> 2068 /// </summary>
2069 /// 2069 ///
2070 public void ExtrudeLinear() 2070 public void ExtrudeLinear()
2071 { 2071 {
2072 this.Extrude(PathType.Linear); 2072 this.Extrude(PathType.Linear);
@@ -2077,7 +2077,7 @@ namespace PrimMesher
2077 /// DEPRICATED - use Extrude(PathType.Circular) instead 2077 /// DEPRICATED - use Extrude(PathType.Circular) instead
2078 /// Extrude a profile into a circular path prim mesh. Used for prim types torus, tube, and ring. 2078 /// Extrude a profile into a circular path prim mesh. Used for prim types torus, tube, and ring.
2079 /// </summary> 2079 /// </summary>
2080 /// 2080 ///
2081 public void ExtrudeCircular() 2081 public void ExtrudeCircular()
2082 { 2082 {
2083 this.Extrude(PathType.Circular); 2083 this.Extrude(PathType.Circular);
diff --git a/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/SculptMap.cs b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/SculptMap.cs
index b3d9cb6..01d11f4 100644
--- a/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/SculptMap.cs
+++ b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/SculptMap.cs
@@ -163,11 +163,11 @@ namespace PrimMesher
163 { 163 {
164 164
165 Bitmap scaledImage = new Bitmap(destWidth, destHeight, PixelFormat.Format24bppRgb); 165 Bitmap scaledImage = new Bitmap(destWidth, destHeight, PixelFormat.Format24bppRgb);
166 166
167 Color c; 167 Color c;
168 float xscale = srcImage.Width / destWidth; 168 float xscale = srcImage.Width / destWidth;
169 float yscale = srcImage.Height / destHeight; 169 float yscale = srcImage.Height / destHeight;
170 170
171 float sy = 0.5f; 171 float sy = 0.5f;
172 for (int y = 0; y < destHeight; y++) 172 for (int y = 0; y < destHeight; y++)
173 { 173 {
@@ -191,7 +191,7 @@ namespace PrimMesher
191 return scaledImage; 191 return scaledImage;
192 } 192 }
193 193
194 } 194 }
195 195
196 } 196 }
197#endif 197#endif
diff --git a/OpenSim/Region/PhysicsModules/Meshing/Properties/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/Meshing/Properties/AssemblyInfo.cs
index 8a842d4..5c257e6 100644
--- a/OpenSim/Region/PhysicsModules/Meshing/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/PhysicsModules/Meshing/Properties/AssemblyInfo.cs
@@ -3,7 +3,7 @@ using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices; 3using System.Runtime.InteropServices;
4using Mono.Addins; 4using Mono.Addins;
5 5
6// General Information about an assembly is controlled through the following 6// General Information about an assembly is controlled through the following
7// set of attributes. Change these attribute values to modify the information 7// set of attributes. Change these attribute values to modify the information
8// associated with an assembly. 8// associated with an assembly.
9[assembly: AssemblyTitle("OpenSim.Region.PhysicsModule.Meshing")] 9[assembly: AssemblyTitle("OpenSim.Region.PhysicsModule.Meshing")]
@@ -15,8 +15,8 @@ using Mono.Addins;
15[assembly: AssemblyTrademark("")] 15[assembly: AssemblyTrademark("")]
16[assembly: AssemblyCulture("")] 16[assembly: AssemblyCulture("")]
17 17
18// Setting ComVisible to false makes the types in this assembly not visible 18// Setting ComVisible to false makes the types in this assembly not visible
19// to COM components. If you need to access a type in this assembly from 19// to COM components. If you need to access a type in this assembly from
20// COM, set the ComVisible attribute to true on that type. 20// COM, set the ComVisible attribute to true on that type.
21[assembly: ComVisible(false)] 21[assembly: ComVisible(false)]
22 22
@@ -26,7 +26,7 @@ using Mono.Addins;
26// Version information for an assembly consists of the following four values: 26// Version information for an assembly consists of the following four values:
27// 27//
28// Major Version 28// Major Version
29// Minor Version 29// Minor Version
30// Build Number 30// Build Number
31// Revision 31// Revision
32// 32//