Browse Source

Fixed utils

GLScene 2 years ago
parent
commit
e940fafa74

+ 0 - 0
Assets/Audio/soundцштв.wav → Assets/Audio/soundwind.wav


+ 3 - 3
Examples/Demos/extrusion/bendingcyl/BendingD.dpr

@@ -1,4 +1,4 @@
-{: A very simple demo of the TGLPipe object, to show what it can do.
+(* A very simple demo of the TGLPipe object, to show what it can do.
 
 
    The TGLPipe objects extrudes a circle along a trajectory (given by its node).
    The TGLPipe objects extrudes a circle along a trajectory (given by its node).
    You can specify a radius factor for each node and use spline smoothing.
    You can specify a radius factor for each node and use spline smoothing.
@@ -7,9 +7,9 @@
    middle one can be made fat/slim.
    middle one can be made fat/slim.
 
 
    The current implementation is very limited when it comes to 3D pipes, as there
    The current implementation is very limited when it comes to 3D pipes, as there
-   is no "smooth" rotation interpolator, therefore, ou will have best results
+   is no "smooth" rotation interpolator, therefore, you will have best results
    if your trajectory stays in the X/Y (local) plane.
    if your trajectory stays in the X/Y (local) plane.
-}
+*)
 program BendingD;
 program BendingD;
 
 
 uses
 uses

+ 6 - 6
Examples/Demos/extrusion/cutoutstar/CutoutStarD.dpr

@@ -1,4 +1,5 @@
-{: Dynamic sample for the ExtrusionSolid.
+(*
+   Dynamic sample for the ExtrusionSolid.
 
 
    In this sample we extrude a complex solid made of an outer star-like contour
    In this sample we extrude a complex solid made of an outer star-like contour
    and an inner square cutout that is moves around. The TGLExtrusionSolid takes
    and an inner square cutout that is moves around. The TGLExtrusionSolid takes
@@ -6,12 +7,11 @@
    (one in the FormCreate event, and the other in the Cadencer.Progress event).
    (one in the FormCreate event, and the other in the Cadencer.Progress event).
 
 
    Be aware that for TGLExtrusionSolid, like TGLMultiPolygon, the way you describe
    Be aware that for TGLExtrusionSolid, like TGLMultiPolygon, the way you describe
-   your polygons IS important:<ul>
-   <li>the polygons must be in the X, Y plane
-   <li>if all your polygons are defined in a counterclockwise manner, the first
+   your polygons IS important:
+    - the polygons must be in the X, Y plane
+    - if all your polygons are defined in a counterclockwise manner, the first
        will define the solid outer, the second, third etc. will be the cutouts.
        will define the solid outer, the second, third etc. will be the cutouts.
-   </ul>
-}
+*)
 program CutoutStarD;
 program CutoutStarD;
 
 
 uses
 uses

+ 1 - 0
Examples/Demos/graph/fxy/fFxyD.dfm

@@ -123,6 +123,7 @@ object FormFxy: TFormFxy
       Top = 168
       Top = 168
     end
     end
     object HeightField1: TGLHeightField
     object HeightField1: TGLHeightField
+      Material.BlendingMode = bmTransparency
       Direction.Coordinates = {0044F4970000803F2EBD3BB300000000}
       Direction.Coordinates = {0044F4970000803F2EBD3BB300000000}
       ShowAxes = True
       ShowAxes = True
       Up.Coordinates = {0000803F583DAF262EBD3B3300000000}
       Up.Coordinates = {0000803F583DAF262EBD3B3300000000}

+ 2 - 6
Examples/Demos/graph/heightfield/fHeightFieldD.dfm

@@ -28,8 +28,6 @@ object FormHeightField: TFormHeightField
     OnMouseDown = GLSceneViewer1MouseDown
     OnMouseDown = GLSceneViewer1MouseDown
     OnMouseMove = GLSceneViewer1MouseMove
     OnMouseMove = GLSceneViewer1MouseMove
     TabOrder = 0
     TabOrder = 0
-    ExplicitWidth = 435
-    ExplicitHeight = 366
   end
   end
   object Panel1: TPanel
   object Panel1: TPanel
     Left = 486
     Left = 486
@@ -38,8 +36,6 @@ object FormHeightField: TFormHeightField
     Height = 440
     Height = 440
     Align = alRight
     Align = alRight
     TabOrder = 1
     TabOrder = 1
-    ExplicitLeft = 435
-    ExplicitHeight = 364
     object Label1: TLabel
     object Label1: TLabel
       Left = 48
       Left = 48
       Top = 8
       Top = 8
@@ -72,7 +68,7 @@ object FormHeightField: TFormHeightField
       Left = 14
       Left = 14
       Top = 408
       Top = 408
       Width = 20
       Width = 20
-      Height = 17
+      Height = 13
       Caption = 'FPS'
       Caption = 'FPS'
     end
     end
     object TrackBar1: TTrackBar
     object TrackBar1: TTrackBar
@@ -167,7 +163,7 @@ object FormHeightField: TFormHeightField
     Left = 40
     Left = 40
     Top = 24
     Top = 24
     object HeightField1: TGLHeightField
     object HeightField1: TGLHeightField
-      Material.BlendingMode = bmTransparency
+      Material.FrontProperties.Emission.Color = {0000000000000000000000000000003F}
       Direction.Coordinates = {000000000000803F2EBD3BB300000000}
       Direction.Coordinates = {000000000000803F2EBD3BB300000000}
       Scale.Coordinates = {00004040000040400000404000000000}
       Scale.Coordinates = {00004040000040400000404000000000}
       Up.Coordinates = {000000002EBD3BB3000080BF00000000}
       Up.Coordinates = {000000002EBD3BB3000080BF00000000}

+ 20 - 2
Examples/Demos/movements/pointto/fPointtoD.dfm

@@ -24,8 +24,6 @@ object FormPointto: TFormPointto
     PenAsTouch = False
     PenAsTouch = False
     Align = alClient
     Align = alClient
     TabOrder = 0
     TabOrder = 0
-    ExplicitWidth = 479
-    ExplicitHeight = 325
   end
   end
   object GLScene1: TGLScene
   object GLScene1: TGLScene
     Left = 16
     Left = 16
@@ -128,4 +126,24 @@ object FormPointto: TFormPointto
     Left = 56
     Left = 56
     Top = 16
     Top = 16
   end
   end
+  object GLSimpleNavigation1: TGLSimpleNavigation
+    Form = Owner
+    GLSceneViewer = GLSceneViewer1
+    FormCaption = 'Point To - %FPS'
+    KeyCombinations = <
+      item
+        ShiftState = [ssLeft, ssRight]
+        Action = snaZoom
+      end
+      item
+        ShiftState = [ssLeft]
+        Action = snaMoveAroundTarget
+      end
+      item
+        ShiftState = [ssRight]
+        Action = snaMoveAroundTarget
+      end>
+    Left = 176
+    Top = 16
+  end
 end
 end

+ 2 - 1
Examples/Demos/movements/pointto/fPointtoD.pas

@@ -22,7 +22,7 @@ uses
   GLS.GeomObjects,
   GLS.GeomObjects,
  
  
   GLS.Coordinates,
   GLS.Coordinates,
-  GLS.BaseClasses;
+  GLS.BaseClasses, GLS.SimpleNavigation;
 
 
 type
 type
   TFormPointto = class(TForm)
   TFormPointto = class(TForm)
@@ -40,6 +40,7 @@ type
     Lines1: TGLLines;
     Lines1: TGLLines;
     Plane1: TGLPlane;
     Plane1: TGLPlane;
     Lines2: TGLLines;
     Lines2: TGLLines;
+    GLSimpleNavigation1: TGLSimpleNavigation;
     procedure GLCadencer1Progress(Sender: TObject; const deltaTime,
     procedure GLCadencer1Progress(Sender: TObject; const deltaTime,
       newTime: Double);
       newTime: Double);
   private
   private

+ 1 - 1
Packages/GLScene_RT.dpk

@@ -41,7 +41,6 @@ contains
   Formats.m3DSUtils in '..\Source\Formats.m3DSUtils.pas',
   Formats.m3DSUtils in '..\Source\Formats.m3DSUtils.pas',
   Formats.DXTC in '..\Source\Formats.DXTC.pas',
   Formats.DXTC in '..\Source\Formats.DXTC.pas',
   Formats.m3DS in '..\Source\Formats.m3DS.pas',
   Formats.m3DS in '..\Source\Formats.m3DS.pas',
-  ModuleLoader in '..\Source\ModuleLoader.pas',
   Formats.DDSImage in '..\Source\Formats.DDSImage.pas',
   Formats.DDSImage in '..\Source\Formats.DDSImage.pas',
   Formats.VFW in '..\Source\Formats.VFW.pas',
   Formats.VFW in '..\Source\Formats.VFW.pas',
   Formats.Q3BSP in '..\Source\Formats.Q3BSP.pas',
   Formats.Q3BSP in '..\Source\Formats.Q3BSP.pas',
@@ -167,6 +166,7 @@ contains
   GLS.MeshLines in '..\Source\GLS.MeshLines.pas',
   GLS.MeshLines in '..\Source\GLS.MeshLines.pas',
   GLS.MeshUtils in '..\Source\GLS.MeshUtils.pas',
   GLS.MeshUtils in '..\Source\GLS.MeshUtils.pas',
   GLS.Mirror in '..\Source\GLS.Mirror.pas',
   GLS.Mirror in '..\Source\GLS.Mirror.pas',
+  GLS.ModuleLoader in '..\Source\GLS.ModuleLoader.pas',
   GLS.Movement in '..\Source\GLS.Movement.pas',
   GLS.Movement in '..\Source\GLS.Movement.pas',
   GLS.MultiPolygon in '..\Source\GLS.MultiPolygon.pas',
   GLS.MultiPolygon in '..\Source\GLS.MultiPolygon.pas',
   GLS.MultiProxy in '..\Source\GLS.MultiProxy.pas',
   GLS.MultiProxy in '..\Source\GLS.MultiProxy.pas',

+ 8 - 4
Packages/GLScene_RT.dproj

@@ -4,7 +4,7 @@
         <MainSource>GLScene_RT.dpk</MainSource>
         <MainSource>GLScene_RT.dpk</MainSource>
         <Base>True</Base>
         <Base>True</Base>
         <Config Condition="'$(Config)'==''">Debug</Config>
         <Config Condition="'$(Config)'==''">Debug</Config>
-        <TargetedPlatforms>1</TargetedPlatforms>
+        <TargetedPlatforms>3</TargetedPlatforms>
         <AppType>Package</AppType>
         <AppType>Package</AppType>
         <FrameworkType>VCL</FrameworkType>
         <FrameworkType>VCL</FrameworkType>
         <ProjectVersion>19.4</ProjectVersion>
         <ProjectVersion>19.4</ProjectVersion>
@@ -145,7 +145,6 @@
         <DCCReference Include="..\Source\Formats.m3DSUtils.pas"/>
         <DCCReference Include="..\Source\Formats.m3DSUtils.pas"/>
         <DCCReference Include="..\Source\Formats.DXTC.pas"/>
         <DCCReference Include="..\Source\Formats.DXTC.pas"/>
         <DCCReference Include="..\Source\Formats.m3DS.pas"/>
         <DCCReference Include="..\Source\Formats.m3DS.pas"/>
-        <DCCReference Include="..\Source\ModuleLoader.pas"/>
         <DCCReference Include="..\Source\Formats.DDSImage.pas"/>
         <DCCReference Include="..\Source\Formats.DDSImage.pas"/>
         <DCCReference Include="..\Source\Formats.VFW.pas"/>
         <DCCReference Include="..\Source\Formats.VFW.pas"/>
         <DCCReference Include="..\Source\Formats.Q3BSP.pas"/>
         <DCCReference Include="..\Source\Formats.Q3BSP.pas"/>
@@ -271,6 +270,7 @@
         <DCCReference Include="..\Source\GLS.MeshLines.pas"/>
         <DCCReference Include="..\Source\GLS.MeshLines.pas"/>
         <DCCReference Include="..\Source\GLS.MeshUtils.pas"/>
         <DCCReference Include="..\Source\GLS.MeshUtils.pas"/>
         <DCCReference Include="..\Source\GLS.Mirror.pas"/>
         <DCCReference Include="..\Source\GLS.Mirror.pas"/>
+        <DCCReference Include="..\Source\GLS.ModuleLoader.pas"/>
         <DCCReference Include="..\Source\GLS.Movement.pas"/>
         <DCCReference Include="..\Source\GLS.Movement.pas"/>
         <DCCReference Include="..\Source\GLS.MultiPolygon.pas"/>
         <DCCReference Include="..\Source\GLS.MultiPolygon.pas"/>
         <DCCReference Include="..\Source\GLS.MultiProxy.pas"/>
         <DCCReference Include="..\Source\GLS.MultiProxy.pas"/>
@@ -393,17 +393,21 @@
                     <Source Name="MainSource">GLScene_RT.dpk</Source>
                     <Source Name="MainSource">GLScene_RT.dpk</Source>
                 </Source>
                 </Source>
                 <Excluded_Packages>
                 <Excluded_Packages>
+                    <Excluded_Packages Name="C:\Users\Public\Documents\Embarcadero\Studio\22.0\Bpl\GLScene_DT.bpl">GLScene Engine</Excluded_Packages>
+                    <Excluded_Packages Name="C:\Users\Public\Documents\Embarcadero\Studio\22.0\Bpl\GLScene_Cg_DT.bpl">GLScene Cg Shaders</Excluded_Packages>
                     <Excluded_Packages Name="C:\Users\Public\Documents\Embarcadero\Studio\22.0\Bpl\GLScene_GPU_DT.bpl">GLScene GPU Computing</Excluded_Packages>
                     <Excluded_Packages Name="C:\Users\Public\Documents\Embarcadero\Studio\22.0\Bpl\GLScene_GPU_DT.bpl">GLScene GPU Computing</Excluded_Packages>
+                    <Excluded_Packages Name="C:\Users\Public\Documents\Embarcadero\Studio\22.0\Bpl\GBComps.bpl">Geoblock - Components</Excluded_Packages>
+                    <Excluded_Packages Name="C:\Users\Public\Documents\Embarcadero\Studio\22.0\Bpl\GEdgeIO.bpl">File C:\Users\Public\Documents\Embarcadero\Studio\22.0\Bpl\GEdgeIO.bpl not found</Excluded_Packages>
+                    <Excluded_Packages Name="C:\Users\Public\Documents\Embarcadero\Studio\22.0\Bpl\GEdgeIODB.bpl">File C:\Users\Public\Documents\Embarcadero\Studio\22.0\Bpl\GEdgeIODB.bpl not found</Excluded_Packages>
                     <Excluded_Packages Name="$(BDSBIN)\bcboffice2k280.bpl">Embarcadero C++Builder Office 2000 Servers Package</Excluded_Packages>
                     <Excluded_Packages Name="$(BDSBIN)\bcboffice2k280.bpl">Embarcadero C++Builder Office 2000 Servers Package</Excluded_Packages>
                     <Excluded_Packages Name="$(BDSBIN)\bcbofficexp280.bpl">Embarcadero C++Builder Office XP Servers Package</Excluded_Packages>
                     <Excluded_Packages Name="$(BDSBIN)\bcbofficexp280.bpl">Embarcadero C++Builder Office XP Servers Package</Excluded_Packages>
                     <Excluded_Packages Name="$(BDSBIN)\dcloffice2k280.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
                     <Excluded_Packages Name="$(BDSBIN)\dcloffice2k280.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
                     <Excluded_Packages Name="$(BDSBIN)\dclofficexp280.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
                     <Excluded_Packages Name="$(BDSBIN)\dclofficexp280.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
-                    <Excluded_Packages Name="C:\Users\Public\Documents\Embarcadero\Studio\22.0\Bpl\GLScene_Cg_DT.bpl">GLScene Cg Shaders</Excluded_Packages>
                 </Excluded_Packages>
                 </Excluded_Packages>
             </Delphi.Personality>
             </Delphi.Personality>
             <Platforms>
             <Platforms>
                 <Platform value="Win32">True</Platform>
                 <Platform value="Win32">True</Platform>
-                <Platform value="Win64">False</Platform>
+                <Platform value="Win64">True</Platform>
             </Platforms>
             </Platforms>
             <Deployment Version="3">
             <Deployment Version="3">
                 <DeployFile LocalName="C:\Users\Public\Documents\Embarcadero\Studio\22.0\Bpl\GLScene_RT.bpl" Configuration="Debug" Class="ProjectOutput">
                 <DeployFile LocalName="C:\Users\Public\Documents\Embarcadero\Studio\22.0\Bpl\GLScene_RT.bpl" Configuration="Debug" Class="ProjectOutput">

+ 1 - 1
Source/ModuleLoader.pas → Source/GLS.ModuleLoader.pas

@@ -1,7 +1,7 @@
 //
 //
 // The graphics engine GLScene https://github.com/glscene
 // The graphics engine GLScene https://github.com/glscene
 //
 //
-unit ModuleLoader;
+unit GLS.ModuleLoader;
 
 
 {******************************************************************}
 {******************************************************************}
 {                                                                  }
 {                                                                  }

+ 1 - 2
Source/GLS.SkyDome.pas

@@ -27,7 +27,6 @@ uses
   GLS.RenderContextInfo;
   GLS.RenderContextInfo;
 
 
 type
 type
-
    TGLStarRecord = packed record
    TGLStarRecord = packed record
       RA : Word;              // Right Ascension, x100 builtin factor, degrees
       RA : Word;              // Right Ascension, x100 builtin factor, degrees
       DEC : SmallInt;         // Declination, x100 builtin factor, degrees
       DEC : SmallInt;         // Declination, x100 builtin factor, degrees
@@ -177,7 +176,7 @@ type
     procedure AddRandomStars(const nb: Integer; const color: TColor; const LimitToTopDome: Boolean = False); overload;
     procedure AddRandomStars(const nb: Integer; const color: TColor; const LimitToTopDome: Boolean = False); overload;
     procedure AddRandomStars(const nb: Integer; const ColorMin, ColorMax:TVector3b;
     procedure AddRandomStars(const nb: Integer; const ColorMin, ColorMax:TVector3b;
 	   const Magnitude_min, Magnitude_max: Single;
 	   const Magnitude_min, Magnitude_max: Single;
-	   const limitToTopDome: Boolean = False); overload;
+	   const LimitToTopDome: Boolean = False); overload;
     (* Load a 'stars' file, which is made of TGLStarRecord.
     (* Load a 'stars' file, which is made of TGLStarRecord.
        Not that '.stars' files should already be sorted by magnitude and color. *)
        Not that '.stars' files should already be sorted by magnitude and color. *)
     procedure LoadStarsFile(const starsFileName: string);
     procedure LoadStarsFile(const starsFileName: string);

+ 12 - 5
Source/GLS.Utils.pas

@@ -259,13 +259,20 @@ end;
 
 
 function Str2Float(const S: string): Single;
 function Str2Float(const S: string): Single;
 var
 var
+  DSeparator: Char;
   fs: TFormatSettings;
   fs: TFormatSettings;
-begin                                                                                                           fs.DecimalSeparator := ',';
-  if not TryStrToFloat(S, Result, fs) then
-  begin
-    fs.DecimalSeparator := '.';
+begin
+  DSeparator := fs.DecimalSeparator;                                                                                                   fs.DecimalSeparator := ',';
+  try
+    fs.DecimalSeparator := ',';
     if not TryStrToFloat(S, Result, fs) then
     if not TryStrToFloat(S, Result, fs) then
-      Result := 0;
+    begin
+      fs.DecimalSeparator := '.';
+      if not TryStrToFloat(S, Result, fs) then
+        Result := 0;
+    end;
+  finally
+    fs.DecimalSeparator := DSeparator;
   end;
   end;
 end;
 end;
 
 

+ 4 - 4
Source/GLS.VectorFileObjects.pas

@@ -458,7 +458,7 @@ type
     procedure SetColors(const val: TGLVectorList);
     procedure SetColors(const val: TGLVectorList);
     procedure BufferArrays;
     procedure BufferArrays;
     procedure DeclareArraysToOpenGL(var mrci: TGLRenderContextInfo;
     procedure DeclareArraysToOpenGL(var mrci: TGLRenderContextInfo;
-	  EvenIfAlreadyDeclared: Boolean = False);
+   	  EvenIfAlreadyDeclared: Boolean = False);
     procedure DisableOpenGLArrays(var mrci: TGLRenderContextInfo);
     procedure DisableOpenGLArrays(var mrci: TGLRenderContextInfo);
     procedure EnableLightMapArray(var mrci: TGLRenderContextInfo);
     procedure EnableLightMapArray(var mrci: TGLRenderContextInfo);
     procedure DisableLightMapArray(var mrci: TGLRenderContextInfo);
     procedure DisableLightMapArray(var mrci: TGLRenderContextInfo);
@@ -481,7 +481,7 @@ type
     procedure ReadFromFiler(reader: TGLVirtualReader); override;
     procedure ReadFromFiler(reader: TGLVirtualReader); override;
     procedure Clear; override;
     procedure Clear; override;
     function ExtractTriangles(texCoords: TGLAffineVectorList = nil;
     function ExtractTriangles(texCoords: TGLAffineVectorList = nil;
-	  Normals: TGLAffineVectorList = nil): TGLAffineVectorList; override;
+	    Normals: TGLAffineVectorList = nil): TGLAffineVectorList; override;
     // Returns number of triangles in the mesh object.
     // Returns number of triangles in the mesh object.
     function TriangleCount: Integer; virtual;
     function TriangleCount: Integer; virtual;
     procedure PrepareMaterialLibraryCache(matLib: TGLMaterialLibrary);
     procedure PrepareMaterialLibraryCache(matLib: TGLMaterialLibrary);
@@ -5976,8 +5976,8 @@ begin
   FLastLoadedFilename := '';
   FLastLoadedFilename := '';
   if fileName <> '' then
   if fileName <> '' then
   begin
   begin
+    fs := TBufferedFileStream.Create(fileName, fmOpenRead + fmShareDenyWrite);
     try
     try
-      fs := TBufferedFileStream.Create(fileName, fmOpenRead + fmShareDenyWrite);
       LoadFromStream(fileName, fs);
       LoadFromStream(fileName, fs);
       FLastLoadedFilename := filename;
       FLastLoadedFilename := filename;
     finally
     finally
@@ -6025,8 +6025,8 @@ var
 begin
 begin
   if fileName <> '' then
   if fileName <> '' then
   begin
   begin
+    fs := TFileStream.Create(fileName, fmCreate);
     try
     try
-      fs := TFileStream.Create(fileName, fmCreate);
       SaveToStream(fileName, fs);
       SaveToStream(fileName, fs);
     finally
     finally
       fs.Free;
       fs.Free;

+ 1 - 1
Source/ODE.Import.pas

@@ -55,7 +55,7 @@ interface
 
 
 uses
 uses
   System.Classes,
   System.Classes,
-  ModuleLoader;
+  GLS.ModuleLoader;
 
 
 const
 const
 
 

+ 4 - 0
Source/_clean.cmd

@@ -0,0 +1,4 @@
+echo off
+
+del *.dcu /s 
+del *.obj /s