From f21d9908200b4bb21f8002e9c87968767ab77bdb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 2 Dec 2012 05:02:33 +0000 Subject: [PATCH] fix vertex rounding direction --- OpenSim/Region/Physics/UbitMeshing/Mesh.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Physics/UbitMeshing/Mesh.cs b/OpenSim/Region/Physics/UbitMeshing/Mesh.cs index 0476b28455..b67422f5e3 100644 --- a/OpenSim/Region/Physics/UbitMeshing/Mesh.cs +++ b/OpenSim/Region/Physics/UbitMeshing/Mesh.cs @@ -207,7 +207,14 @@ namespace OpenSim.Region.Physics.Meshing private float fRound(float f) { - int i = (int)(1e5f * f +0.5f); + int i; + if (f == 0f) + return f; + else if (f > 0f) + i = (int)(1e5f * f + 0.5f); + else + i = (int)(1e5f * f - 0.5f); + return ((float)i * 1e-5f); }