aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/UbitMeshing
diff options
context:
space:
mode:
authorMelanie2012-12-18 09:48:12 +0000
committerMelanie2012-12-18 09:48:12 +0000
commit79bdf464d3f123f8e195fa57c497e546b7d9dfcc (patch)
treebf6123b15d1ced7ec72ce871e4801d6645bb23f4 /OpenSim/Region/Physics/UbitMeshing
parentMerge branch 'master' into careminster (diff)
parentFix locking for good (diff)
downloadopensim-SC-79bdf464d3f123f8e195fa57c497e546b7d9dfcc.zip
opensim-SC-79bdf464d3f123f8e195fa57c497e546b7d9dfcc.tar.gz
opensim-SC-79bdf464d3f123f8e195fa57c497e546b7d9dfcc.tar.bz2
opensim-SC-79bdf464d3f123f8e195fa57c497e546b7d9dfcc.tar.xz
Merge branch 'avination' into careminster
Diffstat (limited to 'OpenSim/Region/Physics/UbitMeshing')
-rw-r--r--OpenSim/Region/Physics/UbitMeshing/Mesh.cs23
1 files changed, 23 insertions, 0 deletions
diff --git a/OpenSim/Region/Physics/UbitMeshing/Mesh.cs b/OpenSim/Region/Physics/UbitMeshing/Mesh.cs
index 1e9b8bc..b67422f 100644
--- a/OpenSim/Region/Physics/UbitMeshing/Mesh.cs
+++ b/OpenSim/Region/Physics/UbitMeshing/Mesh.cs
@@ -205,12 +205,35 @@ namespace OpenSim.Region.Physics.Meshing
205 205
206 } 206 }
207 207
208 private float fRound(float f)
209 {
210 int i;
211 if (f == 0f)
212 return f;
213 else if (f > 0f)
214 i = (int)(1e5f * f + 0.5f);
215 else
216 i = (int)(1e5f * f - 0.5f);
217
218 return ((float)i * 1e-5f);
219 }
208 220
209 public void Add(Triangle triangle) 221 public void Add(Triangle triangle)
210 { 222 {
211 if (m_indicesPtr != IntPtr.Zero || m_verticesPtr != IntPtr.Zero) 223 if (m_indicesPtr != IntPtr.Zero || m_verticesPtr != IntPtr.Zero)
212 throw new NotSupportedException("Attempt to Add to a pinned Mesh"); 224 throw new NotSupportedException("Attempt to Add to a pinned Mesh");
213 225
226 // round down
227 triangle.v1.X = fRound(triangle.v1.X);
228 triangle.v1.Y = fRound(triangle.v1.Y);
229 triangle.v1.Z = fRound(triangle.v1.Z);
230 triangle.v2.X = fRound(triangle.v2.X);
231 triangle.v2.Y = fRound(triangle.v2.Y);
232 triangle.v2.Z = fRound(triangle.v2.Z);
233 triangle.v3.X = fRound(triangle.v3.X);
234 triangle.v3.Y = fRound(triangle.v3.Y);
235 triangle.v3.Z = fRound(triangle.v3.Z);
236
214 if ((triangle.v1.X == triangle.v2.X && triangle.v1.Y == triangle.v2.Y && triangle.v1.Z == triangle.v2.Z) 237 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) 238 || (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) 239 || (triangle.v2.X == triangle.v3.X && triangle.v2.Y == triangle.v3.Y && triangle.v2.Z == triangle.v3.Z)