aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Physics/UbitMeshing/Mesh.cs16
1 files changed, 16 insertions, 0 deletions
diff --git a/OpenSim/Region/Physics/UbitMeshing/Mesh.cs b/OpenSim/Region/Physics/UbitMeshing/Mesh.cs
index 1e9b8bc..0476b28 100644
--- a/OpenSim/Region/Physics/UbitMeshing/Mesh.cs
+++ b/OpenSim/Region/Physics/UbitMeshing/Mesh.cs
@@ -205,12 +205,28 @@ namespace OpenSim.Region.Physics.Meshing
205 205
206 } 206 }
207 207
208 private float fRound(float f)
209 {
210 int i = (int)(1e5f * f +0.5f);
211 return ((float)i * 1e-5f);
212 }
208 213
209 public void Add(Triangle triangle) 214 public void Add(Triangle triangle)
210 { 215 {
211 if (m_indicesPtr != IntPtr.Zero || m_verticesPtr != IntPtr.Zero) 216 if (m_indicesPtr != IntPtr.Zero || m_verticesPtr != IntPtr.Zero)
212 throw new NotSupportedException("Attempt to Add to a pinned Mesh"); 217 throw new NotSupportedException("Attempt to Add to a pinned Mesh");
213 218
219 // round down
220 triangle.v1.X = fRound(triangle.v1.X);
221 triangle.v1.Y = fRound(triangle.v1.Y);
222 triangle.v1.Z = fRound(triangle.v1.Z);
223 triangle.v2.X = fRound(triangle.v2.X);
224 triangle.v2.Y = fRound(triangle.v2.Y);
225 triangle.v2.Z = fRound(triangle.v2.Z);
226 triangle.v3.X = fRound(triangle.v3.X);
227 triangle.v3.Y = fRound(triangle.v3.Y);
228 triangle.v3.Z = fRound(triangle.v3.Z);
229
214 if ((triangle.v1.X == triangle.v2.X && triangle.v1.Y == triangle.v2.Y && triangle.v1.Z == triangle.v2.Z) 230 if ((triangle.v1.X == triangle.v2.X && triangle.v1.Y == triangle.v2.Y && triangle.v1.Z == triangle.v2.Z)
215 || (triangle.v1.X == triangle.v3.X && triangle.v1.Y == triangle.v3.Y && triangle.v1.Z == triangle.v3.Z) 231 || (triangle.v1.X == triangle.v3.X && triangle.v1.Y == triangle.v3.Y && triangle.v1.Z == triangle.v3.Z)
216 || (triangle.v2.X == triangle.v3.X && triangle.v2.Y == triangle.v3.Y && triangle.v2.Z == triangle.v3.Z) 232 || (triangle.v2.X == triangle.v3.X && triangle.v2.Y == triangle.v3.Y && triangle.v2.Z == triangle.v3.Z)