aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/UbitMeshing/Mesh.cs
diff options
context:
space:
mode:
authorUbitUmarov2012-12-02 03:58:40 +0000
committerMelanie2012-12-03 19:41:21 +0100
commitaa00308b10228cd2c5a04a41fc5b3da8009cd0fd (patch)
tree4d03ef25becd4f5bc99a6dcc153feebdee748db7 /OpenSim/Region/Physics/UbitMeshing/Mesh.cs
parentadjust avatar standing Z position (diff)
downloadopensim-SC-aa00308b10228cd2c5a04a41fc5b3da8009cd0fd.zip
opensim-SC-aa00308b10228cd2c5a04a41fc5b3da8009cd0fd.tar.gz
opensim-SC-aa00308b10228cd2c5a04a41fc5b3da8009cd0fd.tar.bz2
opensim-SC-aa00308b10228cd2c5a04a41fc5b3da8009cd0fd.tar.xz
*TEST* reduce all mesh vertices resolution to 1e-5. This reduces number
of unique vertices only originated by math errors in PrimMesher
Diffstat (limited to '')
-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)