Bladeren bron

Added GLStrToFloatDef in GLS.Utils by PAL to fix problem with decimal separator in not En-US configurations
Decimal separator in text descriptions of meshes for import/export is always '.' char
But in System.SysUtils.TextToFloat is Windows char, maybe ',' or others...

GLScene 2 jaren geleden
bovenliggende
commit
0eef9e5a66

+ 2 - 2
Packages/GLScene_Cg_DT.dproj

@@ -165,12 +165,12 @@
                         <Overwrite>true</Overwrite>
                     </Platform>
                 </DeployFile>
-                <DeployFile LocalName="$(BDS)\Redist\iossimulator\libPCRE.dylib" Class="DependencyModule">
+                <DeployFile LocalName="$(BDS)\Redist\iossimulator\libpcre.dylib" Class="DependencyModule">
                     <Platform Name="iOSSimulator">
                         <Overwrite>true</Overwrite>
                     </Platform>
                 </DeployFile>
-                <DeployFile LocalName="$(BDS)\Redist\iossimulator\libpcre.dylib" Class="DependencyModule">
+                <DeployFile LocalName="$(BDS)\Redist\iossimulator\libPCRE.dylib" Class="DependencyModule">
                     <Platform Name="iOSSimulator">
                         <Overwrite>true</Overwrite>
                     </Platform>

+ 4 - 3
Source/Formats.VRML.pas

@@ -16,7 +16,8 @@ uses
 
   GLS.VectorGeometry,
   GLS.VectorTypes,
-  GLS.VectorLists;
+  GLS.VectorLists,
+  GLS.Utils;
 
 type
   TVRMLNode = class
@@ -413,7 +414,7 @@ end;
 
 function TVRMLParser.ReadSingle: Single;
 begin
-  Result := StrToFloatDef(ReadToken, 0);
+  Result := GLStrToFloatDef(ReadToken, 0);
 end;
 
 function TVRMLParser.ReadVector3f: TVector3f;
@@ -450,7 +451,7 @@ begin
       exit
     else if token <> ']' then
       TVRMLSingleArray(FCurrentNode)
-        .Values.Add(StrToFloatDef(token, 0));
+        .Values.Add(GLStrToFloatDef(token, 0));
   until token = ']';
 
   FCurrentNode := FCurrentNode.Parent;

+ 15 - 14
Source/Formats.X.pas

@@ -16,7 +16,8 @@ uses
   GLS.VectorTypes,
   GLS.VectorGeometry,
   GLS.VectorLists,
-  GLS.PersistentClasses;
+  GLS.PersistentClasses,
+  GLS.Utils;
 
 type
   TDXNode = class;
@@ -256,7 +257,7 @@ var
     if ContainsEnd(str) then
       str := StringReplace(str, '}', '', [rfReplaceAll]);
 
-    Result := StrToFloatDef(str, 0);
+    Result := GLStrToFloatDef(str, 0);
   end;
 
   function ReadMatrix: TGLMatrix;
@@ -284,13 +285,13 @@ var
     TempBuffer.CommaText := str;
     if TempBuffer.Count > 1 then
     begin
-      Result.X := StrToFloatDef(TempBuffer[0], 0);
-      Result.Y := StrToFloatDef(TempBuffer[1], 0);
-      Result.Z := StrToFloatDef(TempBuffer[2], 0);
+      Result.X := GLStrToFloatDef(TempBuffer[0], 0);
+      Result.Y := GLStrToFloatDef(TempBuffer[1], 0);
+      Result.Z := GLStrToFloatDef(TempBuffer[2], 0);
     end
     else
     begin
-      Result.X := StrToFloatDef(TempBuffer[0], 0);
+      Result.X := GLStrToFloatDef(TempBuffer[0], 0);
       Result.Y := ReadSingle;
       Result.Z := ReadSingle;
     end;
@@ -305,14 +306,14 @@ var
     TempBuffer.CommaText := str;
     if TempBuffer.Count > 1 then
     begin
-      Result.X := StrToFloatDef(TempBuffer[0], 0);
-      Result.Y := StrToFloatDef(TempBuffer[1], 0);
-      Result.Z := StrToFloatDef(TempBuffer[2], 0);
-      Result.W := StrToFloatDef(TempBuffer[3], 0);
+      Result.X := GLStrToFloatDef(TempBuffer[0], 0);
+      Result.Y := GLStrToFloatDef(TempBuffer[1], 0);
+      Result.Z := GLStrToFloatDef(TempBuffer[2], 0);
+      Result.W := GLStrToFloatDef(TempBuffer[3], 0);
     end
     else
     begin
-      Result.X := StrToFloatDef(TempBuffer[0], 0);
+      Result.X := GLStrToFloatDef(TempBuffer[0], 0);
       Result.Y := ReadSingle;
       Result.Z := ReadSingle;
       Result.W := ReadSingle;
@@ -328,12 +329,12 @@ var
     TempBuffer.CommaText := str;
     if TempBuffer.Count > 1 then
     begin
-      Result.X := StrToFloatDef(TempBuffer[0], 0);
-      Result.Y := StrToFloatDef(TempBuffer[1], 0);
+      Result.X := GLStrToFloatDef(TempBuffer[0], 0);
+      Result.Y := GLStrToFloatDef(TempBuffer[1], 0);
     end
     else
     begin
-      Result.X := StrToFloatDef(TempBuffer[0], 0);
+      Result.X := GLStrToFloatDef(TempBuffer[0], 0);
       Result.Y := ReadSingle;
     end;
     Result.Z := 0;

+ 9 - 8
Source/GLS.Color.pas

@@ -20,7 +20,8 @@ uses
   GLS.VectorTypes,
   GLS.VectorGeometry,
   GLS.PersistentClasses,
-  GLS.BaseClasses;
+  GLS.BaseClasses,
+  GLS.Utils;
 
 type
   PGLColorVector = ^TGLColorVector;
@@ -754,31 +755,31 @@ begin
         delimiter := Pos(' ', workCopy);
         if (Length(workCopy) > 0) and (delimiter > 0) then
         begin
-          Result.X := StrToFloat(Copy(workCopy, 1, delimiter - 1));
+          Result.X := GLStrToFloatDef(Copy(workCopy, 1, delimiter - 1));
           System.Delete(workCopy, 1, delimiter);
           workCopy := TrimLeft(workCopy);
           delimiter := Pos(' ', workCopy);
           if (Length(workCopy) > 0) and (delimiter > 0) then
           begin
-            Result.Y := StrToFloat(Copy(workCopy, 1, delimiter - 1));
+            Result.Y := GLStrToFloatDef(Copy(workCopy, 1, delimiter - 1));
             System.Delete(workCopy, 1, delimiter);
             workCopy := TrimLeft(workCopy);
             delimiter := Pos(' ', workCopy);
             if (Length(workCopy) > 0) and (delimiter > 0) then
             begin
-              Result.Z := StrToFloat(Copy(workCopy, 1, delimiter - 1));
+              Result.Z := GLStrToFloatDef(Copy(workCopy, 1, delimiter - 1));
               System.Delete(workCopy, 1, delimiter);
               workCopy := TrimLeft(workCopy);
-              Result.W := StrToFloat(workCopy);
+              Result.W := GLStrToFloatDef(workCopy);
             end
             else
-              Result.Z := StrToFloat(workCopy);
+              Result.Z := GLStrToFloatDef(workCopy);
           end
           else
-            Result.Y := StrToFloat(workCopy);
+            Result.Y := GLStrToFloatDef(workCopy);
         end
         else
-          Result.X := StrToFloat(workCopy);
+          Result.X := GLStrToFloatDef(workCopy);
       except
         ShowMessage('Wrong vector format. Use: ''<red green blue alpha>''!');
         Abort;

+ 5 - 4
Source/GLS.FileASE.pas

@@ -18,7 +18,8 @@ uses
   GLS.VectorGeometry, 
   GLS.VectorLists,
   GLS.Texture,
-  GLS.Material;
+  GLS.Material,
+  GLS.Utils;
 
 const
   GL_ASE_MAX_TEXURE_CHANNELS = 12; // maximum texture channels
@@ -599,13 +600,13 @@ end;
 
 function StringToFloatRegular(aValue: string): Double;
 begin
-  Result := StrToFloatDef(aValue, 0);
+  Result := GLStrToFloatDef(aValue, 0);
   if Result = 0 then begin
     ChangeDotToComma(aValue);
-    Result := StrToFloatDef(aValue, 0);
+    Result := GLStrToFloatDef(aValue, 0);
     if Result = 0 then begin
       ChangeCommaToDot(aValue);
-      Result := StrToFloatDef(aValue, 0);
+      Result := GLStrToFloatDef(aValue, 0);
     end;
   end;
 end;

+ 5 - 4
Source/GLS.FileDEL.pas

@@ -18,7 +18,8 @@ uses
   GLS.VectorFileObjects,
   GLS.ApplicationFileIO,
   GLS.VectorGeometry,
-  GLS.VectorTypesExt;
+  GLS.VectorTypesExt,
+  GLS.Utils;
 
 
 type
@@ -96,9 +97,9 @@ begin
         repeat
           Inc(i);
           tl.DelimitedText := sl[i];
-          VertArr[j].X := StrToFloat(tl[0]);
-          VertArr[j].Y := StrToFloat(tl[1]);
-          VertArr[j].Z := StrToFloat(tl[2]);
+          VertArr[j].X := GLStrToFloatDef(tl[0]);
+          VertArr[j].Y := GLStrToFloatDef(tl[1]);
+          VertArr[j].Z := GLStrToFloatDef(tl[2]);
           Inc(j);
         until (j = NVert);
         Inc(i);  

+ 3 - 2
Source/GLS.FileDXF.pas

@@ -25,7 +25,8 @@ uses
   GLS.Scene,
   GLS.Texture,
   GLS.VectorFileObjects,
-  GLS.Material;
+  GLS.Material,
+  GLS.Utils;
 
 type
   TGLDXFVectorFile = class(TGLVectorFile)
@@ -244,7 +245,7 @@ const
     c := FormatSettings.DecimalSeparator;
     FormatSettings.DecimalSeparator := '.';
     S := Trim(ReadLine);
-    result := StrToFloat(S);
+    result := GLStrToFloatDef(S);
     FormatSettings.DecimalSeparator := c;
   end;
 

+ 19 - 18
Source/GLS.FileGLB.pas

@@ -40,6 +40,7 @@ implementation
 // ------------------ TGLGLBVectorFile ------------------
 // ------------------
 
+
 class function TGLBVectorFile.Capabilities: TGLDataFileCapabilities;
 begin
   Result := [dfcRead, dfcWrite];
@@ -157,10 +158,10 @@ begin
           frame.Position.Add(NullVector);
           frame.Rotation.Add(NullVector);
         end;
-        frame.Position.Add(StrToFloatDef(tl[1]),
-          StrToFloatDef(tl[2]), StrToFloatDef(tl[3]));
-        v := AffineVectorMake(StrToFloatDef(tl[4]),
-          StrToFloatDef(tl[5]), StrToFloatDef(tl[6]));
+        frame.Position.Add(GLStrToFloatDef(tl[1]),
+          GLStrToFloatDef(tl[2]), GLStrToFloatDef(tl[3]));
+        v := AffineVectorMake(GLStrToFloatDef(tl[4]),
+          GLStrToFloatDef(tl[5]), GLStrToFloatDef(tl[6]));
         frame.Rotation.Add(v);
         Inc(i);
       end;
@@ -217,18 +218,18 @@ begin
               for j := 0 to weightCount - 1 do
               begin
                 boneIDs[j].boneID := StrToInt(tl[10 + j * 2]);
-                boneIDs[j].Weight := StrToFloatDef(tl[11 + j * 2]);
+                boneIDs[j].Weight := GLStrToFloatDef(tl[11 + j * 2]);
               end;
 
               nVert := FindOrAdd(boneIDs,
-                AffineVectorMake(StrToFloatDef(tl[1]),
-                StrToFloatDef(tl[2]), StrToFloatDef(tl[3])),
-                AffineVectorMake(StrToFloatDef(tl[4]),
-                StrToFloatDef(tl[5]),
-                StrToFloatDef(tl[6])));
+                AffineVectorMake(GLStrToFloatDef(tl[1]),
+                GLStrToFloatDef(tl[2]), GLStrToFloatDef(tl[3])),
+                AffineVectorMake(GLStrToFloatDef(tl[4]),
+                GLStrToFloatDef(tl[5]),
+                GLStrToFloatDef(tl[6])));
               nTex := TexCoords.FindOrAdd
-                (AffineVectorMake(StrToFloatDef(tl[7]),
-                StrToFloatDef(tl[8]), 0));
+                (AffineVectorMake(GLStrToFloatDef(tl[7]),
+                GLStrToFloatDef(tl[8]), 0));
               faceGroup.Add(nVert, nVert, nTex);
               Inc(i);
             end
@@ -237,13 +238,13 @@ begin
               // simple format
               boneID := StrToInt(tl[0]);
               nVert := FindOrAdd(boneID,
-                AffineVectorMake(StrToFloatDef(tl[1]),
-                StrToFloatDef(tl[2]), StrToFloatDef(tl[3])),
-                AffineVectorMake(StrToFloatDef(tl[4]),
-                StrToFloatDef(tl[5]), StrToFloatDef(tl[6])));
+                AffineVectorMake(GLStrToFloatDef(tl[1]),
+                GLStrToFloatDef(tl[2]), GLStrToFloatDef(tl[3])),
+                AffineVectorMake(GLStrToFloatDef(tl[4]),
+                GLStrToFloatDef(tl[5]), GLStrToFloatDef(tl[6])));
               nTex := TexCoords.FindOrAdd
-                (AffineVectorMake(StrToFloatDef(tl[7]),
-                StrToFloatDef(tl[8]), 0));
+                (AffineVectorMake(GLStrToFloatDef(tl[7]),
+                GLStrToFloatDef(tl[8]), 0));
               faceGroup.Add(nVert, nVert, nTex);
               Inc(i);
             end;

+ 17 - 16
Source/GLS.FileGLTF.pas

@@ -19,7 +19,7 @@ uses
   GLS.VectorLists,
   GLS.VectorGeometry,
   GLS.Material,
-
+  GLS.Utils,
   PasGLTF;
 
 type
@@ -40,6 +40,7 @@ implementation
 // ------------------ TGLTFVectorFile ------------------
 // ------------------
 
+
 class function TGLTFVectorFile.Capabilities: TGLDataFileCapabilities;
 begin
   Result := [dfcRead, dfcWrite];
@@ -154,10 +155,10 @@ begin
           frame.Position.Add(NullVector);
           frame.Rotation.Add(NullVector);
         end;
-        frame.Position.Add(StrToFloatDef(tl[1],0),
-          StrToFloatDef(tl[2],0), StrToFloatDef(tl[3],0));
-        v := AffineVectorMake(StrToFloatDef(tl[4],0),
-          StrToFloatDef(tl[5],0), StrToFloatDef(tl[6],0));
+        frame.Position.Add(GLStrToFloatDef(tl[1],0),
+          GLStrToFloatDef(tl[2],0), GLStrToFloatDef(tl[3],0));
+        v := AffineVectorMake(GLStrToFloatDef(tl[4],0),
+          GLStrToFloatDef(tl[5],0), GLStrToFloatDef(tl[6],0));
         frame.Rotation.Add(v);
         Inc(i);
       end;
@@ -214,16 +215,16 @@ begin
               for j := 0 to weightCount - 1 do
               begin
                 boneIDs[j].boneID := StrToInt(tl[10 + j * 2]);
-                boneIDs[j].Weight := StrToFloatDef(tl[11 + j * 2],0);
+                boneIDs[j].Weight := GLStrToFloatDef(tl[11 + j * 2],0);
               end;
 
               nVert := FindOrAdd(boneIDs,
-                AffineVectorMake(StrToFloatDef(tl[1],0),
-                StrToFloatDef(tl[2],0), StrToFloatDef(tl[3],0)),
-                AffineVectorMake(StrToFloatDef(tl[4],0),
-                StrToFloatDef(tl[5],0), StrToFloatDef(tl[6],0)));
+                AffineVectorMake(GLStrToFloatDef(tl[1],0),
+                GLStrToFloatDef(tl[2],0), GLStrToFloatDef(tl[3],0)),
+                AffineVectorMake(GLStrToFloatDef(tl[4],0),
+                GLStrToFloatDef(tl[5],0), GLStrToFloatDef(tl[6],0)));
               nTex := TexCoords.FindOrAdd
-                (AffineVectorMake(StrToFloatDef(tl[7],0), StrToFloatDef(tl[8],0),0));
+                (AffineVectorMake(GLStrToFloatDef(tl[7],0), GLStrToFloatDef(tl[8],0),0));
               faceGroup.Add(nVert, nVert, nTex);
               Inc(i);
             end
@@ -232,12 +233,12 @@ begin
               // simple format
               boneID := StrToInt(tl[0]);
               nVert := FindOrAdd(boneID,
-                AffineVectorMake(StrToFloatDef(tl[1],0),
-                StrToFloatDef(tl[2],0), StrToFloatDef(tl[3],0)),
-                AffineVectorMake(StrToFloatDef(tl[4],0),
-                StrToFloatDef(tl[5],8), StrToFloatDef(tl[6],0)));
+                AffineVectorMake(GLStrToFloatDef(tl[1],0),
+                GLStrToFloatDef(tl[2],0), GLStrToFloatDef(tl[3],0)),
+                AffineVectorMake(GLStrToFloatDef(tl[4],0),
+                GLStrToFloatDef(tl[5],8), GLStrToFloatDef(tl[6],0)));
               nTex := TexCoords.FindOrAdd
-                (AffineVectorMake(StrToFloatDef(tl[7],0), StrToFloatDef(tl[8],0), 0));
+                (AffineVectorMake(GLStrToFloatDef(tl[7],0), GLStrToFloatDef(tl[8],0), 0));
               faceGroup.Add(nVert, nVert, nTex);
               Inc(i);
             end;

+ 14 - 13
Source/GLS.FileGRD.pas

@@ -17,7 +17,8 @@ uses
   GLS.VectorTypes,
   GLS.VectorFileObjects,
   GLS.ApplicationFileIO,
-  GLS.Graph;
+  GLS.Graph,
+  GLS.Utils;
 
 type
   (* The GRD file represents ascii grid formats in 2D/3D.
@@ -146,16 +147,16 @@ begin
       Ny := StrToInt(Tl[1]);
 
       TL.DelimitedText := ReadLine;
-      Xo := StrToFloat(Tl[0]);
-      Xe := StrToFloat(Tl[1]);
+      Xo := GLStrToFloatDef(Tl[0]);
+      Xe := GLStrToFloatDef(Tl[1]);
 
       TL.DelimitedText := ReadLine;
-      Yo := StrToFloat(Tl[0]);
-      Ye := StrToFloat(Tl[1]);
+      Yo := GLStrToFloatDef(Tl[0]);
+      Ye := GLStrToFloatDef(Tl[1]);
 
       TL.DelimitedText := ReadLine;
-      Zo := StrToFloat(Tl[0]);
-      Ze := StrToFloat(Tl[1]);
+      Zo := GLStrToFloatDef(Tl[0]);
+      Ze := GLStrToFloatDef(Tl[1]);
 
       Dx := (Xe - Xo) / Nx;
       Dy := (Ye - Yo) / Ny;
@@ -179,7 +180,7 @@ begin
           while (StrVal <> '') do
           begin
             if (J <= Nx - 1) then
-              Nodes[I, J] := StrToFloat(StrVal);
+              Nodes[I, J] := GLStrToFloatDef(StrVal);
             if Nodes[I, J] > MaxZ then
               MaxZ := Nodes[I, J];
             if (Nodes[I, J] >= BlankVal) then
@@ -201,14 +202,14 @@ begin
       TL.DelimitedText := SL[1];
       Nx := StrToInt(TL[1]); // nrows
       TL.DelimitedText := SL[2];
-      Xo := StrToFloat(Tl[1]); // xllcorner
+      Xo := GLStrToFloatDef(Tl[1]); // xllcorner
       TL.DelimitedText := SL[3];
-      Yo := StrToFloat(TL[1]); // yllcorner
+      Yo := GLStrToFloatDef(TL[1]); // yllcorner
       TL.DelimitedText := Sl[4];
-      Dx := StrToFloat(TL[1]);
+      Dx := GLStrToFloatDef(TL[1]);
       Dy := Dx; // cellsize
       TL.DelimitedText := SL[5];
-      NoData := StrToFloat(TL[1]); // NoData value
+      NoData := GLStrToFloatDef(TL[1]); // NoData value
 
       MaxZ := -3 * 10E38;
       SetLength(Nodes, Nx, Ny);
@@ -219,7 +220,7 @@ begin
         for J := 0 to Ny - 1 do
         begin
           StrVal := TL[J];
-          Nodes[I, J] := StrToFloat(StrVal);
+          Nodes[I, J] := GLStrToFloatDef(StrVal);
           if Nodes[I, J] > MaxZ then
             MaxZ := Nodes[I, J];
         end;

+ 24 - 24
Source/GLS.FileMD5.pas

@@ -136,13 +136,13 @@ procedure TGLMD5VectorFile.LoadFromStream(aStream: TStream);
     bonename := FTempString[0];
     ParentBoneID := StrToInt(FTempString[1]);
 
-    pos.X := StrToFloatDef(FTempString[2]);
-    pos.Y := StrToFloatDef(FTempString[4]);
-    pos.Z := StrToFloatDef(FTempString[3]);
+    pos.X := GLStrToFloatDef(FTempString[2]);
+    pos.Y := GLStrToFloatDef(FTempString[4]);
+    pos.Z := GLStrToFloatDef(FTempString[3]);
 
-    quat := QuaternionMakeFromImag(StrToFloatDef(FTempString[5]),
-      StrToFloatDef(FTempString[7]),
-      StrToFloatDef(FTempString[6]));
+    quat := QuaternionMakeFromImag(GLStrToFloatDef(FTempString[5]),
+      GLStrToFloatDef(FTempString[7]),
+      GLStrToFloatDef(FTempString[6]));
 
     FFramePositions.Add(pos);
     FFrameQuaternions.Add(quat);
@@ -247,8 +247,8 @@ procedure TGLMD5VectorFile.LoadFromStream(aStream: TStream);
           begin
             vnum := StrToInt(FTempString[1]);
             mesh.TexCoords[vnum] :=
-              AffineVectorMake(StrToFloatDef(FTempString[2]),
-              1 - StrToFloatDef(FTempString[3]), 0);
+              AffineVectorMake(GLStrToFloatDef(FTempString[2]),
+              1 - GLStrToFloatDef(FTempString[3]), 0);
             VertexWeightID[vnum] := StrToInt(FTempString[4]);
             VertexWeightCount[vnum] := StrToInt(FTempString[5]);
             if VertexWeightCount[vnum] > mesh.BonesPerVertex then
@@ -281,11 +281,11 @@ procedure TGLMD5VectorFile.LoadFromStream(aStream: TStream);
           begin
             wnum := StrToInt(FTempString[1]);
             VertexBoneRef[wnum] := StrToInt(FTempString[2]);
-            VertexWeight[wnum] := StrToFloatDef(FTempString[3]);
+            VertexWeight[wnum] := GLStrToFloatDef(FTempString[3]);
             VertexWeighted[wnum] :=
-              AffineVectorMake(StrToFloatDef(FTempString[4]),
-              StrToFloatDef(FTempString[6]),
-              StrToFloatDef(FTempString[5]));
+              AffineVectorMake(GLStrToFloatDef(FTempString[4]),
+              GLStrToFloatDef(FTempString[6]),
+              GLStrToFloatDef(FTempString[5]));
           end;
         end;
       end;
@@ -363,12 +363,12 @@ procedure TGLMD5VectorFile.LoadFromStream(aStream: TStream);
       FTempString.CommaText := temp;
       if FTempString.Count >= 6 then
       begin
-        pos := AffineVectorMake(StrToFloatDef(FTempString[0]),
-          StrToFloatDef(FTempString[1]),
-          StrToFloatDef(FTempString[2]));
-        quat := QuaternionMakeFromImag(StrToFloatDef(FTempString[3]),
-          StrToFloatDef(FTempString[4]),
-          StrToFloatDef(FTempString[5]));
+        pos := AffineVectorMake(GLStrToFloatDef(FTempString[0]),
+          GLStrToFloatDef(FTempString[1]),
+          GLStrToFloatDef(FTempString[2]));
+        quat := QuaternionMakeFromImag(GLStrToFloatDef(FTempString[3]),
+          GLStrToFloatDef(FTempString[4]),
+          GLStrToFloatDef(FTempString[5]));
         FFramePositions.Add(pos);
         FFrameQuaternions.Add(quat);
       end;
@@ -400,32 +400,32 @@ procedure TGLMD5VectorFile.LoadFromStream(aStream: TStream);
 
         if FJointFlags[i] and 1 > 0 then
         begin
-          pos.X := StrToFloatDef(FTempString[j]);
+          pos.X := GLStrToFloatDef(FTempString[j]);
           Inc(j);
         end;
         if FJointFlags[i] and 2 > 0 then
         begin
-          pos.Y := StrToFloatDef(FTempString[j]);
+          pos.Y := GLStrToFloatDef(FTempString[j]);
           Inc(j);
         end;
         if FJointFlags[i] and 4 > 0 then
         begin
-          pos.Z := StrToFloatDef(FTempString[j]);
+          pos.Z := GLStrToFloatDef(FTempString[j]);
           Inc(j);
         end;
 
         if FJointFlags[i] and 8 > 0 then
         begin
-          quat.ImagPart.X := StrToFloatDef(FTempString[j]);
+          quat.ImagPart.X := GLStrToFloatDef(FTempString[j]);
           Inc(j);
         end;
         if FJointFlags[i] and 16 > 0 then
         begin
-          quat.ImagPart.Y := StrToFloatDef(FTempString[j]);
+          quat.ImagPart.Y := GLStrToFloatDef(FTempString[j]);
           Inc(j);
         end;
         if FJointFlags[i] and 32 > 0 then
-          quat.ImagPart.Z := StrToFloatDef(FTempString[j]);
+          quat.ImagPart.Z := GLStrToFloatDef(FTempString[j]);
       end;
 
       pos := AffineVectorMake(pos.X, pos.Z, pos.Y);

+ 6 - 5
Source/GLS.FileNurbs.pas

@@ -17,7 +17,8 @@ uses
   GLS.VectorGeometry,
   GLS.VectorLists,
   GLS.ApplicationFileIO,
-  GLS.ParametricSurfaces;
+  GLS.ParametricSurfaces,
+  GLS.Utils;
 
 type
 
@@ -69,7 +70,7 @@ procedure TGLNurbsVectorFile.LoadFromStream(stream: TStream);
         vals.CommaText := buf;
         for k := 0 to vals.Count - 1 do
           if vals[k] <> '' then
-            list.Add(StrToFloatDef(vals[k], 0));
+            list.Add(GLStrToFloatDef(vals[k], 0));
         Inc(idx);
       end;
       Result := idx;
@@ -93,9 +94,9 @@ procedure TGLNurbsVectorFile.LoadFromStream(stream: TStream);
           Break;
         vals.CommaText := buf;
         if vals.Count >= 3 then
-          list.Add(StrToFloatDef(vals[0], 0),
-            StrToFloatDef(vals[1], 0),
-            StrToFloatDef(vals[2], 0));
+          list.Add(GLStrToFloatDef(vals[0], 0),
+            GLStrToFloatDef(vals[1], 0),
+            GLStrToFloatDef(vals[2], 0));
         Inc(idx);
       end;
       Result := idx;

+ 5 - 4
Source/GLS.FileOBJ.pas

@@ -25,12 +25,13 @@ uses
   GLS.PersistentClasses,
   GLS.VectorGeometry,
   GLS.Scene,  
-  GLS.VectorFileObjects, 
+  GLS.VectorFileObjects,
   GLS.VectorLists,  
   GLS.Texture,  
   GLS.Color,
   GLS.RenderContextInfo, 
-  GLS.Material;
+  GLS.Material,
+  GLS.Utils;
 
 const
   // Load input data in chunks of BufSize Bytes. 
@@ -811,7 +812,7 @@ var
               begin
                 Ambient.Color := objMtl.MaterialVectorProperty(matName, 'Ka', clrGray20);
                 Diffuse.Color := objMtl.MaterialVectorProperty(matName, 'Kd', clrGray80);
-                Diffuse.Alpha := StrToFloatDef(objMtl.MaterialStringProperty(matName, 'd'), 1);
+                Diffuse.Alpha := GLStrToFloatDef(objMtl.MaterialStringProperty(matName, 'd'), 1);
                 if Diffuse.Alpha < 1 then
                   libMat.Material.BlendingMode := bmTransparency;
                 case StrToIntDef(objMtl.MaterialStringProperty(matName, 'illum'), 1) of
@@ -1363,7 +1364,7 @@ begin
       Result := NullHmgVector;
       for i := 0 to 3 do
         if sl.Count > i then
-          Result.V[i] := StrToFloatDef(sl[i], 0)
+          Result.V[i] := GLStrToFloatDef(sl[i], 0)
         else
           Break;
     end

+ 1 - 1
Source/GLS.FilePLY.pas

@@ -79,7 +79,7 @@ begin
     begin
       p := PChar(sl[i]);
       mesh.Vertices.Add(ParseFloat(p), ParseFloat(p), ParseFloat(p));
-      // AffineVectorMake(StrToFloatDef(tl[0]), StrToFloatDef(tl[1]), StrToFloatDef(tl[2])));}
+      // AffineVectorMake(GLStrToFloatDef(tl[0]), GLStrToFloatDef(tl[1]), GLStrToFloatDef(tl[2])));}
       Dec(nbVertices);
       Inc(i);
     end;

+ 19 - 23
Source/GLS.FileSMD.pas

@@ -19,7 +19,8 @@ uses
   GLS.VectorTypes,
   GLS.VectorGeometry,
   GLS.Material,
-  GLS.Strings;
+  GLS.Strings,
+  GLS.Utils;
 
 type
   (* The SMD vector file is Half-life's skeleton format.
@@ -35,9 +36,6 @@ type
     procedure SaveToStream(aStream: TStream); override;
   end;
 
-// added to fix problem with decimal separator in non En configurations
-  var fs: TFormatSettings;
-
 // ------------------------------------------------------------------
 implementation
 // ------------------------------------------------------------------
@@ -163,10 +161,10 @@ begin
           frame.Position.Add(NullVector);
           frame.Rotation.Add(NullVector);
         end;
-        frame.Position.Add(StrToFloatDef(tl[1],0,fs),
-          StrToFloatDef(tl[2],0,fs), StrToFloatDef(tl[3],0,fs));
-        v := AffineVectorMake(StrToFloatDef(tl[4],0,fs),
-          StrToFloatDef(tl[5],0,fs), StrToFloatDef(tl[6],0,fs));
+        frame.Position.Add(GLStrToFloatDef(tl[1],0),
+          GLStrToFloatDef(tl[2],0), GLStrToFloatDef(tl[3],0));
+        v := AffineVectorMake(GLStrToFloatDef(tl[4],0),
+          GLStrToFloatDef(tl[5],0), GLStrToFloatDef(tl[6],0));
         frame.Rotation.Add(v);
         Inc(i);
       end;
@@ -223,17 +221,17 @@ begin
               for j := 0 to weightCount - 1 do
               begin
                 boneIDs[j].boneID := StrToInt(tl[10 + j * 2]);
-                boneIDs[j].Weight := StrToFloatDef(tl[11 + j * 2],0,fs);
+                boneIDs[j].Weight := GLStrToFloatDef(tl[11 + j * 2],0);
               end;
 
               nVert := FindOrAdd(boneIDs,
-                AffineVectorMake(StrToFloatDef(tl[1],0,fs),
-                StrToFloatDef(tl[2],0,fs), StrToFloatDef(tl[3],0,fs)),
-                AffineVectorMake(StrToFloatDef(tl[4],0,fs),
-                StrToFloatDef(tl[5],0,fs), StrToFloatDef(tl[6],0,fs)));
+                AffineVectorMake(GLStrToFloatDef(tl[1],0),
+                GLStrToFloatDef(tl[2],0), GLStrToFloatDef(tl[3],0)),
+                AffineVectorMake(GLStrToFloatDef(tl[4],0),
+                GLStrToFloatDef(tl[5],0), GLStrToFloatDef(tl[6],0)));
               nTex := TexCoords.FindOrAdd
-                (AffineVectorMake(StrToFloatDef(tl[7],0,fs),
-                StrToFloatDef(tl[8],0,fs), 0));
+                (AffineVectorMake(GLStrToFloatDef(tl[7],0),
+                GLStrToFloatDef(tl[8],0), 0));
               faceGroup.Add(nVert, nVert, nTex);
               Inc(i);
             end
@@ -242,13 +240,13 @@ begin
               // Half-Life 1 simple format
               boneID := StrToInt(tl[0]);
               nVert := FindOrAdd(boneID,
-                AffineVectorMake(StrToFloatDef(tl[1],0,fs),
-                StrToFloatDef(tl[2],0,fs), StrToFloatDef(tl[3],0,fs)),
-                AffineVectorMake(StrToFloatDef(tl[4],0,fs),
-                StrToFloatDef(tl[5],0,fs), StrToFloatDef(tl[6],0,fs)));
+                AffineVectorMake(GLStrToFloatDef(tl[1],0),
+                GLStrToFloatDef(tl[2],0), GLStrToFloatDef(tl[3],0)),
+                AffineVectorMake(GLStrToFloatDef(tl[4],0),
+                GLStrToFloatDef(tl[5],0), GLStrToFloatDef(tl[6],0)));
               nTex := TexCoords.FindOrAdd
-                (AffineVectorMake(StrToFloatDef(tl[7],0,fs),
-                StrToFloatDef(tl[8],0,fs), 0));
+                (AffineVectorMake(GLStrToFloatDef(tl[7],0),
+                GLStrToFloatDef(tl[8],0), 0));
               faceGroup.Add(nVert, nVert, nTex);
               Inc(i);
             end;
@@ -355,8 +353,6 @@ end;
 initialization
 // ------------------------------------------------------------------
 
-fs.DecimalSeparator := '.';
-
 RegisterVectorFileFormat('smd', 'Half-Life SMD files', TGLSMDVectorFile);
 
 end.

+ 8 - 7
Source/GLS.FileSTL.pas

@@ -24,7 +24,8 @@ uses
   GLS.VectorTypes,
   GLS.VectorGeometry,
   GLS.VectorLists,
-  GLS.VectorFileObjects;
+  GLS.VectorFileObjects,
+  GLS.Utils;
 
 type
   TSTLHeader = packed record
@@ -92,9 +93,9 @@ var
       raise Exception.Create('Invalid Normal')
     else
     begin
-      aNormal.X := StrToFloatDef(Sl[2], 0);
-      aNormal.Y := StrToFloatDef(Sl[3], 0);
-      aNormal.Z := StrToFloatDef(Sl[4], 0);
+      aNormal.X := GLStrToFloatDef(Sl[2], 0);
+      aNormal.Y := GLStrToFloatDef(Sl[3], 0);
+      aNormal.Z := GLStrToFloatDef(Sl[4], 0);
     end;
   end;
 
@@ -105,9 +106,9 @@ var
       raise Exception.Create('Invalid Vertex')
     else
     begin
-      aVertex.X := StrToFloatDef(Sl[1], 0);
-      aVertex.Y := StrToFloatDef(Sl[2], 0);
-      aVertex.Z := StrToFloatDef(Sl[3], 0);
+      aVertex.X := GLStrToFloatDef(Sl[1], 0);
+      aVertex.Y := GLStrToFloatDef(Sl[2], 0);
+      aVertex.Z := GLStrToFloatDef(Sl[3], 0);
     end;
   end;
 

+ 8 - 7
Source/GLS.FileTIN.pas

@@ -17,7 +17,8 @@ uses
   GLS.VectorFileObjects,
   GLS.ApplicationFileIO,
   GLS.VectorGeometry,
-  GLS.VectorTypesExt;
+  GLS.VectorTypesExt,
+  GLS.Utils;
 
 
 type
@@ -75,9 +76,9 @@ begin
         Trim(tl.CommaText);
         if tl.Count = 9 then
         begin
-            SetVector(v1, StrToFloatDef(tl[0],0), StrToFloatDef(tl[1],0), StrToFloatDef(tl[2],0));
-            SetVector(v2, StrToFloatDef(tl[3],0), StrToFloatDef(tl[4],0), StrToFloatDef(tl[5],0));
-            SetVector(v3, StrToFloatDef(tl[6],0), StrToFloatDef(tl[7],0), StrToFloatDef(tl[8],0));
+            SetVector(v1, GLStrToFloatDef(tl[0],0), GLStrToFloatDef(tl[1],0), GLStrToFloatDef(tl[2],0));
+            SetVector(v2, GLStrToFloatDef(tl[3],0), GLStrToFloatDef(tl[4],0), GLStrToFloatDef(tl[5],0));
+            SetVector(v3, GLStrToFloatDef(tl[6],0), GLStrToFloatDef(tl[7],0), GLStrToFloatDef(tl[8],0));
             mesh.Vertices.Add(v1, v2, v3);
             n := CalcPlaneNormal(v1, v2, v3);
             mesh.Normals.Add(n, n, n);
@@ -109,9 +110,9 @@ begin
         repeat
           Inc(i);
           tl.DelimitedText := sl[i];
-          VertArr[j].X := StrToFloat(tl[0]);
-          VertArr[j].Y := StrToFloat(tl[1]);
-          VertArr[j].Z := StrToFloat(tl[2]);
+          VertArr[j].X := GLStrToFloatDef(tl[0]);
+          VertArr[j].Y := GLStrToFloatDef(tl[1]);
+          VertArr[j].Z := GLStrToFloatDef(tl[2]);
           Inc(j);
         until (j = NVert);
         Inc(i);  

+ 8 - 7
Source/GLS.FileVOR.pas

@@ -16,7 +16,8 @@ uses
   GLS.VectorTypes,
   GLS.VectorGeometry,
   GLS.VectorLists,
-  GLS.VectorFileObjects;
+  GLS.VectorFileObjects,
+  GLS.Utils;
 
 type
   TVORHeader = packed record
@@ -80,9 +81,9 @@ var
       raise Exception.Create('Invalid Normal')
     else
     begin
-      aNormal.X := StrToFloatDef(Sl[2], 0);
-      aNormal.Y := StrToFloatDef(Sl[3], 0);
-      aNormal.Z := StrToFloatDef(Sl[4], 0);
+      aNormal.X := GLStrToFloatDef(Sl[2], 0);
+      aNormal.Y := GLStrToFloatDef(Sl[3], 0);
+      aNormal.Z := GLStrToFloatDef(Sl[4], 0);
     end;
   end;
 
@@ -93,9 +94,9 @@ var
       raise Exception.Create('Invalid Vertex')
     else
     begin
-      aVertex.X := StrToFloatDef(Sl[1], 0);
-      aVertex.Y := StrToFloatDef(Sl[2], 0);
-      aVertex.Z := StrToFloatDef(Sl[3], 0);
+      aVertex.X := GLStrToFloatDef(Sl[1], 0);
+      aVertex.Y := GLStrToFloatDef(Sl[2], 0);
+      aVertex.Z := GLStrToFloatDef(Sl[3], 0);
     end;
   end;
 

+ 14 - 14
Source/GLS.MaterialScript.pas

@@ -409,14 +409,14 @@ begin
   Val := ExtractValue;
   if pos('(', Val) > 0 then
   begin
-    TmpColor.Alpha := StrToFloatDef(copy(Val, pos('(', Val) + 1,
+    TmpColor.Alpha := GLStrToFloatDef(copy(Val, pos('(', Val) + 1,
       pos(';', Val) - 2));
     delete(Val, 1, pos(';', Val));
-    TmpColor.Red := StrToFloatDef(copy(Val, 1, pos(';', Val) - 1));
+    TmpColor.Red := GLStrToFloatDef(copy(Val, 1, pos(';', Val) - 1));
     delete(Val, 1, pos(';', Val));
-    TmpColor.Green := StrToFloatDef(copy(Val, 1, pos(';', Val) - 1));
+    TmpColor.Green := GLStrToFloatDef(copy(Val, 1, pos(';', Val) - 1));
     delete(Val, 1, pos(';', Val));
-    TmpColor.Blue := StrToFloatDef(copy(Val, 1, pos(')', Val) - 1));
+    TmpColor.Blue := GLStrToFloatDef(copy(Val, 1, pos(')', Val) - 1));
   end;
 end;
 
@@ -427,12 +427,12 @@ begin
   Val := ExtractValue;
   if pos('(', Val) > 0 then
   begin
-    TmpCoords.X := StrToFloatDef(copy(Val, pos('(', Val) + 1,
+    TmpCoords.X := GLStrToFloatDef(copy(Val, pos('(', Val) + 1,
       pos(';', Val) - 2));
     delete(Val, 1, pos(';', Val));
-    TmpCoords.Y := StrToFloatDef(copy(Val, 1, pos(';', Val) - 1));
+    TmpCoords.Y := GLStrToFloatDef(copy(Val, 1, pos(';', Val) - 1));
     delete(Val, 1, pos(';', Val));
-    TmpCoords.Z := StrToFloatDef(copy(Val, 1, pos(')', Val) - 1));
+    TmpCoords.Z := GLStrToFloatDef(copy(Val, 1, pos(')', Val) - 1));
   end;
 end;
 
@@ -443,14 +443,14 @@ begin
   Val := ExtractValue;
   if pos('(', Val) > 0 then
   begin
-    TmpCoords4.W := StrToFloatDef(copy(Val, pos('(', Val) + 1,
+    TmpCoords4.W := GLStrToFloatDef(copy(Val, pos('(', Val) + 1,
       pos(';', Val) - 2));
     delete(Val, 1, pos(';', Val));
-    TmpCoords4.X := StrToFloatDef(copy(Val, 1, pos(';', Val) - 1));
+    TmpCoords4.X := GLStrToFloatDef(copy(Val, 1, pos(';', Val) - 1));
     delete(Val, 1, pos(';', Val));
-    TmpCoords4.Y := StrToFloatDef(copy(Val, 1, pos(';', Val) - 1));
+    TmpCoords4.Y := GLStrToFloatDef(copy(Val, 1, pos(';', Val) - 1));
     delete(Val, 1, pos(';', Val));
-    TmpCoords4.Z := StrToFloatDef(copy(Val, 1, pos(')', Val) - 1));
+    TmpCoords4.Z := GLStrToFloatDef(copy(Val, 1, pos(')', Val) - 1));
   end;
 end;
 
@@ -861,14 +861,14 @@ procedure TGLMaterialScripter.XImageBrightness;
 begin
   if ClassExists('imagebrightness') then
     if ExtractValue <> '' then
-      NewMat.Material.Texture.ImageBrightness := StrToFloatDef(ExtractValue);
+      NewMat.Material.Texture.ImageBrightness := GLStrToFloatDef(ExtractValue);
 end;
 
 procedure TGLMaterialScripter.XImageGamma;
 begin
   if ClassExists('imagegamma') then
     if ExtractValue <> '' then
-      NewMat.Material.Texture.ImageGamma := StrToFloatDef(ExtractValue);
+      NewMat.Material.Texture.ImageGamma := GLStrToFloatDef(ExtractValue);
 end;
 
 procedure TGLMaterialScripter.XLibMaterialName;
@@ -998,7 +998,7 @@ procedure TGLMaterialScripter.XNormalMapScale;
 begin
   if ClassExists('normalmapscale') then
     if ExtractValue <> '' then
-      NewMat.Material.Texture.NormalMapScale := StrToFloatDef(ExtractValue);
+      NewMat.Material.Texture.NormalMapScale := GLStrToFloatDef(ExtractValue);
 end;
 
 procedure TGLMaterialScripter.XTexture2Name;

+ 3 - 2
Source/GLS.PersistentClasses.pas

@@ -17,7 +17,8 @@ interface
 uses
   System.Classes,
   System.SysUtils,
-  GLS.Strings;
+  GLS.Strings,
+  GLS.Utils;
 
 type
 
@@ -1631,7 +1632,7 @@ begin
   ReadLine(cVTInteger);
   oldDc := FormatSettings.DecimalSeparator;
   FormatSettings.DecimalSeparator := '.';
-  Result := StrToFloat(FData);
+  Result := GLStrToFloatDef(FData);
   FormatSettings.DecimalSeparator := oldDc;
 end;
 

+ 1 - 0
Source/GLS.TextureImageEditors.pas

@@ -207,6 +207,7 @@ begin
       buf := InputDlg(TGLProcTextureNoise.FriendlyName, 'Minimum Cut', IntToStr(MinCut));
       MinCut := StrToIntDef(buf, 0);
       buf := InputDlg(TGLProcTextureNoise.FriendlyName, 'Noise Sharpness', FloatToStr(NoiseSharpness));
+      //By PAL, this has to be StrToFloatDef using Windows locale because comes from a Dialog
       NoiseSharpness := StrToFloatDef(buf, 0.9);
       buf := InputDlg(TGLProcTextureNoise.FriendlyName, 'Random Seed', IntToStr(NoiseRandSeed));
       NoiseRandSeed := StrToIntDef(buf, 0);

+ 11 - 10
Source/GLS.Tree.pas

@@ -41,7 +41,8 @@ uses
   GLS.PersistentClasses,
   GLS.XOpenGL,
   GLS.Context,
-  GLS.VectorTypes;
+  GLS.VectorTypes,
+  GLS.Utils;
 
 type
   TGLTree = class;
@@ -1215,23 +1216,23 @@ begin
         else if str = 'branch_facets' then
           FBranchFacets := StrToInt(StrParse[1])
         else if str = 'leaf_size' then
-          FLeafSize := StrToFloat(StrParse[1])
+          FLeafSize := GLStrToFloatDef(StrParse[1])
         else if str = 'branch_size' then
-          FBranchSize := StrToFloat(StrParse[1])
+          FBranchSize := GLStrToFloatDef(StrParse[1])
         else if str = 'branch_noise' then
-          FBranchNoise := StrToFloat(StrParse[1])
+          FBranchNoise := GLStrToFloatDef(StrParse[1])
         else if str = 'branch_angle_bias' then
-          FBranchAngleBias := StrToFloat(StrParse[1])
+          FBranchAngleBias := GLStrToFloatDef(StrParse[1])
         else if str = 'branch_angle' then
-          FBranchAngle := StrToFloat(StrParse[1])
+          FBranchAngle := GLStrToFloatDef(StrParse[1])
         else if str = 'branch_twist' then
-          FBranchTwist := StrToFloat(StrParse[1])
+          FBranchTwist := GLStrToFloatDef(StrParse[1])
         else if str = 'branch_radius' then
-          FBranchRadius := StrToFloat(StrParse[1])
+          FBranchRadius := GLStrToFloatDef(StrParse[1])
         else if str = 'leaf_threshold' then
-          FLeafThreshold := StrToFloat(StrParse[1])
+          FLeafThreshold := GLStrToFloatDef(StrParse[1])
         else if str = 'central_leader_bias' then
-          FCentralLeaderBias := StrToFloat(StrParse[1])
+          FCentralLeaderBias := GLStrToFloatDef(StrParse[1])
         else if str = 'central_leader' then
           FCentralLeader := LowerCase(StrParse[1]) = 'true'
         else if str = 'seed' then

+ 32 - 94
Source/GLS.Utils.pas

@@ -2,13 +2,9 @@
 // The graphics rendering engine GLScene http://glscene.org
 //
 unit GLS.Utils;
-
 (* Miscellaneous support utilities & classes for localization *)
-
 interface
-
 {$I GLScene.inc}
-
 uses
   Winapi.Windows,
   Winapi.ShellApi,
@@ -20,30 +16,22 @@ uses
   Vcl.Controls,
   Vcl.Dialogs,
   Vcl.ExtDlgs,
-
   GLS.VectorGeometry,
   GLS.Strings;
-
 type
   THalfFloat = type Word;
   PHalfFloat = ^THalfFloat;
-
   EGLOSError = EOSError;
   EGLUtilsException = class(Exception);
-
   TSqrt255Array = array[0..255] of Byte;
   PSqrt255Array = ^TSqrt255Array;
-
   TProjectTargetNameFunc = function(): string;
-
 const
   FONT_CHARS_COUNT = 2024;
-
 var
   IsDesignTime: Boolean = False;
   vProjectTargetName: TProjectTargetNameFunc;
 
-
 // Copies the values of Source to Dest (converting word values to integer values)
 procedure WordToIntegerArray(Source: PWordArray; Dest: PIntegerArray; Count: Cardinal);
 // Round ups to the nearest power of two, value must be positive
@@ -64,7 +52,6 @@ function StringToColorAdvancedSafe(const Str: string; const Default: TColor): TC
 function TryStringToColorAdvanced(const Str: string; var OutColor: TColor): Boolean;
 // Converts a string into color
 function StringToColorAdvanced(const Str: string): TColor;
-
 (*Parses the next integer in the string. 
    Initial non-numeric characters are skipper, p is altered, returns 0 if none
    found. '+' and '-' are acknowledged. *)
@@ -73,29 +60,23 @@ function ParseInteger(var p: PChar): Integer;
    Initial non-numeric characters are skipper, p is altered, returns 0 if none
    found. Both '.' and ',' are accepted as decimal separators. *)
 function ParseFloat(var p: PChar): Extended;
-
 //Saves ansistring "data" to "filename". 
 procedure SaveAnsiStringToFile(const fileName: string; const data: AnsiString);
 //Returns the ansistring content of "filename". 
 function LoadAnsiStringFromFile(const fileName: string): AnsiString;
-
 //Saves string "data" to "filename". 
 procedure SaveStringToFile(const fileName: string; const data: String);
 //Returns the string content of "filename". 
 function LoadStringFromFile(const fileName: string): String;
-
 //Saves component to a file.
 procedure SaveComponentToFile(const Component: TComponent; const FileName: string; const AsText: Boolean = True);
 // Loads component from a file.
 procedure LoadComponentFromFile(const Component: TComponent; const FileName: string; const AsText: Boolean = True);
-
 (* Returns the size of "filename". 
    Returns 0 (zero) is file does not exists. *)
 function SizeOfFile(const fileName: string): Int64;
-
 // Returns a pointer to an array containing the results of "255*sqrt(i/255)". 
 function GetSqrt255Array: PSqrt255Array;
-
 // Pops up a simple dialog with msg and an Ok button. 
 procedure InformationDlg(const msg: string);
 (* Pops up a simple question dialog with msg and yes/no buttons.
@@ -103,16 +84,12 @@ procedure InformationDlg(const msg: string);
 function QuestionDlg(const msg: string): Boolean;
 // Posp a simple dialog with a string input.
 function InputDlg(const aCaption, aPrompt, aDefault: string): string;
-
 // Pops up a simple save picture dialog.
 function SavePictureDialog(var aFileName: string; const aTitle: string = ''): Boolean;
 // Pops up a simple open picture dialog.
 function OpenPictureDialog(var aFileName: string; const aTitle: string = ''): Boolean;
-
 procedure SetGLSceneMediaDir();
-
 //------------------ from CrossPlatform -----------------------
-
 function GetGLRect(const aLeft, aTop, aRight, aBottom: Integer): TRect;
 (* Increases or decreases the width and height of the specified rectangle.
    Adds dx units to the left and right ends of the rectangle and dy units to
@@ -140,7 +117,6 @@ procedure QueryPerformanceCounter(out val: Int64);
    Return value is in ticks per second (Hz), returns False if no precision
    counter is available. *)
 function QueryPerformanceFrequency(out val: Int64): Boolean;
-
 (* Starts a precision timer.
    Returned value should just be considered as 'handle', even if it ain't so.
    Default platform implementation is to use QueryPerformanceCounter and
@@ -173,21 +149,26 @@ function GetValueFromStringsIndex(const AStrings: TStrings; const AIndex: Intege
 function IsDirectoryWriteable(const AName: string): Boolean;
 function CharToWideChar(const AChar: AnsiChar): WideChar;
 
+(* 
+  Added by PAL to fix problem with decimal separator in not En-US configurations
+  Decimal separator in text descriptions of meshes for import/export is always '.' char 
+  But in System.SysUtils.TextToFloat is Windows char, maybe ',' or others...
+*)
+function GLStrToFloatDef(const S: string; const Default: Extended; fs: TFormatSettings): Extended; overload;
+function GLStrToFloatDef(const S: string; const Default: Extended): Extended; overload;
+function GLStrToFloatDef(const S: string): Extended; overload;
+
 //------------------------------------------------------
 implementation
 //------------------------------------------------------
 
-
 var
   vSqrt255: TSqrt255Array;
   vInvPerformanceCounterFrequency: Double;
   vInvPerformanceCounterFrequencyReady: Boolean = False;
   vLastProjectTargetName: string;
 
-
-
 //---------------from Utils -----------------------
-
 procedure WordToIntegerArray(Source: PWordArray; Dest: PIntegerArray; Count: Cardinal);
 var
   i: integer;
@@ -195,14 +176,12 @@ begin
   for i := 0 to Count - 1 do
     Dest^[i] := Source^[i];
 end;
-
 function RoundUpToPowerOf2(value: Integer): Integer;
 begin
   Result := 1;
   while (Result < value) do
     Result := Result shl 1;
 end;
-
 function RoundDownToPowerOf2(value: Integer): Integer;
 begin
   if value > 0 then
@@ -214,12 +193,10 @@ begin
   else
     Result := 1;
 end;
-
 function IsPowerOf2(value: Integer): Boolean;
 begin
   Result := (RoundUpToPowerOf2(value) = value);
 end;
-
 function ReadCRLFString(aStream: TStream): String;
 var
   c: Char;
@@ -232,7 +209,6 @@ begin
   end;
   Result := Copy(Result, 1, Length(Result) - 2);
 end;
-
 procedure WriteCRLFString(aStream: TStream; const aString: String);
 const
   cCRLF: Integer = $0A0D;
@@ -244,25 +220,21 @@ begin
   end;
 end;
 
-
 function StrToFloatDef(const strValue: string; defValue: Extended = 0): Extended;
 begin
   if not TryStrToFloat(strValue, Result) then
     result := defValue;
 end;
-
 function StringToColorAdvancedSafe(const Str: string; const Default: TColor): TColor;
 begin
   if not TryStringToColorAdvanced(Str, Result) then
     Result := Default;
 end;
-
 function StringToColorAdvanced(const Str: string): TColor;
 begin
   if not TryStringToColorAdvanced(Str, Result) then
     raise EGLUtilsException.CreateResFmt(@strInvalidColor, [Str]);
 end;
-
 function TryStringToColorAdvanced(const Str: string; var OutColor: TColor): Boolean;
 var
   Code, I: Integer;
@@ -270,7 +242,6 @@ var
 begin
   Result := True;
   Temp := Str;
-
   Val(Temp, I, Code); //to see if it is a number
   if Code = 0 then
     OutColor := TColor(I) //Str = $0000FF
@@ -289,7 +260,6 @@ begin
     end;
   end;
 end;
-
 function ParseInteger(var p: PChar): Integer;
 var
   neg: Boolean;
@@ -322,7 +292,6 @@ begin
   if neg then
     Result := -Result;
 end;
-
 function ParseFloat(var p: PChar): Extended;
 var
   decimals, expSign, exponent: Integer;
@@ -398,7 +367,6 @@ begin
   if neg then
     Result := -Result;
 end;
-
 procedure SaveAnsiStringToFile(const fileName: string; const data: AnsiString);
 var
   n: Cardinal;
@@ -413,7 +381,6 @@ begin
     fs.Free;
   end;
 end;
-
 function LoadAnsiStringFromFile(const fileName: string): AnsiString;
 var
   n: Cardinal;
@@ -434,7 +401,6 @@ begin
   else
     Result := '';
 end;
-
 procedure SaveStringToFile(const fileName: string; const data: String);
 var
   n: Cardinal;
@@ -449,7 +415,6 @@ begin
     fs.Free;
   end;
 end;
-
 function LoadStringFromFile(const fileName: string): String;
 var
   n: Cardinal;
@@ -471,7 +436,6 @@ begin
     Result := '';
 end;
 
-
 procedure SaveComponentToFile(const Component: TComponent; const FileName: string; const AsText: Boolean);
 var
   Stream: TStream;
@@ -496,7 +460,6 @@ begin
     Stream.Free;
   end;
 end;
-
 procedure LoadComponentFromFile(const Component: TComponent; const FileName: string; const AsText: Boolean = True);
 var
   Stream: TStream;
@@ -521,7 +484,6 @@ begin
     Stream.Free;
   end;
 end;
-
 function SizeOfFile(const fileName: string): Int64;
 var
   fs: TStream;
@@ -538,7 +500,6 @@ begin
   else
     Result := 0;
 end;
-
 function GetSqrt255Array: PSqrt255Array;
 const
   cOneDiv255 = 1 / 255;
@@ -552,22 +513,18 @@ begin
   end;
   Result := @vSqrt255;
 end;
-
 procedure InformationDlg(const msg: string);
 begin
   ShowMessage(msg);
 end;
-
 function QuestionDlg(const msg: string): Boolean;
 begin
   Result := (MessageDlg(msg, mtConfirmation, [mbYes, mbNo], 0) = mrYes);
 end;
-
 function InputDlg(const aCaption, aPrompt, aDefault: string): string;
 begin
   Result := InputBox(aCaption, aPrompt, aDefault);
 end;
-
 function SavePictureDialog(var aFileName: string; const aTitle: string = ''): Boolean;
 var
   saveDialog: TSavePictureDialog;
@@ -588,7 +545,6 @@ begin
     saveDialog.Free;
   end;
 end;
-
 function OpenPictureDialog(var aFileName: string; const aTitle: string = ''): Boolean;
 var
   openDialog: TOpenPictureDialog;
@@ -609,7 +565,6 @@ begin
     openDialog.Free;
   end;
 end;
-
 procedure SetGLSceneMediaDir();
 var
   path: String;
@@ -622,10 +577,8 @@ begin
    path := IncludeTrailingPathDelimiter(path) + 'media';
    SetCurrentDir(path);
 end;
-
 //------------ from CrossPfatform -------------------
 
-
 procedure RaiseLastOSError;
 var
   e: EGLOSError;
@@ -633,37 +586,30 @@ begin
   e := EGLOSError.Create('OS Error : ' + SysErrorMessage(GetLastError));
   raise e;
 end;
-
 function IsSubComponent(const AComponent: TComponent): Boolean;
 begin
   Result := (csSubComponent in AComponent.ComponentStyle);
 end;
-
 procedure MakeSubComponent(const AComponent: TComponent; const Value: Boolean);
 begin
   AComponent.SetSubComponent(Value);
 end;
-
 function AnsiStartsText(const ASubText, AText: string): Boolean;
 begin
   Result := AnsiStartsText(ASubText, AText);
 end;
-
 function GLOKMessageBox(const Text, Caption: string): Integer;
 begin
   Result := Application.MessageBox(PChar(Text), PChar(Caption), MB_OK);
 end;
-
 procedure GLLoadBitmapFromInstance(Instance: LongInt; ABitmap: TBitmap; const AName: string);
 begin
   ABitmap.Handle := LoadBitmap(Instance, PChar(AName));
 end;
-
 procedure ShowHTMLUrl(const Url: string);
 begin
   ShellExecute(0, 'open', PChar(Url), nil, nil, SW_SHOW);
 end;
-
 function GetGLRect(const aLeft, aTop, aRight, aBottom: Integer): TRect;
 begin
   Result.Left := aLeft;
@@ -671,7 +617,6 @@ begin
   Result.Right := aRight;
   Result.Bottom := aBottom;
 end;
-
 procedure InflateGLRect(var aRect: TRect; dx, dy: Integer);
 begin
   aRect.Left := aRect.Left - dx;
@@ -683,7 +628,6 @@ begin
   if aRect.Bottom < aRect.Top then
     aRect.Bottom := aRect.Top;
 end;
-
 procedure IntersectGLRect(var aRect: TRect; const rect2: TRect);
 var
   a: Integer;
@@ -710,14 +654,12 @@ begin
       aRect.Bottom := rect2.Bottom;
   end;
 end;
-
 type
   TDeviceCapabilities = record
     Xdpi, Ydpi: integer; // Number of pixels per logical inch.
     Depth: integer; // The bit depth.
     NumColors: integer; // Number of entries in the device's color table.
   end;
-
 function GetDeviceCapabilities: TDeviceCapabilities;
 var
   Device: HDC;
@@ -732,17 +674,14 @@ begin
     ReleaseDC(0, Device);
   end;
 end;
-
 function GetDeviceLogicalPixelsX(device: HDC): Integer;
 begin
   result := GetDeviceCapabilities().Xdpi;
 end;
-
 function GetCurrentColorDepth: Integer;
 begin
   result := GetDeviceCapabilities().Depth;
 end;
-
 function PixelFormatToColorBits(aPixelFormat: TPixelFormat): Integer;
 begin
   case aPixelFormat of
@@ -760,7 +699,6 @@ begin
     Result := 24;
   end;
 end;
-
 procedure FixPathDelimiter(var S: string);
 var
   I: Integer;
@@ -769,7 +707,6 @@ begin
     if (S[I] = '/') or (S[I] = '\') then
       S[I] := PathDelim;
 end;
-
 function RelativePath(const S: string): string;
 var
   path: string;
@@ -797,28 +734,23 @@ begin
   if Pos(path, S) = 1 then
     Delete(Result, 1, Length(path));
 end;
-
 procedure QueryPerformanceCounter(out val: Int64);
 begin
   Winapi.Windows.QueryPerformanceCounter(val);
 end;
-
 function QueryPerformanceFrequency(out val: Int64): Boolean;
 begin
   Result := Boolean(Winapi.Windows.QueryPerformanceFrequency(val));
 end;
-
 function StartPrecisionTimer: Int64;
 begin
   QueryPerformanceCounter(Result);
 end;
-
 function PrecisionTimerLap(const precisionTimer: Int64): Double;
 begin
   // we can do this, because we don't really stop anything
   Result := StopPrecisionTimer(precisionTimer);
 end;
-
 function StopPrecisionTimer(const precisionTimer: Int64): Double;
 var
   cur, freq: Int64;
@@ -832,12 +764,10 @@ begin
   end;
   Result := (cur - precisionTimer) * vInvPerformanceCounterFrequency;
 end;
-
 var
   vSStartTime : TDateTime;
   vLastTime: TDateTime;
   vDeltaMilliSecond: TDateTime;
-
 function AppTime: Double;
 var
   SystemTime: TSystemTime;
@@ -859,7 +789,6 @@ begin
     vDeltaMilliSecond := 0.1;
   end;
 end;
-
 function FindUnitName(anObject: TObject): string;
 begin
   if Assigned(anObject) then
@@ -867,7 +796,6 @@ begin
   else
     Result := '';
 end;
-
 function FindUnitName(aClass: TClass): string;
 begin
   if Assigned(aClass) then
@@ -875,7 +803,6 @@ begin
   else
     Result := '';
 end;
-
 procedure SetExeDirectory;
 var
   path: string;
@@ -901,12 +828,10 @@ begin
   end;
 end;
 
-
 function GetValueFromStringsIndex(const AStrings: TStrings; const AIndex: Integer): string;
 begin
   Result := AStrings.ValueFromIndex[AIndex];
 end;
-
 function IsDirectoryWriteable(const AName: string): Boolean;
 var
   LFileName: String;
@@ -920,7 +845,6 @@ begin
     CloseHandle(LHandle);
 end;
 
-
 function CharToWideChar(const AChar: AnsiChar): WideChar;
 var
   lResult: PWideChar;
@@ -931,7 +855,6 @@ begin
   FreeMem(lResult, 2);
 end;
 
-
 function HalfToFloat(Half: THalfFloat): Single;
 var
   Dst, Sign, Mantissa: LongWord;
@@ -941,7 +864,6 @@ begin
   Sign := Half shr 15;
   Exp := (Half and $7C00) shr 10;
   Mantissa := Half and 1023;
-
   if (Exp > 0) and (Exp < 31) then
   begin
     // common normalized number
@@ -981,11 +903,9 @@ begin
     // not a number - preserve sign and mantissa
     Dst := (Sign shl 31) or $7F800000 or (Mantissa shl 13);
   end;
-
   // reinterpret LongWord as Single
   Result := PSingle(@Dst)^;
 end;
-
 function FloatToHalf(Float: Single): THalfFloat;
 var
   Src: LongWord;
@@ -996,7 +916,6 @@ begin
   Sign := Src shr 31;
   Exp := LongInt((Src and $7F800000) shr 23) - 127 + 15;
   Mantissa := Src and $007FFFFF;
-
   if (Exp > 0) and (Exp < 30) then
   begin
     // simple case - round the significand and combine it with the sign and exponent
@@ -1055,7 +974,6 @@ begin
           Exp := Exp + 1;
         end;
       end;
-
       if Exp > 30 then
       begin
         // exponent overflow - return infinity half
@@ -1068,11 +986,31 @@ begin
   end;
 end;
 
+//By PAL, added to fix problem with decimal separator in non En configurations
+function GLStrToFloatDef(const S: string; const Default: Extended; fs: TFormatSettings): Extended; overload;
+begin
+  fs.DecimalSeparator := '.';
+  if not System.SysUtils.TextToFloat(S, Result, fs) then
+    Result := Default;
+end;
+//By PAL, added to fix problem with decimal separator in non En configurations
+function GLStrToFloatDef(const S: string; const Default: Extended): Extended; overload;
+  var fs: TFormatSettings;
+begin
+  fs.DecimalSeparator := '.';
+  if not System.SysUtils.TextToFloat(S, Result, fs) then
+    Result := Default;
+end;
+//By PAL, added to fix problem with decimal separator in non En configurations
+function GLStrToFloatDef(const S: string): Extended; overload;
+  var fs: TFormatSettings;
+begin
+  fs.DecimalSeparator := '.';
+  if not System.SysUtils.TextToFloat(S, Result, fs) then
+    Result := 0;
+end;
 //----------------------------------------
 initialization
 //----------------------------------------
-
   vSStartTime := AppTime;
-
 end.
-