aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/PhysicsModules/ubOdeMeshing/Mesh.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/PhysicsModules/ubOdeMeshing/Mesh.cs')
-rw-r--r--OpenSim/Region/PhysicsModules/ubOdeMeshing/Mesh.cs23
1 files changed, 13 insertions, 10 deletions
diff --git a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Mesh.cs b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Mesh.cs
index 5d2b1f7..380cce2 100644
--- a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Mesh.cs
+++ b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Mesh.cs
@@ -218,7 +218,6 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
218 m_bdata.m_obbZmax = z; 218 m_bdata.m_obbZmax = z;
219 if (z < m_bdata.m_obbZmin) 219 if (z < m_bdata.m_obbZmin)
220 m_bdata.m_obbZmin = z; 220 m_bdata.m_obbZmin = z;
221
222 } 221 }
223 222
224 public void Add(Triangle triangle) 223 public void Add(Triangle triangle)
@@ -324,13 +323,15 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
324 if (m_bdata.m_vertices == null) 323 if (m_bdata.m_vertices == null)
325 throw new NotSupportedException(); 324 throw new NotSupportedException();
326 float[] result = new float[m_bdata.m_vertices.Count * 3]; 325 float[] result = new float[m_bdata.m_vertices.Count * 3];
326 int k = 0;
327 foreach (KeyValuePair<Vertex, int> kvp in m_bdata.m_vertices) 327 foreach (KeyValuePair<Vertex, int> kvp in m_bdata.m_vertices)
328 { 328 {
329 Vertex v = kvp.Key; 329 Vertex v = kvp.Key;
330 int i = kvp.Value; 330 int i = kvp.Value;
331 result[3 * i + 0] = v.X; 331 k = 3 * i;
332 result[3 * i + 1] = v.Y; 332 result[k] = v.X;
333 result[3 * i + 2] = v.Z; 333 result[k + 1] = v.Y;
334 result[k + 2] = v.Z;
334 } 335 }
335 return result; 336 return result;
336 } 337 }
@@ -364,12 +365,14 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
364 if (m_bdata.m_triangles == null) 365 if (m_bdata.m_triangles == null)
365 throw new NotSupportedException(); 366 throw new NotSupportedException();
366 int[] result = new int[m_bdata.m_triangles.Count * 3]; 367 int[] result = new int[m_bdata.m_triangles.Count * 3];
368 int k;
367 for (int i = 0; i < m_bdata.m_triangles.Count; i++) 369 for (int i = 0; i < m_bdata.m_triangles.Count; i++)
368 { 370 {
371 k= 3 * i;
369 Triangle t = m_bdata.m_triangles[i]; 372 Triangle t = m_bdata.m_triangles[i];
370 result[3 * i + 0] = m_bdata.m_vertices[t.v1]; 373 result[k] = m_bdata.m_vertices[t.v1];
371 result[3 * i + 1] = m_bdata.m_vertices[t.v2]; 374 result[k + 1] = m_bdata.m_vertices[t.v2];
372 result[3 * i + 2] = m_bdata.m_vertices[t.v3]; 375 result[k + 2] = m_bdata.m_vertices[t.v3];
373 } 376 }
374 return result; 377 return result;
375 } 378 }
@@ -463,9 +466,9 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
463 if (v == null) 466 if (v == null)
464 continue; 467 continue;
465 float x, y, z; 468 float x, y, z;
466 x = v.X*matrix[0, 0] + v.Y*matrix[1, 0] + v.Z*matrix[2, 0]; 469 x = v.X * matrix[0, 0] + v.Y * matrix[1, 0] + v.Z * matrix[2, 0];
467 y = v.X*matrix[0, 1] + v.Y*matrix[1, 1] + v.Z*matrix[2, 1]; 470 y = v.X * matrix[0, 1] + v.Y * matrix[1, 1] + v.Z * matrix[2, 1];
468 z = v.X*matrix[0, 2] + v.Y*matrix[1, 2] + v.Z*matrix[2, 2]; 471 z = v.X * matrix[0, 2] + v.Y * matrix[1, 2] + v.Z * matrix[2, 2];
469 v.X = x + offset[0]; 472 v.X = x + offset[0];
470 v.Y = y + offset[1]; 473 v.Y = y + offset[1];
471 v.Z = z + offset[2]; 474 v.Z = z + offset[2];