diff options
author | Melanie | 2012-12-03 19:46:16 +0100 |
---|---|---|
committer | Melanie | 2012-12-03 19:46:16 +0100 |
commit | b7c3a4fa7f0dd65027f360d0379ce1f633a9d6ef (patch) | |
tree | ade7248fe85aa3c1f5702aa767809dd6e95dc6c3 /OpenSim/Region/Physics/UbitMeshing | |
parent | Merge branch 'avination' into ubitwork (diff) | |
parent | *TEST* diferent avatar collider (diff) | |
download | opensim-SC_OLD-b7c3a4fa7f0dd65027f360d0379ce1f633a9d6ef.zip opensim-SC_OLD-b7c3a4fa7f0dd65027f360d0379ce1f633a9d6ef.tar.gz opensim-SC_OLD-b7c3a4fa7f0dd65027f360d0379ce1f633a9d6ef.tar.bz2 opensim-SC_OLD-b7c3a4fa7f0dd65027f360d0379ce1f633a9d6ef.tar.xz |
Merge branch 'avination' into ubitwork
Diffstat (limited to 'OpenSim/Region/Physics/UbitMeshing')
-rw-r--r-- | OpenSim/Region/Physics/UbitMeshing/Mesh.cs | 23 |
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) |