Browse Source

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 years ago
parent
commit
0eef9e5a66

+ 2 - 2
Packages/GLScene_Cg_DT.dproj

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

+ 4 - 3
Source/Formats.VRML.pas

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

+ 15 - 14
Source/Formats.X.pas

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

+ 9 - 8
Source/GLS.Color.pas

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

+ 5 - 4
Source/GLS.FileASE.pas

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

+ 5 - 4
Source/GLS.FileDEL.pas

@@ -18,7 +18,8 @@ uses
   GLS.VectorFileObjects,
   GLS.VectorFileObjects,
   GLS.ApplicationFileIO,
   GLS.ApplicationFileIO,
   GLS.VectorGeometry,
   GLS.VectorGeometry,
-  GLS.VectorTypesExt;
+  GLS.VectorTypesExt,
+  GLS.Utils;
 
 
 
 
 type
 type
@@ -96,9 +97,9 @@ begin
         repeat
         repeat
           Inc(i);
           Inc(i);
           tl.DelimitedText := sl[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);
           Inc(j);
         until (j = NVert);
         until (j = NVert);
         Inc(i);  
         Inc(i);  

+ 3 - 2
Source/GLS.FileDXF.pas

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

+ 19 - 18
Source/GLS.FileGLB.pas

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

+ 17 - 16
Source/GLS.FileGLTF.pas

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

+ 14 - 13
Source/GLS.FileGRD.pas

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

+ 24 - 24
Source/GLS.FileMD5.pas

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

+ 6 - 5
Source/GLS.FileNurbs.pas

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

+ 5 - 4
Source/GLS.FileOBJ.pas

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

+ 1 - 1
Source/GLS.FilePLY.pas

@@ -79,7 +79,7 @@ begin
     begin
     begin
       p := PChar(sl[i]);
       p := PChar(sl[i]);
       mesh.Vertices.Add(ParseFloat(p), ParseFloat(p), ParseFloat(p));
       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);
       Dec(nbVertices);
       Inc(i);
       Inc(i);
     end;
     end;

+ 19 - 23
Source/GLS.FileSMD.pas

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

+ 8 - 7
Source/GLS.FileSTL.pas

@@ -24,7 +24,8 @@ uses
   GLS.VectorTypes,
   GLS.VectorTypes,
   GLS.VectorGeometry,
   GLS.VectorGeometry,
   GLS.VectorLists,
   GLS.VectorLists,
-  GLS.VectorFileObjects;
+  GLS.VectorFileObjects,
+  GLS.Utils;
 
 
 type
 type
   TSTLHeader = packed record
   TSTLHeader = packed record
@@ -92,9 +93,9 @@ var
       raise Exception.Create('Invalid Normal')
       raise Exception.Create('Invalid Normal')
     else
     else
     begin
     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;
   end;
   end;
 
 
@@ -105,9 +106,9 @@ var
       raise Exception.Create('Invalid Vertex')
       raise Exception.Create('Invalid Vertex')
     else
     else
     begin
     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;
   end;
   end;
 
 

+ 8 - 7
Source/GLS.FileTIN.pas

@@ -17,7 +17,8 @@ uses
   GLS.VectorFileObjects,
   GLS.VectorFileObjects,
   GLS.ApplicationFileIO,
   GLS.ApplicationFileIO,
   GLS.VectorGeometry,
   GLS.VectorGeometry,
-  GLS.VectorTypesExt;
+  GLS.VectorTypesExt,
+  GLS.Utils;
 
 
 
 
 type
 type
@@ -75,9 +76,9 @@ begin
         Trim(tl.CommaText);
         Trim(tl.CommaText);
         if tl.Count = 9 then
         if tl.Count = 9 then
         begin
         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);
             mesh.Vertices.Add(v1, v2, v3);
             n := CalcPlaneNormal(v1, v2, v3);
             n := CalcPlaneNormal(v1, v2, v3);
             mesh.Normals.Add(n, n, n);
             mesh.Normals.Add(n, n, n);
@@ -109,9 +110,9 @@ begin
         repeat
         repeat
           Inc(i);
           Inc(i);
           tl.DelimitedText := sl[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);
           Inc(j);
         until (j = NVert);
         until (j = NVert);
         Inc(i);  
         Inc(i);  

+ 8 - 7
Source/GLS.FileVOR.pas

@@ -16,7 +16,8 @@ uses
   GLS.VectorTypes,
   GLS.VectorTypes,
   GLS.VectorGeometry,
   GLS.VectorGeometry,
   GLS.VectorLists,
   GLS.VectorLists,
-  GLS.VectorFileObjects;
+  GLS.VectorFileObjects,
+  GLS.Utils;
 
 
 type
 type
   TVORHeader = packed record
   TVORHeader = packed record
@@ -80,9 +81,9 @@ var
       raise Exception.Create('Invalid Normal')
       raise Exception.Create('Invalid Normal')
     else
     else
     begin
     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;
   end;
   end;
 
 
@@ -93,9 +94,9 @@ var
       raise Exception.Create('Invalid Vertex')
       raise Exception.Create('Invalid Vertex')
     else
     else
     begin
     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;
   end;
   end;
 
 

+ 14 - 14
Source/GLS.MaterialScript.pas

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

+ 3 - 2
Source/GLS.PersistentClasses.pas

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

+ 1 - 0
Source/GLS.TextureImageEditors.pas

@@ -207,6 +207,7 @@ begin
       buf := InputDlg(TGLProcTextureNoise.FriendlyName, 'Minimum Cut', IntToStr(MinCut));
       buf := InputDlg(TGLProcTextureNoise.FriendlyName, 'Minimum Cut', IntToStr(MinCut));
       MinCut := StrToIntDef(buf, 0);
       MinCut := StrToIntDef(buf, 0);
       buf := InputDlg(TGLProcTextureNoise.FriendlyName, 'Noise Sharpness', FloatToStr(NoiseSharpness));
       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);
       NoiseSharpness := StrToFloatDef(buf, 0.9);
       buf := InputDlg(TGLProcTextureNoise.FriendlyName, 'Random Seed', IntToStr(NoiseRandSeed));
       buf := InputDlg(TGLProcTextureNoise.FriendlyName, 'Random Seed', IntToStr(NoiseRandSeed));
       NoiseRandSeed := StrToIntDef(buf, 0);
       NoiseRandSeed := StrToIntDef(buf, 0);

+ 11 - 10
Source/GLS.Tree.pas

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

+ 32 - 94
Source/GLS.Utils.pas

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