OSDN Git Service

RAD-278: Floating point bug in 3D renderer [for europeans]
authorLatif Khalifa <latifer@streamgrid.net>
Fri, 12 Aug 2011 16:15:38 +0000 (16:15 +0000)
committerLatif Khalifa <latifer@streamgrid.net>
Fri, 12 Aug 2011 16:15:38 +0000 (16:15 +0000)
Many thanks to Thijs Wenke for the patch!

git-svn-id: https://radegast.googlecode.com/svn/trunk@1088 f7a694da-4d33-11de-9ad6-1127a62b9fcd

Radegast/GUI/Rendering/RenderingHelpers.cs

index 1937a51..6ac3940 100644 (file)
@@ -372,6 +372,7 @@ namespace Radegast.Rendering
         /// <param name="time">Time since the last call (last frame time in seconds)</param>\r
         public virtual void Step(float time)\r
         {\r
+            // Don't interpolate when parent changes (sit/stand link/unlink)\r
             if (previousParent != BasePrim.ParentID)\r
             {\r
                 previousParent = BasePrim.ParentID;\r
@@ -2668,17 +2669,17 @@ namespace Radegast.Rendering
 \r
             string pos = bone.Attributes.GetNamedItem("pos").Value;\r
             string[] posparts = pos.Split(' ');\r
-            b.pos = new Vector3(float.Parse(posparts[0]), float.Parse(posparts[1]), float.Parse(posparts[2]));\r
+            b.pos = new Vector3(float.Parse(posparts[0], Utils.EnUsCulture), float.Parse(posparts[1], Utils.EnUsCulture), float.Parse(posparts[2], Utils.EnUsCulture));\r
             b.orig_pos = new Vector3(b.pos);\r
 \r
             string rot = bone.Attributes.GetNamedItem("rot").Value;\r
             string[] rotparts = rot.Split(' ');\r
-            b.rot = Quaternion.CreateFromEulers((float)(float.Parse(rotparts[0]) * Math.PI / 180f), (float)(float.Parse(rotparts[1]) * Math.PI / 180f), (float)(float.Parse(rotparts[2]) * Math.PI / 180f));\r
+            b.rot = Quaternion.CreateFromEulers((float)(float.Parse(rotparts[0], Utils.EnUsCulture) * Math.PI / 180f), (float)(float.Parse(rotparts[1], Utils.EnUsCulture) * Math.PI / 180f), (float)(float.Parse(rotparts[2], Utils.EnUsCulture) * Math.PI / 180f));\r
             b.orig_rot = new Quaternion(b.rot);\r
 \r
             string scale = bone.Attributes.GetNamedItem("scale").Value;\r
             string[] scaleparts = scale.Split(' ');\r
-            b.scale = new Vector3(float.Parse(scaleparts[0]), float.Parse(scaleparts[1]), float.Parse(scaleparts[2]));\r
+            b.scale = new Vector3(float.Parse(scaleparts[0], Utils.EnUsCulture), float.Parse(scaleparts[1], Utils.EnUsCulture), float.Parse(scaleparts[2], Utils.EnUsCulture));\r
             b.orig_scale = new Vector3(b.scale);\r
 \r
             float[] deform = Math3D.CreateSRTMatrix(new Vector3(1, 1, 1), b.rot, b.orig_pos);\r
@@ -3005,8 +3006,8 @@ namespace Radegast.Rendering
             if (node.Attributes.GetNamedItem("wearable") != null)\r
                 Wearable = node.Attributes.GetNamedItem("wearable").Value;\r
 \r
-            MinValue = float.Parse(node.Attributes.GetNamedItem("value_min").Value);\r
-            MaxValue = float.Parse(node.Attributes.GetNamedItem("value_max").Value);\r
+            MinValue = float.Parse(node.Attributes.GetNamedItem("value_min").Value, Utils.EnUsCulture);\r
+            MaxValue = float.Parse(node.Attributes.GetNamedItem("value_max").Value, Utils.EnUsCulture);\r
 \r
             // These do not exists for driven parameters\r
             if (node.Attributes.GetNamedItem("label_min") != null)\r
@@ -3174,10 +3175,10 @@ namespace Radegast.Rendering
                     XmlNode param = node.Attributes.GetNamedItem("max1");\r
                     if (param != null)\r
                     {\r
-                        d.max1 = float.Parse(param.Value);\r
-                        d.max2 = float.Parse(node.Attributes.GetNamedItem("max2").Value);\r
-                        d.min1 = float.Parse(node.Attributes.GetNamedItem("min1").Value);\r
-                        d.max2 = float.Parse(node.Attributes.GetNamedItem("min2").Value);\r
+                        d.max1 = float.Parse(param.Value, Utils.EnUsCulture);\r
+                        d.max2 = float.Parse(node.Attributes.GetNamedItem("max2").Value, Utils.EnUsCulture);\r
+                        d.min1 = float.Parse(node.Attributes.GetNamedItem("min1").Value, Utils.EnUsCulture);\r
+                        d.max2 = float.Parse(node.Attributes.GetNamedItem("min2").Value, Utils.EnUsCulture);\r
                         d.hasMinMax = true;\r
                     }\r
                     else\r
@@ -3194,7 +3195,7 @@ namespace Radegast.Rendering
         public static Vector3 XmlParseVector(string data)\r
         {\r
             string[] posparts = data.Split(' ');\r
-            return new Vector3(float.Parse(posparts[0]), float.Parse(posparts[1]), float.Parse(posparts[2]));\r
+            return new Vector3(float.Parse(posparts[0], Utils.EnUsCulture), float.Parse(posparts[1], Utils.EnUsCulture), float.Parse(posparts[2], Utils.EnUsCulture));\r
         }\r
 \r
         public static Quaternion XmlParseRotation(string data)\r