浏览代码

Fixed TgxSkyDome component for fmx

GLScene 2 年之前
父节点
当前提交
c0f35653b5

+ 3 - 3
Examples/Demos/specialsFX/Atmosphere/AtmosphereD.dproj

@@ -4,11 +4,11 @@
         <MainSource>AtmosphereD.dpr</MainSource>
         <MainSource>AtmosphereD.dpr</MainSource>
         <Base>True</Base>
         <Base>True</Base>
         <Config Condition="'$(Config)'==''">Debug</Config>
         <Config Condition="'$(Config)'==''">Debug</Config>
-        <TargetedPlatforms>3</TargetedPlatforms>
+        <TargetedPlatforms>1</TargetedPlatforms>
         <AppType>Application</AppType>
         <AppType>Application</AppType>
         <FrameworkType>VCL</FrameworkType>
         <FrameworkType>VCL</FrameworkType>
         <ProjectVersion>19.4</ProjectVersion>
         <ProjectVersion>19.4</ProjectVersion>
-        <Platform Condition="'$(Platform)'==''">Win64</Platform>
+        <Platform Condition="'$(Platform)'==''">Win32</Platform>
     </PropertyGroup>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
     <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
         <Base>true</Base>
         <Base>true</Base>
@@ -155,7 +155,7 @@
             </Delphi.Personality>
             </Delphi.Personality>
             <Platforms>
             <Platforms>
                 <Platform value="Win32">True</Platform>
                 <Platform value="Win32">True</Platform>
-                <Platform value="Win64">True</Platform>
+                <Platform value="Win64">False</Platform>
             </Platforms>
             </Platforms>
             <Deployment Version="3">
             <Deployment Version="3">
                 <DeployFile LocalName="Win64\Debug\AtmosphereD.exe" Configuration="Debug" Class="ProjectOutput">
                 <DeployFile LocalName="Win64\Debug\AtmosphereD.exe" Configuration="Debug" Class="ProjectOutput">

+ 13 - 13
Packages/GLScene_RT.dpk

@@ -55,29 +55,29 @@ contains
   Formats.X in '..\Source\Formats.X.pas',
   Formats.X in '..\Source\Formats.X.pas',
   Formats.VFW in '..\Source\Common\Formats.VFW.pas',
   Formats.VFW in '..\Source\Common\Formats.VFW.pas',
   Formats.VRML in '..\Source\Formats.VRML.pas',
   Formats.VRML in '..\Source\Formats.VRML.pas',
-  GLS.AVIRecorder in '..\Source\GLS.AVIRecorder.pas',
-  GLS.AnimatedSprite in '..\Source\GLS.AnimatedSprite.pas',
-  GLS.AnimationUtils in '..\Source\GLS.AnimationUtils.pas',
+  GLS.AVIRecorder in '..\Source\VCL\GLS.AVIRecorder.pas',
+  GLS.AnimatedSprite in '..\Source\VCL\GLS.AnimatedSprite.pas',
+  Scena.AnimationUtils in '..\Source\Common\Scena.AnimationUtils.pas',
   GLS.ApplicationFileIO in '..\Source\VCL\GLS.ApplicationFileIO.pas',
   GLS.ApplicationFileIO in '..\Source\VCL\GLS.ApplicationFileIO.pas',
   GLS.AsyncHDS in '..\Source\VCL\GLS.AsyncHDS.pas',
   GLS.AsyncHDS in '..\Source\VCL\GLS.AsyncHDS.pas',
   GLS.AsyncTimer in '..\Source\VCL\GLS.AsyncTimer.pas',
   GLS.AsyncTimer in '..\Source\VCL\GLS.AsyncTimer.pas',
-  GLS.Atmosphere in '..\Source\GLS.Atmosphere.pas',
-  GLS.ArchiveManager in '..\Source\GLS.ArchiveManager.pas',
+  GLS.Atmosphere in '..\Source\VCL\GLS.Atmosphere.pas',
+  GLS.ArchiveManager in '..\Source\VCL\GLS.ArchiveManager.pas',
   GLS.BaseClasses in '..\Source\VCL\GLS.BaseClasses.pas',
   GLS.BaseClasses in '..\Source\VCL\GLS.BaseClasses.pas',
   GLS.BaseMeshSilhouette in '..\Source\GLS.BaseMeshSilhouette.pas',
   GLS.BaseMeshSilhouette in '..\Source\GLS.BaseMeshSilhouette.pas',
   GLS.Behaviours in '..\Source\GLS.Behaviours.pas',
   GLS.Behaviours in '..\Source\GLS.Behaviours.pas',
   GLS.BitmapFont in '..\Source\GLS.BitmapFont.pas',
   GLS.BitmapFont in '..\Source\GLS.BitmapFont.pas',
   GLS.Blur in '..\Source\GLS.Blur.pas',
   GLS.Blur in '..\Source\GLS.Blur.pas',
   GLS.BumpmapHDS in '..\Source\GLS.BumpmapHDS.pas',
   GLS.BumpmapHDS in '..\Source\GLS.BumpmapHDS.pas',
-  GLS.Cadencer in '..\Source\GLS.Cadencer.pas',
-  GLS.CameraController in '..\Source\GLS.CameraController.pas',
-  GLS.Canvas in '..\Source\GLS.Canvas.pas',
-  GLS.Collision in '..\Source\GLS.Collision.pas',
-  GLS.Color in '..\Source\GLS.Color.pas',
+  GLS.Cadencer in '..\Source\VCL\GLS.Cadencer.pas',
+  GLS.CameraController in '..\Source\VCL\GLS.CameraController.pas',
+  GLS.Canvas in '..\Source\VCL\GLS.Canvas.pas',
+  GLS.Collision in '..\Source\VCL\GLS.Collision.pas',
+  GLS.Color in '..\Source\VCL\GLS.Color.pas',
   GLS.CompositeImage in '..\Source\VCL\GLS.CompositeImage.pas',
   GLS.CompositeImage in '..\Source\VCL\GLS.CompositeImage.pas',
-  GLS.Console in '..\Source\GLS.Console.pas',
-  GLS.Context in '..\Source\GLS.Context.pas',
-  GLS.Coordinates in '..\Source\GLS.Coordinates.pas',
+  GLS.Console in '..\Source\VCL\GLS.Console.pas',
+  GLS.Context in '..\Source\VCL\GLS.Context.pas',
+  GLS.Coordinates in '..\Source\VCL\GLS.Coordinates.pas',
   GLS.CurvesAndSurfaces in '..\Source\GLS.CurvesAndSurfaces.pas',
   GLS.CurvesAndSurfaces in '..\Source\GLS.CurvesAndSurfaces.pas',
   GLS.DCE in '..\Source\GLS.DCE.pas',
   GLS.DCE in '..\Source\GLS.DCE.pas',
   GLS.DynamicTexture in '..\Source\GLS.DynamicTexture.pas',
   GLS.DynamicTexture in '..\Source\GLS.DynamicTexture.pas',

+ 13 - 13
Packages/GLScene_RT.dproj

@@ -159,29 +159,29 @@
         <DCCReference Include="..\Source\Formats.X.pas"/>
         <DCCReference Include="..\Source\Formats.X.pas"/>
         <DCCReference Include="..\Source\Common\Formats.VFW.pas"/>
         <DCCReference Include="..\Source\Common\Formats.VFW.pas"/>
         <DCCReference Include="..\Source\Formats.VRML.pas"/>
         <DCCReference Include="..\Source\Formats.VRML.pas"/>
-        <DCCReference Include="..\Source\GLS.AVIRecorder.pas"/>
-        <DCCReference Include="..\Source\GLS.AnimatedSprite.pas"/>
-        <DCCReference Include="..\Source\GLS.AnimationUtils.pas"/>
+        <DCCReference Include="..\Source\VCL\GLS.AVIRecorder.pas"/>
+        <DCCReference Include="..\Source\VCL\GLS.AnimatedSprite.pas"/>
+        <DCCReference Include="..\Source\Common\Scena.AnimationUtils.pas"/>
         <DCCReference Include="..\Source\VCL\GLS.ApplicationFileIO.pas"/>
         <DCCReference Include="..\Source\VCL\GLS.ApplicationFileIO.pas"/>
         <DCCReference Include="..\Source\VCL\GLS.AsyncHDS.pas"/>
         <DCCReference Include="..\Source\VCL\GLS.AsyncHDS.pas"/>
         <DCCReference Include="..\Source\VCL\GLS.AsyncTimer.pas"/>
         <DCCReference Include="..\Source\VCL\GLS.AsyncTimer.pas"/>
-        <DCCReference Include="..\Source\GLS.Atmosphere.pas"/>
-        <DCCReference Include="..\Source\GLS.ArchiveManager.pas"/>
+        <DCCReference Include="..\Source\VCL\GLS.Atmosphere.pas"/>
+        <DCCReference Include="..\Source\VCL\GLS.ArchiveManager.pas"/>
         <DCCReference Include="..\Source\VCL\GLS.BaseClasses.pas"/>
         <DCCReference Include="..\Source\VCL\GLS.BaseClasses.pas"/>
         <DCCReference Include="..\Source\GLS.BaseMeshSilhouette.pas"/>
         <DCCReference Include="..\Source\GLS.BaseMeshSilhouette.pas"/>
         <DCCReference Include="..\Source\GLS.Behaviours.pas"/>
         <DCCReference Include="..\Source\GLS.Behaviours.pas"/>
         <DCCReference Include="..\Source\GLS.BitmapFont.pas"/>
         <DCCReference Include="..\Source\GLS.BitmapFont.pas"/>
         <DCCReference Include="..\Source\GLS.Blur.pas"/>
         <DCCReference Include="..\Source\GLS.Blur.pas"/>
         <DCCReference Include="..\Source\GLS.BumpmapHDS.pas"/>
         <DCCReference Include="..\Source\GLS.BumpmapHDS.pas"/>
-        <DCCReference Include="..\Source\GLS.Cadencer.pas"/>
-        <DCCReference Include="..\Source\GLS.CameraController.pas"/>
-        <DCCReference Include="..\Source\GLS.Canvas.pas"/>
-        <DCCReference Include="..\Source\GLS.Collision.pas"/>
-        <DCCReference Include="..\Source\GLS.Color.pas"/>
+        <DCCReference Include="..\Source\VCL\GLS.Cadencer.pas"/>
+        <DCCReference Include="..\Source\VCL\GLS.CameraController.pas"/>
+        <DCCReference Include="..\Source\VCL\GLS.Canvas.pas"/>
+        <DCCReference Include="..\Source\VCL\GLS.Collision.pas"/>
+        <DCCReference Include="..\Source\VCL\GLS.Color.pas"/>
         <DCCReference Include="..\Source\VCL\GLS.CompositeImage.pas"/>
         <DCCReference Include="..\Source\VCL\GLS.CompositeImage.pas"/>
-        <DCCReference Include="..\Source\GLS.Console.pas"/>
-        <DCCReference Include="..\Source\GLS.Context.pas"/>
-        <DCCReference Include="..\Source\GLS.Coordinates.pas"/>
+        <DCCReference Include="..\Source\VCL\GLS.Console.pas"/>
+        <DCCReference Include="..\Source\VCL\GLS.Context.pas"/>
+        <DCCReference Include="..\Source\VCL\GLS.Coordinates.pas"/>
         <DCCReference Include="..\Source\GLS.CurvesAndSurfaces.pas"/>
         <DCCReference Include="..\Source\GLS.CurvesAndSurfaces.pas"/>
         <DCCReference Include="..\Source\GLS.DCE.pas"/>
         <DCCReference Include="..\Source\GLS.DCE.pas"/>
         <DCCReference Include="..\Source\GLS.DynamicTexture.pas"/>
         <DCCReference Include="..\Source\GLS.DynamicTexture.pas"/>

+ 1 - 2
Packagex/GLArena_RT.dpk

@@ -200,7 +200,6 @@ contains
   GLX.ShadowVolume in '..\Source\FMX\GLX.ShadowVolume.pas',
   GLX.ShadowVolume in '..\Source\FMX\GLX.ShadowVolume.pas',
   GLX.Silhouette in '..\Source\FMX\GLX.Silhouette.pas',
   GLX.Silhouette in '..\Source\FMX\GLX.Silhouette.pas',
   GLX.SimpleNavigation in '..\Source\FMX\GLX.SimpleNavigation.pas',
   GLX.SimpleNavigation in '..\Source\FMX\GLX.SimpleNavigation.pas',
-  GLX.SkyBox in '..\Source\FMX\GLX.SkyBox.pas',
   GLX.Skydome in '..\Source\FMX\GLX.Skydome.pas',
   GLX.Skydome in '..\Source\FMX\GLX.Skydome.pas',
   GLX.SmoothNavigator in '..\Source\FMX\GLX.SmoothNavigator.pas',
   GLX.SmoothNavigator in '..\Source\FMX\GLX.SmoothNavigator.pas',
   GLX.Sound in '..\Source\FMX\GLX.Sound.pas',
   GLX.Sound in '..\Source\FMX\GLX.Sound.pas',
@@ -229,7 +228,6 @@ contains
   GLX.WindowsFont in '..\Source\FMX\GLX.WindowsFont.pas',
   GLX.WindowsFont in '..\Source\FMX\GLX.WindowsFont.pas',
   GLX.zBuffer in '..\Source\FMX\GLX.zBuffer.pas',
   GLX.zBuffer in '..\Source\FMX\GLX.zBuffer.pas',
   GLX.ViewerOpenGL in '..\Source\FMX\GLX.ViewerOpenGL.pas',
   GLX.ViewerOpenGL in '..\Source\FMX\GLX.ViewerOpenGL.pas',
-  GLX.AnimationUtils in '..\Source\FMX\GLX.AnimationUtils.pas',
   GLX.ApplicationFileIO in '..\Source\FMX\GLX.ApplicationFileIO.pas',
   GLX.ApplicationFileIO in '..\Source\FMX\GLX.ApplicationFileIO.pas',
   GLX.ArchiveManager in '..\Source\FMX\GLX.ArchiveManager.pas',
   GLX.ArchiveManager in '..\Source\FMX\GLX.ArchiveManager.pas',
   GLX.BaseClasses in '..\Source\FMX\GLX.BaseClasses.pas',
   GLX.BaseClasses in '..\Source\FMX\GLX.BaseClasses.pas',
@@ -248,6 +246,7 @@ contains
   GLX.OpenGL in '..\Source\FMX\GLX.OpenGL.pas',
   GLX.OpenGL in '..\Source\FMX\GLX.OpenGL.pas',
   Vulkan.Import in '..\Source\Common\Vulkan.Import.pas',
   Vulkan.Import in '..\Source\Common\Vulkan.Import.pas',
   GLSLx.Parameter in '..\Source\FMX\GLSLx.Parameter.pas',
   GLSLx.Parameter in '..\Source\FMX\GLSLx.Parameter.pas',
+  Scena.AnimationUtils in '..\Source\Common\Scena.AnimationUtils.pas',
   Scena.Strings in '..\Source\Common\Scena.Strings.pas',
   Scena.Strings in '..\Source\Common\Scena.Strings.pas',
   Scena.VectorTypes in '..\Source\Common\Scena.VectorTypes.pas',
   Scena.VectorTypes in '..\Source\Common\Scena.VectorTypes.pas',
   Scena.VectorTypesExt in '..\Source\Common\Scena.VectorTypesExt.pas',
   Scena.VectorTypesExt in '..\Source\Common\Scena.VectorTypesExt.pas',

+ 1 - 2
Packagex/GLArena_RT.dproj

@@ -320,7 +320,6 @@
         <DCCReference Include="..\Source\FMX\GLX.ShadowVolume.pas"/>
         <DCCReference Include="..\Source\FMX\GLX.ShadowVolume.pas"/>
         <DCCReference Include="..\Source\FMX\GLX.Silhouette.pas"/>
         <DCCReference Include="..\Source\FMX\GLX.Silhouette.pas"/>
         <DCCReference Include="..\Source\FMX\GLX.SimpleNavigation.pas"/>
         <DCCReference Include="..\Source\FMX\GLX.SimpleNavigation.pas"/>
-        <DCCReference Include="..\Source\FMX\GLX.SkyBox.pas"/>
         <DCCReference Include="..\Source\FMX\GLX.Skydome.pas"/>
         <DCCReference Include="..\Source\FMX\GLX.Skydome.pas"/>
         <DCCReference Include="..\Source\FMX\GLX.SmoothNavigator.pas"/>
         <DCCReference Include="..\Source\FMX\GLX.SmoothNavigator.pas"/>
         <DCCReference Include="..\Source\FMX\GLX.Sound.pas"/>
         <DCCReference Include="..\Source\FMX\GLX.Sound.pas"/>
@@ -349,7 +348,6 @@
         <DCCReference Include="..\Source\FMX\GLX.WindowsFont.pas"/>
         <DCCReference Include="..\Source\FMX\GLX.WindowsFont.pas"/>
         <DCCReference Include="..\Source\FMX\GLX.zBuffer.pas"/>
         <DCCReference Include="..\Source\FMX\GLX.zBuffer.pas"/>
         <DCCReference Include="..\Source\FMX\GLX.ViewerOpenGL.pas"/>
         <DCCReference Include="..\Source\FMX\GLX.ViewerOpenGL.pas"/>
-        <DCCReference Include="..\Source\FMX\GLX.AnimationUtils.pas"/>
         <DCCReference Include="..\Source\FMX\GLX.ApplicationFileIO.pas"/>
         <DCCReference Include="..\Source\FMX\GLX.ApplicationFileIO.pas"/>
         <DCCReference Include="..\Source\FMX\GLX.ArchiveManager.pas"/>
         <DCCReference Include="..\Source\FMX\GLX.ArchiveManager.pas"/>
         <DCCReference Include="..\Source\FMX\GLX.BaseClasses.pas"/>
         <DCCReference Include="..\Source\FMX\GLX.BaseClasses.pas"/>
@@ -368,6 +366,7 @@
         <DCCReference Include="..\Source\FMX\GLX.OpenGL.pas"/>
         <DCCReference Include="..\Source\FMX\GLX.OpenGL.pas"/>
         <DCCReference Include="..\Source\Common\Vulkan.Import.pas"/>
         <DCCReference Include="..\Source\Common\Vulkan.Import.pas"/>
         <DCCReference Include="..\Source\FMX\GLSLx.Parameter.pas"/>
         <DCCReference Include="..\Source\FMX\GLSLx.Parameter.pas"/>
+        <DCCReference Include="..\Source\Common\Scena.AnimationUtils.pas"/>
         <DCCReference Include="..\Source\Common\Scena.Strings.pas"/>
         <DCCReference Include="..\Source\Common\Scena.Strings.pas"/>
         <DCCReference Include="..\Source\Common\Scena.VectorTypes.pas"/>
         <DCCReference Include="..\Source\Common\Scena.VectorTypes.pas"/>
         <DCCReference Include="..\Source\Common\Scena.VectorTypesExt.pas"/>
         <DCCReference Include="..\Source\Common\Scena.VectorTypesExt.pas"/>

+ 1 - 1
Source/GLS.AnimationUtils.pas → Source/Common/Scena.AnimationUtils.pas

@@ -1,7 +1,7 @@
 //
 //
 // The graphics platform GLScene https://github.com/glscene
 // The graphics platform GLScene https://github.com/glscene
 //
 //
-unit GLS.AnimationUtils;
+unit Scena.AnimationUtils;
 
 
 (* Main purpose is to give an easy way to create a linear interpolation *)
 (* Main purpose is to give an easy way to create a linear interpolation *)
 
 

+ 0 - 444
Source/FMX/GLX.SkyBox.pas

@@ -1,444 +0,0 @@
-//
-// The graphics platform GLXcene https://github.com/glscene
-//
-unit GLX.SkyBox;
-
-(*
-   A TgxImmaterialSceneObject drawing 6 quads (plus another quad as "Cloud" plane)
-   for use as a skybox always centered on the camera.
-*)
-
-interface
-
-{$I Scena.inc}
-
-uses
-  Winapi.OpenGL,
-  System.Classes,
-
-  GLX.XOpenGL,
-  Scena.VectorTypes,
-  Scena.VectorGeometry,
-  GLX.Scene,
-  GLX.Material,
-  GLX.RenderContextInfo;
-
-type
-
-  TgxSkyBoxStyle = (sbsFull, sbsTopHalf, sbsBottomHalf, sbTopTwoThirds,
-    sbsTopHalfClamped);
-
-  TgxSkyBox = class(TgxCameraInvariantObject, IgxMaterialLibrarySupported)
-  private
-    FMatNameTop: string;
-    FMatNameRight: string;
-    FMatNameFront: string;
-    FMatNameLeft: string;
-    FMatNameBack: string;
-    FMatNameBottom: string;
-    FMatNameClouds: string;
-    FMaterialLibrary: TgxMaterialLibrary;
-    FCloudsPlaneOffset: Single;
-    FCloudsPlaneSize: Single;
-    FStyle: TgxSkyBoxStyle;
-    //implementing IgxMaterialLibrarySupported
-    function GetMaterialLibrary: TgxAbstractMaterialLibrary;
-  protected
-    procedure SetMaterialLibrary(const Value: TgxMaterialLibrary);
-    procedure SetMatNameBack(const Value: string);
-    procedure SetMatNameBottom(const Value: string);
-    procedure SetMatNameFront(const Value: string);
-    procedure SetMatNameLeft(const Value: string);
-    procedure SetMatNameRight(const Value: string);
-    procedure SetMatNameTop(const Value: string);
-    procedure SetMatNameClouds(const Value: string);
-    procedure SetCloudsPlaneOffset(const Value: single);
-    procedure SetCloudsPlaneSize(const Value: single);
-    procedure SetStyle(const value: TgxSkyBoxStyle);
-  public
-    constructor Create(AOwner: TComponent); override;
-    destructor Destroy; override;
-    (* We want children of the sky box to appear far away too
-       Note: simply not writing to depth buffer may not make this not work,
-       child objects may need the depth buffer to render themselves properly,
-       this may require depth buffer cleared after that *)
-    procedure DoRender(var ARci: TgxRenderContextInfo;
-      ARenderSelf, ARenderChildren: Boolean); override;
-    procedure BuildList(var ARci: TgxRenderContextInfo); override;
-    procedure Notification(AComponent: TComponent; Operation: TOperation);
-      override;
-  published
-    property MaterialLibrary: TgxMaterialLibrary read FMaterialLibrary write
-      SetMaterialLibrary;
-    property MatNameTop: TgxLibMaterialName read FMatNameTop write
-      SetMatNameTop;
-    property MatNameBottom: TgxLibMaterialName read FMatNameBottom write
-      SetMatNameBottom;
-    property MatNameLeft: TgxLibMaterialName read FMatNameLeft write
-      SetMatNameLeft;
-    property MatNameRight: TgxLibMaterialName read FMatNameRight write
-      SetMatNameRight;
-    property MatNameFront: TgxLibMaterialName read FMatNameFront write
-      SetMatNameFront;
-    property MatNameBack: TgxLibMaterialName read FMatNameBack write
-      SetMatNameBack;
-    property MatNameClouds: TgxLibMaterialName read FMatNameClouds write
-      SetMatNameClouds;
-    property CloudsPlaneOffset: Single read FCloudsPlaneOffset write
-      SetCloudsPlaneOffset;
-    property CloudsPlaneSize: Single read FCloudsPlaneSize write
-      SetCloudsPlaneSize;
-    property Style: TgxSkyBoxStyle read FStyle write FStyle default sbsFull;
-  end;
-
-//===================================================================
-implementation
-//===================================================================
-
-uses
-  GLX.Context,
-  GLX.State;
-
-// ------------------
-// ------------------ TgxSkyBox ------------------
-// ------------------
-
-constructor TgxSkyBox.Create(AOwner: TComponent);
-begin
-  inherited Create(AOwner);
-  CamInvarianceMode := cimPosition;
-  ObjectStyle := ObjectStyle + [osDirectDraw, osNoVisibilityCulling];
-  FCloudsPlaneOffset := 0.2;
-    // this should be set far enough to avoid near plane clipping
-  FCloudsPlaneSize := 32;
-    // the bigger, the more this extends the clouds cap to the horizon
-end;
-
-destructor TgxSkyBox.Destroy;
-begin
-  inherited;
-end;
-
-function TgxSkyBox.GetMaterialLibrary: TgxAbstractMaterialLibrary;
-begin
-  Result := FMaterialLibrary;
-end;
-
-procedure TgxSkyBox.Notification(AComponent: TComponent; Operation: TOperation);
-begin
-  if (Operation = opRemove) and (AComponent = FMaterialLibrary) then
-    MaterialLibrary := nil;
-  inherited;
-end;
-
-procedure TgxSkyBox.DoRender(var ARci: TgxRenderContextInfo; ARenderSelf,
-  ARenderChildren: Boolean);
-begin
-  Arci.gxStates.DepthWriteMask := False;
-  Arci.ignoreDepthRequests := true;
-  inherited;
-  Arci.ignoreDepthRequests := False;
-end;
-
-procedure TgxSkyBox.BuildList(var ARci: TgxRenderContextInfo);
-var
-  f, cps, cof1: Single;
-  oldStates: TgxStates;
-  libMat: TgxLibMaterial;
-begin
-  if FMaterialLibrary = nil then
-    Exit;
-
-  with ARci.gxStates do
-  begin
-    oldStates := States;
-    Disable(stDepthTest);
-    Disable(stLighting);
-    Disable(stFog);
-  end;
-
-  glPushMatrix;
-  f := ARci.rcci.farClippingDistance * 0.5;
-  glScalef(f, f, f);
-
-  try
-    case Style of
-      sbsFull: ;
-      sbsTopHalf, sbsTopHalfClamped:
-        begin
-          glTranslatef(0, 0.5, 0);
-          glScalef(1, 0.5, 1);
-        end;
-      sbsBottomHalf:
-        begin
-          glTranslatef(0, -0.5, 0);
-          glScalef(1, 0.5, 1);
-        end;
-      sbTopTwoThirds:
-        begin
-          glTranslatef(0, 1 / 3, 0);
-          glScalef(1, 2 / 3, 1);
-        end;
-    end;
-
-    // FRONT
-    libMat := MaterialLibrary.LibMaterialByName(FMatNameFront);
-    if libMat <> nil then
-    begin
-      libMat.Apply(ARci);
-      repeat
-        glBegin(GL_QUADS);
-        glTexCoord2f(0.002, 0.998);
-        glVertex3f(-1, 1, -1);
-        glTexCoord2f(0.002, 0.002);
-        glVertex3f(-1, -1, -1);
-        glTexCoord2f(0.998, 0.002);
-        glVertex3f(1, -1, -1);
-        glTexCoord2f(0.998, 0.998);
-        glVertex3f(1, 1, -1);
-        if Style = sbsTopHalfClamped then
-        begin
-          glTexCoord2f(0.002, 0.002);
-          glVertex3f(-1, -1, -1);
-          glTexCoord2f(0.002, 0.002);
-          glVertex3f(-1, -3, -1);
-          glTexCoord2f(0.998, 0.002);
-          glVertex3f(1, -3, -1);
-          glTexCoord2f(0.998, 0.002);
-          glVertex3f(1, -1, -1);
-        end;
-        glEnd;
-      until not libMat.UnApply(ARci);
-    end;
-    // BACK
-    libMat := MaterialLibrary.LibMaterialByName(FMatNameBack);
-    if libMat <> nil then
-    begin
-      libMat.Apply(ARci);
-      repeat
-        glBegin(GL_QUADS);
-        glTexCoord2f(0.002, 0.998);
-        glVertex3f(1, 1, 1);
-        glTexCoord2f(0.002, 0.002);
-        glVertex3f(1, -1, 1);
-        glTexCoord2f(0.998, 0.002);
-        glVertex3f(-1, -1, 1);
-        glTexCoord2f(0.998, 0.998);
-        glVertex3f(-1, 1, 1);
-        if Style = sbsTopHalfClamped then
-        begin
-          glTexCoord2f(0.002, 0.002);
-          glVertex3f(1, -1, 1);
-          glTexCoord2f(0.002, 0.002);
-          glVertex3f(1, -3, 1);
-          glTexCoord2f(0.998, 0.002);
-          glVertex3f(-1, -3, 1);
-          glTexCoord2f(0.998, 0.002);
-          glVertex3f(-1, -1, 1);
-        end;
-        glEnd;
-      until not libMat.UnApply(ARci);
-    end;
-    // TOP
-    libMat := MaterialLibrary.LibMaterialByName(FMatNameTop);
-    if libMat <> nil then
-    begin
-      libMat.Apply(ARci);
-      repeat
-        glBegin(GL_QUADS);
-        glTexCoord2f(0.002, 0.998);
-        glVertex3f(-1, 1, 1);
-        glTexCoord2f(0.002, 0.002);
-        glVertex3f(-1, 1, -1);
-        glTexCoord2f(0.998, 0.002);
-        glVertex3f(1, 1, -1);
-        glTexCoord2f(0.998, 0.998);
-        glVertex3f(1, 1, 1);
-        glEnd;
-      until not libMat.UnApply(ARci);
-    end;
-    // BOTTOM
-    libMat := MaterialLibrary.LibMaterialByName(FMatNameBottom);
-    if libMat <> nil then
-    begin
-      libMat.Apply(ARci);
-      repeat
-        glBegin(GL_QUADS);
-        glTexCoord2f(0.002, 0.998);
-        glVertex3f(-1, -1, -1);
-        glTexCoord2f(0.002, 0.002);
-        glVertex3f(-1, -1, 1);
-        glTexCoord2f(0.998, 0.002);
-        glVertex3f(1, -1, 1);
-        glTexCoord2f(0.998, 0.998);
-        glVertex3f(1, -1, -1);
-        glEnd;
-      until not libMat.UnApply(ARci);
-    end;
-    // LEFT
-    libMat := MaterialLibrary.LibMaterialByName(FMatNameLeft);
-    if libMat <> nil then
-    begin
-      libMat.Apply(ARci);
-      repeat
-        glBegin(GL_QUADS);
-        glTexCoord2f(0.002, 0.998);
-        glVertex3f(-1, 1, 1);
-        glTexCoord2f(0.002, 0.002);
-        glVertex3f(-1, -1, 1);
-        glTexCoord2f(0.998, 0.002);
-        glVertex3f(-1, -1, -1);
-        glTexCoord2f(0.998, 0.998);
-        glVertex3f(-1, 1, -1);
-        if Style = sbsTopHalfClamped then
-        begin
-          glTexCoord2f(0.002, 0.002);
-          glVertex3f(-1, -1, 1);
-          glTexCoord2f(0.002, 0.002);
-          glVertex3f(-1, -3, 1);
-          glTexCoord2f(0.998, 0.002);
-          glVertex3f(-1, -3, -1);
-          glTexCoord2f(0.998, 0.002);
-          glVertex3f(-1, -1, -1);
-        end;
-        glEnd;
-      until not libMat.UnApply(ARci);
-    end;
-    // RIGHT
-    libMat := MaterialLibrary.LibMaterialByName(FMatNameRight);
-    if libMat <> nil then
-    begin
-      libMat.Apply(ARci);
-      repeat
-        glBegin(GL_QUADS);
-        glTexCoord2f(0.002, 0.998);
-        glVertex3f(1, 1, -1);
-        glTexCoord2f(0.002, 0.002);
-        glVertex3f(1, -1, -1);
-        glTexCoord2f(0.998, 0.002);
-        glVertex3f(1, -1, 1);
-        glTexCoord2f(0.998, 0.998);
-        glVertex3f(1, 1, 1);
-        if Style = sbsTopHalfClamped then
-        begin
-          glTexCoord2f(0.002, 0.002);
-          glVertex3f(1, -1, -1);
-          glTexCoord2f(0.002, 0.002);
-          glVertex3f(1, -3, -1);
-          glTexCoord2f(0.998, 0.002);
-          glVertex3f(1, -3, 1);
-          glTexCoord2f(0.998, 0.002);
-          glVertex3f(1, -1, 1);
-        end;
-        glEnd;
-      until not libMat.UnApply(ARci);
-    end;
-    // CLOUDS CAP PLANE
-    libMat := MaterialLibrary.LibMaterialByName(FMatNameClouds);
-    if libMat <> nil then
-    begin
-      // pre-calculate possible values to speed up
-      cps := FCloudsPlaneSize * 0.5;
-      cof1 := FCloudsPlaneOffset;
-
-      libMat.Apply(ARci);
-      repeat
-        glBegin(GL_QUADS);
-        glTexCoord2f(0, 1);
-        glVertex3f(-cps, cof1, cps);
-        glTexCoord2f(0, 0);
-        glVertex3f(-cps, cof1, -cps);
-        glTexCoord2f(1, 0);
-        glVertex3f(cps, cof1, -cps);
-        glTexCoord2f(1, 1);
-        glVertex3f(cps, cof1, cps);
-        glEnd;
-      until not libMat.UnApply(ARci);
-    end;
-
-    glPopMatrix;
-    if stLighting in oldStates then
-      ARci.gxStates.Enable(stLighting);
-    if stFog in oldStates then
-      ARci.gxStates.Enable(stFog);
-    if stDepthTest in oldStates then
-      ARci.gxStates.Enable(stDepthTest);
-
-  finally
-  end;
-end;
-
-procedure TgxSkyBox.SetCloudsPlaneOffset(const Value: single);
-begin
-  FCloudsPlaneOffset := Value;
-  StructureChanged;
-end;
-
-procedure TgxSkyBox.SetCloudsPlaneSize(const Value: single);
-begin
-  FCloudsPlaneSize := Value;
-  StructureChanged;
-end;
-
-procedure TgxSkyBox.SetStyle(const value: TgxSkyBoxStyle);
-begin
-  FStyle := value;
-  StructureChanged;
-end;
-
-procedure TgxSkyBox.SetMaterialLibrary(const value: TgxMaterialLibrary);
-begin
-  FMaterialLibrary := value;
-  StructureChanged;
-end;
-
-procedure TgxSkyBox.SetMatNameBack(const Value: string);
-begin
-  FMatNameBack := Value;
-  StructureChanged;
-end;
-
-procedure TgxSkyBox.SetMatNameBottom(const Value: string);
-begin
-  FMatNameBottom := Value;
-  StructureChanged;
-end;
-
-procedure TgxSkyBox.SetMatNameClouds(const Value: string);
-begin
-  FMatNameClouds := Value;
-  StructureChanged;
-end;
-
-procedure TgxSkyBox.SetMatNameFront(const Value: string);
-begin
-  FMatNameFront := Value;
-  StructureChanged;
-end;
-
-procedure TgxSkyBox.SetMatNameLeft(const Value: string);
-begin
-  FMatNameLeft := Value;
-  StructureChanged;
-end;
-
-procedure TgxSkyBox.SetMatNameRight(const Value: string);
-begin
-  FMatNameRight := Value;
-  StructureChanged;
-end;
-
-procedure TgxSkyBox.SetMatNameTop(const Value: string);
-begin
-  FMatNameTop := Value;
-  StructureChanged;
-end;
-
-// ------------------------------------------------------------------
-initialization
-// ------------------------------------------------------------------
-
-  RegisterClass(TgxSkyBox);
-
-end.
-

+ 420 - 42
Source/FMX/GLX.Skydome.pas

@@ -1,5 +1,5 @@
 //
 //
-// The graphics platform GLXcene https://github.com/glscene
+// The graphics platform GLArena https://github.com/glscene
 //
 //
 unit GLX.Skydome;
 unit GLX.Skydome;
 
 
@@ -24,6 +24,7 @@ uses
   GLX.State,
   GLX.State,
   GLX.Graphics,
   GLX.Graphics,
   GLX.Color,
   GLX.Color,
+  GLX.Material,
   GLX.RenderContextInfo;
   GLX.RenderContextInfo;
 
 
 type
 type
@@ -35,6 +36,60 @@ type
   end;
   end;
   PgxStarRecord = ^TgxStarRecord;
   PgxStarRecord = ^TgxStarRecord;
 
 
+// ------------------------- SkyBox class -------------------------
+
+TgxSkyBoxStyle = (sbsFull, sbsTopHalf, sbsBottomHalf, sbTopTwoThirds, sbsTopHalfClamped);
+
+  TgxSkyBox = class(TgxCameraInvariantObject, IgxMaterialLibrarySupported)
+  private
+    FMatNameTop: string;
+    FMatNameRight: string;
+    FMatNameFront: string;
+    FMatNameLeft: string;
+    FMatNameBack: string;
+    FMatNameBottom: string;
+    FMatNameClouds: string;
+    FMaterialLibrary: TgxMaterialLibrary;
+    FCloudsPlaneOffset: Single;
+    FCloudsPlaneSize: Single;
+    FStyle: TgxSkyBoxStyle;
+    //implementing IgxMaterialLibrarySupported
+    function GetMaterialLibrary: TgxAbstractMaterialLibrary;
+  protected
+    procedure SetMaterialLibrary(const Value: TgxMaterialLibrary);
+    procedure SetMatNameBack(const Value: string);
+    procedure SetMatNameBottom(const Value: string);
+    procedure SetMatNameFront(const Value: string);
+    procedure SetMatNameLeft(const Value: string);
+    procedure SetMatNameRight(const Value: string);
+    procedure SetMatNameTop(const Value: string);
+    procedure SetMatNameClouds(const Value: string);
+    procedure SetCloudsPlaneOffset(const Value: single);
+    procedure SetCloudsPlaneSize(const Value: single);
+    procedure SetStyle(const value: TgxSkyBoxStyle);
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor Destroy; override;
+    procedure DoRender(var ARci: TgxRenderContextInfo;
+      ARenderSelf, ARenderChildren: Boolean); override;
+    procedure BuildList(var ARci: TgxRenderContextInfo); override;
+    procedure Notification(AComponent: TComponent; Operation: TOperation); override;
+  published
+    property MaterialLibrary: TgxMaterialLibrary read FMaterialLibrary write SetMaterialLibrary;
+    property MatNameTop: TgxLibMaterialName read FMatNameTop write SetMatNameTop;
+    property MatNameBottom: TgxLibMaterialName read FMatNameBottom write SetMatNameBottom;
+    property MatNameLeft: TgxLibMaterialName read FMatNameLeft write SetMatNameLeft;
+    property MatNameRight: TgxLibMaterialName read FMatNameRight write SetMatNameRight;
+    property MatNameFront: TgxLibMaterialName read FMatNameFront write SetMatNameFront;
+    property MatNameBack: TgxLibMaterialName read FMatNameBack write SetMatNameBack;
+    property MatNameClouds: TgxLibMaterialName read FMatNameClouds write SetMatNameClouds;
+    property CloudsPlaneOffset: Single read FCloudsPlaneOffset write SetCloudsPlaneOffset;
+    property CloudsPlaneSize: Single read FCloudsPlaneSize write SetCloudsPlaneSize;
+    property Style: TgxSkyBoxStyle read FStyle write FStyle default sbsFull;
+  end;
+
+//--------------------- SkyDome classes -----------------------------
+
   TgxSkyDomeBand = class(TCollectionItem)
   TgxSkyDomeBand = class(TCollectionItem)
   private
   private
     FStartAngle: Single;
     FStartAngle: Single;
@@ -76,8 +131,7 @@ type
     constructor Create(AOwner: TComponent);
     constructor Create(AOwner: TComponent);
     function Add: TgxSkyDomeBand;
     function Add: TgxSkyDomeBand;
     function FindItemID(ID: Integer): TgxSkyDomeBand;
     function FindItemID(ID: Integer): TgxSkyDomeBand;
-    property Items[index: Integer]: TgxSkyDomeBand read GetItems
-      write SetItems; default;
+    property Items[index: Integer]: TgxSkyDomeBand read GetItems write SetItems; default;
     procedure NotifyChange;
     procedure NotifyChange;
     procedure BuildList(var rci: TgxRenderContextInfo);
     procedure BuildList(var rci: TgxRenderContextInfo);
   end;
   end;
@@ -95,13 +149,13 @@ type
     destructor Destroy; override;
     destructor Destroy; override;
     procedure Assign(Source: TPersistent); override;
     procedure Assign(Source: TPersistent); override;
   published
   published
-    { Right Ascension, in degrees. }
+    // Right Ascension, in degrees.
     property RA: Single read FRA write FRA;
     property RA: Single read FRA write FRA;
-    { Declination, in degrees. }
+    // Declination, in degrees.
     property DEC: Single read FDec write FDec;
     property DEC: Single read FDec write FDec;
-    { Absolute magnitude. }
+    // Absolute magnitude.
     property Magnitude: Single read FMagnitude write FMagnitude;
     property Magnitude: Single read FMagnitude write FMagnitude;
-    { Color of the star. }
+    // Color of the star.
     property Color: TColor read FColor write FColor;
     property Color: TColor read FColor write FColor;
   end;
   end;
 
 
@@ -116,23 +170,20 @@ type
     constructor Create(AOwner: TComponent);
     constructor Create(AOwner: TComponent);
     function Add: TgxSkyDomeStar;
     function Add: TgxSkyDomeStar;
     function FindItemID(ID: Integer): TgxSkyDomeStar;
     function FindItemID(ID: Integer): TgxSkyDomeStar;
-    property Items[index: Integer]: TgxSkyDomeStar read GetItems
-      write SetItems; default;
+    property Items[index: Integer]: TgxSkyDomeStar read GetItems write SetItems; default;
     procedure BuildList(var rci: TgxRenderContextInfo; twinkle: Boolean);
     procedure BuildList(var rci: TgxRenderContextInfo; twinkle: Boolean);
-    { Adds nb random stars of the given color.
-      Stars are homogenously scattered on the complete sphere, not only the band defined or visible dome. }
-    procedure AddRandomStars(const nb: Integer; const Color: TColor;
-      const limitToTopDome: Boolean = False); overload;
-    procedure AddRandomStars(const nb: Integer;
-      const ColorMin, ColorMax: TVector3b;
+    (* Adds nb random stars of the given color.
+      Stars are homogenously scattered on the complete sphere, not only the band defined or visible dome. *)
+    procedure AddRandomStars(const nb: Integer; const Color: TColor; const limitToTopDome: Boolean = False); overload;
+    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 TgxStarRecord.
-      Not that '.stars' files should already be sorted by magnitude and color. }
+    (* Load a 'stars' file, which is made of TGLStarRecord.
+       Not that '.stars' files should already be sorted by magnitude and color. *)
     procedure LoadStarsFile(const starsFileName: string);
     procedure LoadStarsFile(const starsFileName: string);
   end;
   end;
 
 
-  TgxSkyDomeOption = (sdoTwinkle);
+  TgxSkyDomeOption = (sdoEquatorialGrid, sdoEclipticGrid, sdoGalacticGrid, sdoSupergalacticGrid, sdoTwinkle);
   TgxSkyDomeOptions = set of TgxSkyDomeOption;
   TgxSkyDomeOptions = set of TgxSkyDomeOption;
 
 
   (* Renders a sky dome always centered on the camera.
   (* Renders a sky dome always centered on the camera.
@@ -140,10 +191,7 @@ type
     depth buffering and overwrites everything. All children of a skydome
     depth buffering and overwrites everything. All children of a skydome
     are rendered in the skydome's coordinate system.
     are rendered in the skydome's coordinate system.
     The skydome is described by "bands", each "band" is an horizontal cut
     The skydome is described by "bands", each "band" is an horizontal cut
-    of a sphere, and you can have as many bands as you wish.
-    Estimated CPU cost (K7-500, GeForce SDR, default bands):
-    800x600 fullscreen filled: 4.5 ms (220 FPS, worst case)
-    Geometry cost (0% fill): 0.7 ms (1300 FPS, best case) *)
+    of a sphere, and you can have as many bands as you wish. *)
   TgxSkyDome = class(TgxCameraInvariantObject)
   TgxSkyDome = class(TgxCameraInvariantObject)
   private
   private
     FOptions: TgxSkyDomeOptions;
     FOptions: TgxSkyDomeOptions;
@@ -161,22 +209,19 @@ type
   published
   published
     property Bands: TgxSkyDomeBands read FBands write SetBands;
     property Bands: TgxSkyDomeBands read FBands write SetBands;
     property Stars: TgxSkyDomeStars read FStars write SetStars;
     property Stars: TgxSkyDomeStars read FStars write SetStars;
-    property Options: TgxSkyDomeOptions read FOptions write SetOptions
-      default [];
+    property Options: TgxSkyDomeOptions read FOptions write SetOptions default [];
   end;
   end;
 
 
-  TEarthSkydomeOption = (esoFadeStarsWithSun, esoRotateOnTwelveHours,
-    esoDepthTest);
+  TEarthSkydomeOption = (esoFadeStarsWithSun, esoRotateOnTwelveHours, esoDepthTest);
   TEarthSkydomeOptions = set of TEarthSkydomeOption;
   TEarthSkydomeOptions = set of TEarthSkydomeOption;
 
 
-  { Render a skydome like what can be seen on earth.
+  (* Render a skydome like what can be seen on earth.
     Color is based on sun position and turbidity, to "mimic" atmospheric
     Color is based on sun position and turbidity, to "mimic" atmospheric
-    Rayleigh and Mie scatterings. The colors can be adjusted to render
-    weird/extra-terrestrial atmospheres too.
+    Rayleigh and Mie scatterings. The colors can be adjusted to render exoplanet atmospheres too.
     The default slices/stacks values make for an average quality rendering,
     The default slices/stacks values make for an average quality rendering,
     for a very clean rendering, use 64/64 (more is overkill in most cases).
     for a very clean rendering, use 64/64 (more is overkill in most cases).
     The complexity is quite high though, making a T&L 3D board a necessity
     The complexity is quite high though, making a T&L 3D board a necessity
-    for using TgxEarthSkyDome. }
+    for using TgxEarthSkyDome. *)
   TgxEarthSkyDome = class(TgxSkyDome)
   TgxEarthSkyDome = class(TgxSkyDome)
   private
   private
     FSunElevation: Single;
     FSunElevation: Single;
@@ -215,19 +260,17 @@ type
     procedure BuildList(var rci: TgxRenderContextInfo); override;
     procedure BuildList(var rci: TgxRenderContextInfo); override;
     procedure SetSunAtTime(HH, MM: Single);
     procedure SetSunAtTime(HH, MM: Single);
   published
   published
-    { Elevation of the sun, measured in degrees. }
+    // Elevation of the sun, measured in degrees
     property SunElevation: Single read FSunElevation write SetSunElevation;
     property SunElevation: Single read FSunElevation write SetSunElevation;
-    { Expresses the purity of air.  Value range is from 1 (pure atmosphere) to 120 (very nebulous) }
+    // Expresses the purity of air. Value range is from 1 (pure atmosphere) to 120 (very nebulous)
     property Turbidity: Single read FTurbidity write SetTurbidity;
     property Turbidity: Single read FTurbidity write SetTurbidity;
-    property SunZenithColor: TgxColor read FSunZenithColor
-      write SetSunZenithColor;
+    property SunZenithColor: TgxColor read FSunZenithColor write SetSunZenithColor;
     property SunDawnColor: TgxColor read FSunDawnColor write SetSunDawnColor;
     property SunDawnColor: TgxColor read FSunDawnColor write SetSunDawnColor;
     property HazeColor: TgxColor read FHazeColor write SetHazeColor;
     property HazeColor: TgxColor read FHazeColor write SetHazeColor;
     property SkyColor: TgxColor read FSkyColor write SetSkyColor;
     property SkyColor: TgxColor read FSkyColor write SetSkyColor;
     property NightColor: TgxColor read FNightColor write SetNightColor;
     property NightColor: TgxColor read FNightColor write SetNightColor;
     property DeepColor: TgxColor read FDeepColor write SetDeepColor;
     property DeepColor: TgxColor read FDeepColor write SetDeepColor;
-    property ExtendedOptions: TEarthSkydomeOptions read FExtendedOptions
-      write FExtendedOptions;
+    property ExtendedOptions: TEarthSkydomeOptions read FExtendedOptions write FExtendedOptions;
     property Slices: Integer read FSlices write SetSlices default 24;
     property Slices: Integer read FSlices write SetSlices default 24;
     property Stacks: Integer read FStacks write SetStacks default 48;
     property Stacks: Integer read FStacks write SetStacks default 48;
   end;
   end;
@@ -237,14 +280,350 @@ function StarRecordPositionZUp(const starRecord: TgxStarRecord): TAffineVector;
 // Computes position on the unit sphere of a star record (Y=up).
 // Computes position on the unit sphere of a star record (Y=up).
 function StarRecordPositionYUp(const starRecord: TgxStarRecord): TAffineVector;
 function StarRecordPositionYUp(const starRecord: TgxStarRecord): TAffineVector;
 // Computes star color from BV index (RGB) and magnitude (alpha).
 // Computes star color from BV index (RGB) and magnitude (alpha).
-function StarRecordColor(const starRecord: TgxStarRecord; bias: Single)
-  : TVector4f;
+function StarRecordColor(const starRecord: TgxStarRecord; bias: Single): TVector4f;
 
 
 // ------------------------------------------------------------------
 // ------------------------------------------------------------------
 implementation
 implementation
-
 // ------------------------------------------------------------------
 // ------------------------------------------------------------------
 
 
+
+// ------------------
+// ------------------ TgxSkyBox ------------------
+// ------------------
+
+constructor TgxSkyBox.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+  CamInvarianceMode := cimPosition;
+  ObjectStyle := ObjectStyle + [osDirectDraw, osNoVisibilityCulling];
+  FCloudsPlaneOffset := 0.2;
+    // this should be set far enough to avoid near plane clipping
+  FCloudsPlaneSize := 32;
+    // the bigger, the more this extends the clouds cap to the horizon
+end;
+
+destructor TgxSkyBox.Destroy;
+begin
+  inherited;
+end;
+
+function TgxSkyBox.GetMaterialLibrary: TgxAbstractMaterialLibrary;
+begin
+  Result := FMaterialLibrary;
+end;
+
+procedure TgxSkyBox.Notification(AComponent: TComponent; Operation: TOperation);
+begin
+  if (Operation = opRemove) and (AComponent = FMaterialLibrary) then
+    MaterialLibrary := nil;
+  inherited;
+end;
+
+procedure TgxSkyBox.DoRender(var ARci: TgxRenderContextInfo; ARenderSelf,
+  ARenderChildren: Boolean);
+begin
+  Arci.gxStates.DepthWriteMask := False;
+  Arci.ignoreDepthRequests := true;
+  inherited;
+  Arci.ignoreDepthRequests := False;
+end;
+
+procedure TgxSkyBox.BuildList(var ARci: TgxRenderContextInfo);
+var
+  f, cps, cof1: Single;
+  oldStates: TgxStates;
+  libMat: TgxLibMaterial;
+begin
+  if FMaterialLibrary = nil then
+    Exit;
+
+  with ARci.gxStates do
+  begin
+    oldStates := States;
+    Disable(stDepthTest);
+    Disable(stLighting);
+    Disable(stFog);
+  end;
+
+  glPushMatrix;
+  f := ARci.rcci.farClippingDistance * 0.5;
+  glScalef(f, f, f);
+
+  try
+    case Style of
+      sbsFull: ;
+      sbsTopHalf, sbsTopHalfClamped:
+        begin
+          glTranslatef(0, 0.5, 0);
+          glScalef(1, 0.5, 1);
+        end;
+      sbsBottomHalf:
+        begin
+          glTranslatef(0, -0.5, 0);
+          glScalef(1, 0.5, 1);
+        end;
+      sbTopTwoThirds:
+        begin
+          glTranslatef(0, 1 / 3, 0);
+          glScalef(1, 2 / 3, 1);
+        end;
+    end;
+
+    // FRONT
+    libMat := MaterialLibrary.LibMaterialByName(FMatNameFront);
+    if libMat <> nil then
+    begin
+      libMat.Apply(ARci);
+      repeat
+        glBegin(GL_QUADS);
+        glTexCoord2f(0.002, 0.998);
+        glVertex3f(-1, 1, -1);
+        glTexCoord2f(0.002, 0.002);
+        glVertex3f(-1, -1, -1);
+        glTexCoord2f(0.998, 0.002);
+        glVertex3f(1, -1, -1);
+        glTexCoord2f(0.998, 0.998);
+        glVertex3f(1, 1, -1);
+        if Style = sbsTopHalfClamped then
+        begin
+          glTexCoord2f(0.002, 0.002);
+          glVertex3f(-1, -1, -1);
+          glTexCoord2f(0.002, 0.002);
+          glVertex3f(-1, -3, -1);
+          glTexCoord2f(0.998, 0.002);
+          glVertex3f(1, -3, -1);
+          glTexCoord2f(0.998, 0.002);
+          glVertex3f(1, -1, -1);
+        end;
+        glEnd;
+      until not libMat.UnApply(ARci);
+    end;
+    // BACK
+    libMat := MaterialLibrary.LibMaterialByName(FMatNameBack);
+    if libMat <> nil then
+    begin
+      libMat.Apply(ARci);
+      repeat
+        glBegin(GL_QUADS);
+        glTexCoord2f(0.002, 0.998);
+        glVertex3f(1, 1, 1);
+        glTexCoord2f(0.002, 0.002);
+        glVertex3f(1, -1, 1);
+        glTexCoord2f(0.998, 0.002);
+        glVertex3f(-1, -1, 1);
+        glTexCoord2f(0.998, 0.998);
+        glVertex3f(-1, 1, 1);
+        if Style = sbsTopHalfClamped then
+        begin
+          glTexCoord2f(0.002, 0.002);
+          glVertex3f(1, -1, 1);
+          glTexCoord2f(0.002, 0.002);
+          glVertex3f(1, -3, 1);
+          glTexCoord2f(0.998, 0.002);
+          glVertex3f(-1, -3, 1);
+          glTexCoord2f(0.998, 0.002);
+          glVertex3f(-1, -1, 1);
+        end;
+        glEnd;
+      until not libMat.UnApply(ARci);
+    end;
+    // TOP
+    libMat := MaterialLibrary.LibMaterialByName(FMatNameTop);
+    if libMat <> nil then
+    begin
+      libMat.Apply(ARci);
+      repeat
+        glBegin(GL_QUADS);
+        glTexCoord2f(0.002, 0.998);
+        glVertex3f(-1, 1, 1);
+        glTexCoord2f(0.002, 0.002);
+        glVertex3f(-1, 1, -1);
+        glTexCoord2f(0.998, 0.002);
+        glVertex3f(1, 1, -1);
+        glTexCoord2f(0.998, 0.998);
+        glVertex3f(1, 1, 1);
+        glEnd;
+      until not libMat.UnApply(ARci);
+    end;
+    // BOTTOM
+    libMat := MaterialLibrary.LibMaterialByName(FMatNameBottom);
+    if libMat <> nil then
+    begin
+      libMat.Apply(ARci);
+      repeat
+        glBegin(GL_QUADS);
+        glTexCoord2f(0.002, 0.998);
+        glVertex3f(-1, -1, -1);
+        glTexCoord2f(0.002, 0.002);
+        glVertex3f(-1, -1, 1);
+        glTexCoord2f(0.998, 0.002);
+        glVertex3f(1, -1, 1);
+        glTexCoord2f(0.998, 0.998);
+        glVertex3f(1, -1, -1);
+        glEnd;
+      until not libMat.UnApply(ARci);
+    end;
+    // LEFT
+    libMat := MaterialLibrary.LibMaterialByName(FMatNameLeft);
+    if libMat <> nil then
+    begin
+      libMat.Apply(ARci);
+      repeat
+        glBegin(GL_QUADS);
+        glTexCoord2f(0.002, 0.998);
+        glVertex3f(-1, 1, 1);
+        glTexCoord2f(0.002, 0.002);
+        glVertex3f(-1, -1, 1);
+        glTexCoord2f(0.998, 0.002);
+        glVertex3f(-1, -1, -1);
+        glTexCoord2f(0.998, 0.998);
+        glVertex3f(-1, 1, -1);
+        if Style = sbsTopHalfClamped then
+        begin
+          glTexCoord2f(0.002, 0.002);
+          glVertex3f(-1, -1, 1);
+          glTexCoord2f(0.002, 0.002);
+          glVertex3f(-1, -3, 1);
+          glTexCoord2f(0.998, 0.002);
+          glVertex3f(-1, -3, -1);
+          glTexCoord2f(0.998, 0.002);
+          glVertex3f(-1, -1, -1);
+        end;
+        glEnd;
+      until not libMat.UnApply(ARci);
+    end;
+    // RIGHT
+    libMat := MaterialLibrary.LibMaterialByName(FMatNameRight);
+    if libMat <> nil then
+    begin
+      libMat.Apply(ARci);
+      repeat
+        glBegin(GL_QUADS);
+        glTexCoord2f(0.002, 0.998);
+        glVertex3f(1, 1, -1);
+        glTexCoord2f(0.002, 0.002);
+        glVertex3f(1, -1, -1);
+        glTexCoord2f(0.998, 0.002);
+        glVertex3f(1, -1, 1);
+        glTexCoord2f(0.998, 0.998);
+        glVertex3f(1, 1, 1);
+        if Style = sbsTopHalfClamped then
+        begin
+          glTexCoord2f(0.002, 0.002);
+          glVertex3f(1, -1, -1);
+          glTexCoord2f(0.002, 0.002);
+          glVertex3f(1, -3, -1);
+          glTexCoord2f(0.998, 0.002);
+          glVertex3f(1, -3, 1);
+          glTexCoord2f(0.998, 0.002);
+          glVertex3f(1, -1, 1);
+        end;
+        glEnd;
+      until not libMat.UnApply(ARci);
+    end;
+    // CLOUDS CAP PLANE
+    libMat := MaterialLibrary.LibMaterialByName(FMatNameClouds);
+    if libMat <> nil then
+    begin
+      // pre-calculate possible values to speed up
+      cps := FCloudsPlaneSize * 0.5;
+      cof1 := FCloudsPlaneOffset;
+
+      libMat.Apply(ARci);
+      repeat
+        glBegin(GL_QUADS);
+        glTexCoord2f(0, 1);
+        glVertex3f(-cps, cof1, cps);
+        glTexCoord2f(0, 0);
+        glVertex3f(-cps, cof1, -cps);
+        glTexCoord2f(1, 0);
+        glVertex3f(cps, cof1, -cps);
+        glTexCoord2f(1, 1);
+        glVertex3f(cps, cof1, cps);
+        glEnd;
+      until not libMat.UnApply(ARci);
+    end;
+
+    glPopMatrix;
+    if stLighting in oldStates then
+      ARci.gxStates.Enable(stLighting);
+    if stFog in oldStates then
+      ARci.gxStates.Enable(stFog);
+    if stDepthTest in oldStates then
+      ARci.gxStates.Enable(stDepthTest);
+
+  finally
+  end;
+end;
+
+procedure TgxSkyBox.SetCloudsPlaneOffset(const Value: single);
+begin
+  FCloudsPlaneOffset := Value;
+  StructureChanged;
+end;
+
+procedure TgxSkyBox.SetCloudsPlaneSize(const Value: single);
+begin
+  FCloudsPlaneSize := Value;
+  StructureChanged;
+end;
+
+procedure TgxSkyBox.SetStyle(const value: TgxSkyBoxStyle);
+begin
+  FStyle := value;
+  StructureChanged;
+end;
+
+procedure TgxSkyBox.SetMaterialLibrary(const value: TgxMaterialLibrary);
+begin
+  FMaterialLibrary := value;
+  StructureChanged;
+end;
+
+procedure TgxSkyBox.SetMatNameBack(const Value: string);
+begin
+  FMatNameBack := Value;
+  StructureChanged;
+end;
+
+procedure TgxSkyBox.SetMatNameBottom(const Value: string);
+begin
+  FMatNameBottom := Value;
+  StructureChanged;
+end;
+
+procedure TgxSkyBox.SetMatNameClouds(const Value: string);
+begin
+  FMatNameClouds := Value;
+  StructureChanged;
+end;
+
+procedure TgxSkyBox.SetMatNameFront(const Value: string);
+begin
+  FMatNameFront := Value;
+  StructureChanged;
+end;
+
+procedure TgxSkyBox.SetMatNameLeft(const Value: string);
+begin
+  FMatNameLeft := Value;
+  StructureChanged;
+end;
+
+procedure TgxSkyBox.SetMatNameRight(const Value: string);
+begin
+  FMatNameRight := Value;
+  StructureChanged;
+end;
+
+procedure TgxSkyBox.SetMatNameTop(const Value: string);
+begin
+  FMatNameTop := Value;
+  StructureChanged;
+end;
+
+//--------------------- SkyDome Region ------------------------------
+
 function StarRecordPositionYUp(const starRecord: TgxStarRecord): TAffineVector;
 function StarRecordPositionYUp(const starRecord: TgxStarRecord): TAffineVector;
 var
 var
   f: Single;
   f: Single;
@@ -261,8 +640,7 @@ begin
   SinCosine(starRecord.RA * (0.01 * PI / 180), f, Result.X, Result.Y);
   SinCosine(starRecord.RA * (0.01 * PI / 180), f, Result.X, Result.Y);
 end;
 end;
 
 
-function StarRecordColor(const starRecord: TgxStarRecord; bias: Single)
-  : TVector4f;
+function StarRecordColor(const starRecord: TgxStarRecord; bias: Single): TVector4f;
 const
 const
   // very *rough* approximation
   // very *rough* approximation
   cBVm035: TVector4f = (X: 0.7; Y: 0.8; Z: 1.0; W: 1);
   cBVm035: TVector4f = (X: 0.7; Y: 0.8; Z: 1.0; W: 1);
@@ -289,7 +667,6 @@ begin
   Result.W := PowerSingle(1.2, -(starRecord.VMagnitude * 0.1 - bias));
   Result.W := PowerSingle(1.2, -(starRecord.VMagnitude * 0.1 - bias));
 end;
 end;
 
 
-
 // ------------------
 // ------------------
 // ------------------ TgxSkyDomeBand ------------------
 // ------------------ TgxSkyDomeBand ------------------
 // ------------------
 // ------------------
@@ -702,6 +1079,7 @@ begin
   end;
   end;
 end;
 end;
 
 
+//------------------------------------------------------------
 procedure TgxSkyDomeStars.AddRandomStars(const nb: Integer;
 procedure TgxSkyDomeStars.AddRandomStars(const nb: Integer;
   const ColorMin, ColorMax: TVector3b;
   const ColorMin, ColorMax: TVector3b;
   const Magnitude_min, Magnitude_max: Single;
   const Magnitude_min, Magnitude_max: Single;

+ 1 - 3
Source/GLS.PolygonTesselation.pas

@@ -1,7 +1,6 @@
 //
 //
 // The graphics platform GLScene https://github.com/glscene
 // The graphics platform GLScene https://github.com/glscene
 //
 //
-
 unit GLS.PolygonTesselation;
 unit GLS.PolygonTesselation;
 
 
 (* Code to generate triangle strips and fans for polygons. *)
 (* Code to generate triangle strips and fans for polygons. *)
@@ -13,10 +12,9 @@ interface
 uses
 uses
   Winapi.OpenGL,
   Winapi.OpenGL,
   System.SysUtils,
   System.SysUtils,
-  
+
   Scena.OpenGLAdapter,
   Scena.OpenGLAdapter,
   Scena.OpenGLTokens,
   Scena.OpenGLTokens,
-  GLS.PersistentClasses,
   Scena.VectorTypes,
   Scena.VectorTypes,
   GLS.VectorFileObjects,
   GLS.VectorFileObjects,
   GLS.VectorLists,
   GLS.VectorLists,

+ 0 - 1
Source/GLS.AVIRecorder.pas → Source/VCL/GLS.AVIRecorder.pas

@@ -1,7 +1,6 @@
 //
 //
 // The graphics platform GLScene https://github.com/glscene
 // The graphics platform GLScene https://github.com/glscene
 //
 //
-
 unit GLS.AVIRecorder;
 unit GLS.AVIRecorder;
 
 
 (* Component to make it easy to record GLScene frames into an AVI file *)
 (* Component to make it easy to record GLScene frames into an AVI file *)

+ 0 - 0
Source/GLS.AnimatedSprite.pas → Source/VCL/GLS.AnimatedSprite.pas


+ 0 - 0
Source/GLS.ArchiveManager.pas → Source/VCL/GLS.ArchiveManager.pas


+ 2 - 2
Source/GLS.Atmosphere.pas → Source/VCL/GLS.Atmosphere.pas

@@ -22,13 +22,13 @@ uses
   GLS.Scene,
   GLS.Scene,
   GLS.Objects,
   GLS.Objects,
   GLS.Cadencer,
   GLS.Cadencer,
+  Scena.VectorTypes,
   Scena.VectorGeometry,
   Scena.VectorGeometry,
   GLS.Context,
   GLS.Context,
   Scena.Strings,
   Scena.Strings,
   GLS.Color,
   GLS.Color,
   GLS.RenderContextInfo,
   GLS.RenderContextInfo,
-  GLS.State,
-  Scena.VectorTypes;
+  GLS.State;
 
 
 type
 type
   EGLAtmosphereException = class(Exception);
   EGLAtmosphereException = class(Exception);

+ 0 - 0
Source/GLS.Cadencer.pas → Source/VCL/GLS.Cadencer.pas


+ 4 - 4
Source/GLS.CameraController.pas → Source/VCL/GLS.CameraController.pas

@@ -1,7 +1,6 @@
 //
 //
 // The graphics platform GLScene https://github.com/glscene
 // The graphics platform GLScene https://github.com/glscene
 //
 //
-
 unit GLS.CameraController;
 unit GLS.CameraController;
 
 
 (*
 (*
@@ -19,12 +18,13 @@ uses
   System.Contnrs,
   System.Contnrs,
   System.Types,
   System.Types,
 
 
+  Scena.VectorTypes,
+  Scena.VectorGeometry,
+
   GLS.Scene,
   GLS.Scene,
   GLS.Coordinates,
   GLS.Coordinates,
   GLS.PersistentClasses,
   GLS.PersistentClasses,
-  Scena.VectorGeometry,
-  GLS.SmoothNavigator,
-  Scena.VectorTypes;
+  GLS.SmoothNavigator;
 
 
 type
 type
 
 

+ 1 - 1
Source/GLS.Canvas.pas → Source/VCL/GLS.Canvas.pas

@@ -19,10 +19,10 @@ uses
   Vcl.Graphics,
   Vcl.Graphics,
 
 
   Scena.OpenGLTokens,
   Scena.OpenGLTokens,
+  Scena.VectorTypes,
   Scena.VectorGeometry,
   Scena.VectorGeometry,
   GLS.Color,
   GLS.Color,
   GLS.Context,
   GLS.Context,
-  Scena.VectorTypes,
   GLS.State;
   GLS.State;
 
 
 type
 type

+ 3 - 3
Source/GLS.Collision.pas → Source/VCL/GLS.Collision.pas

@@ -14,15 +14,15 @@ uses
   System.SysUtils,
   System.SysUtils,
   System.Types,
   System.Types,
 
 
+  Scena.VectorTypes,
   Scena.OpenGLTokens,
   Scena.OpenGLTokens,
+  Scena.VectorGeometry,
   GLS.Scene,
   GLS.Scene,
   GLS.XCollection,
   GLS.XCollection,
-  Scena.VectorGeometry,
   GLS.VectorLists,
   GLS.VectorLists,
   GLS.VectorFileObjects,
   GLS.VectorFileObjects,
   GLS.GeometryBB,
   GLS.GeometryBB,
-  GLS.Manager,
-  Scena.VectorTypes;
+  GLS.Manager;
 
 
 type
 type
 
 

+ 0 - 0
Source/GLS.Color.pas → Source/VCL/GLS.Color.pas


+ 6 - 6
Source/GLS.Console.pas → Source/VCL/GLS.Console.pas

@@ -1,7 +1,6 @@
 //
 //
 // The graphics platform GLScene https://github.com/glscene
 // The graphics platform GLScene https://github.com/glscene
 //
 //
-
 unit GLS.Console;
 unit GLS.Console;
 
 
 (*
 (*
@@ -48,6 +47,9 @@ uses
   System.TypInfo,
   System.TypInfo,
   Vcl.Graphics,
   Vcl.Graphics,
 
 
+  Scena.VectorTypes,
+  Scena.Strings,
+
   GLS.Scene,
   GLS.Scene,
   GLS.Coordinates,
   GLS.Coordinates,
   GLS.Objects,
   GLS.Objects,
@@ -58,9 +60,7 @@ uses
   GLS.Context,
   GLS.Context,
   GLS.Texture,
   GLS.Texture,
   GLS.Utils,
   GLS.Utils,
-  Scena.Strings,
-  GLS.Material,
-  Scena.VectorTypes;
+  GLS.Material;
 
 
 const
 const
   CONSOLE_MAX_COMMANDS = 120;
   CONSOLE_MAX_COMMANDS = 120;
@@ -160,10 +160,10 @@ type
     procedure SortCommands(const Ascending: Boolean = True);
     procedure SortCommands(const Ascending: Boolean = True);
     function CommandExists(const Command: string): Boolean;
     function CommandExists(const Command: string): Boolean;
     function GetCommandIndex(const Command: string): Integer;
     function GetCommandIndex(const Command: string): Integer;
-    // General list stuff.
+    // General list stuff
     function LastConsoleCommand: TGLConsoleCommand;
     function LastConsoleCommand: TGLConsoleCommand;
     function Add: TGLConsoleCommand; overload;
     function Add: TGLConsoleCommand; overload;
-    // Standard stuff.
+    // Standard stuff
     constructor Create(const AOwner: TGLCustomConsole);
     constructor Create(const AOwner: TGLCustomConsole);
     destructor Destroy; override;
     destructor Destroy; override;
     property Items[const Index: Integer]: TGLConsoleCommand read GetItems;
     property Items[const Index: Integer]: TGLConsoleCommand read GetItems;

+ 2 - 2
Source/GLS.Context.pas → Source/VCL/GLS.Context.pas

@@ -27,13 +27,13 @@ uses
 
 
   Scena.OpenGLTokens,
   Scena.OpenGLTokens,
   Scena.OpenGLAdapter,
   Scena.OpenGLAdapter,
-  GLS.XOpenGL,
   Scena.VectorGeometry,
   Scena.VectorGeometry,
   Scena.Strings,
   Scena.Strings,
   Scena.TextureFormat,
   Scena.TextureFormat,
   Scena.VectorTypes,
   Scena.VectorTypes,
-  GLS.State,
   Scena.PipelineTransformation,
   Scena.PipelineTransformation,
+  GLS.State,
+  GLS.XOpenGL,
   Scena.Logger;
   Scena.Logger;
 
 
 // Buffer ID's for Multiple-Render-Targets (using GL_ATI_draw_buffers)
 // Buffer ID's for Multiple-Render-Targets (using GL_ATI_draw_buffers)

+ 0 - 0
Source/GLS.Coordinates.pas → Source/VCL/GLS.Coordinates.pas


+ 1 - 1
Source/VCL/GLS.SceneViewer.pas

@@ -3,7 +3,7 @@
 //
 //
 unit GLS.SceneViewer;
 unit GLS.SceneViewer;
 
 
-(* Windows specific Scene viewer *)
+(* Component for windows specific Scene viewer *)
 
 
 interface
 interface
 
 

+ 13 - 15
Source/VCL/GLS.SkyDome.pas

@@ -73,8 +73,7 @@ type
     procedure DoRender(var ARci: TGLRenderContextInfo;
     procedure DoRender(var ARci: TGLRenderContextInfo;
       ARenderSelf, ARenderChildren: Boolean); override;
       ARenderSelf, ARenderChildren: Boolean); override;
     procedure BuildList(var ARci: TGLRenderContextInfo); override;
     procedure BuildList(var ARci: TGLRenderContextInfo); override;
-    procedure Notification(AComponent: TComponent; Operation: TOperation);
-      override;
+    procedure Notification(AComponent: TComponent; Operation: TOperation); override;
   published
   published
     property MaterialLibrary: TGLMaterialLibrary read FMaterialLibrary write SetMaterialLibrary;
     property MaterialLibrary: TGLMaterialLibrary read FMaterialLibrary write SetMaterialLibrary;
     property MatNameTop: TGLLibMaterialName read FMatNameTop write SetMatNameTop;
     property MatNameTop: TGLLibMaterialName read FMatNameTop write SetMatNameTop;
@@ -153,7 +152,7 @@ type
     // Right Ascension, in degrees.
     // Right Ascension, in degrees.
     property RA: Single read FRA write FRA;
     property RA: Single read FRA write FRA;
     // Declination, in degrees.
     // Declination, in degrees.
-    property Dec: Single read FDec write FDec;
+    property DEC: Single read FDec write FDec;
     // Absolute magnitude.
     // Absolute magnitude.
     property Magnitude: Single read FMagnitude write FMagnitude;
     property Magnitude: Single read FMagnitude write FMagnitude;
     // Color of the star.
     // Color of the star.
@@ -177,7 +176,8 @@ type
       Stars are homogenously scattered on the complete sphere, not only the band defined or visible dome. *)
       Stars are homogenously scattered on the complete sphere, not only the band defined or visible dome. *)
     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 limitToTopDome: Boolean = False); overload;
+	   const Magnitude_min, Magnitude_max: Single;
+	   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);
@@ -236,7 +236,7 @@ type
     FDeepColor: TGLColor;
     FDeepColor: TGLColor;
     FSlices, FStacks: Integer;
     FSlices, FStacks: Integer;
     FExtendedOptions: TGLEarthSkydomeOptions;
     FExtendedOptions: TGLEarthSkydomeOptions;
-    FMorning: boolean;
+    FMorning: Boolean;
   protected
   protected
     procedure Loaded; override;
     procedure Loaded; override;
     procedure SetSunElevation(const val: Single);
     procedure SetSunElevation(const val: Single);
@@ -262,7 +262,7 @@ type
   published
   published
     // Elevation of the sun, measured in degrees
     // Elevation of the sun, measured in degrees
     property SunElevation: Single read FSunElevation write SetSunElevation;
     property SunElevation: Single read FSunElevation write SetSunElevation;
-    // Expresses the purity of air. Value range is from 1 (pure athmosphere) to 120 (very nebulous)
+    // Expresses the purity of air. Value range is from 1 (pure atmosphere) to 120 (very nebulous)
     property Turbidity: Single read FTurbidity write SetTurbidity;
     property Turbidity: Single read FTurbidity write SetTurbidity;
     property SunZenithColor: TGLColor read FSunZenithColor write SetSunZenithColor;
     property SunZenithColor: TGLColor read FSunZenithColor write SetSunZenithColor;
     property SunDawnColor: TGLColor read FSunDawnColor write SetSunDawnColor;
     property SunDawnColor: TGLColor read FSunDawnColor write SetSunDawnColor;
@@ -280,7 +280,7 @@ function StarRecordPositionZUp(const starRecord: TGLStarRecord): TAffineVector;
 // Computes position on the unit sphere of a star record (Y=up)
 // Computes position on the unit sphere of a star record (Y=up)
 function StarRecordPositionYUp(const starRecord: TGLStarRecord): TAffineVector;
 function StarRecordPositionYUp(const starRecord: TGLStarRecord): TAffineVector;
 // Computes star color from BV index (RGB) and magnitude (alpha)
 // Computes star color from BV index (RGB) and magnitude (alpha)
-function StarRecordColor(const starRecord: TGLStarRecord; bias: Single): TGLVector;
+function StarRecordColor(const starRecord: TGLStarRecord; bias: Single): TVector4f;
 
 
 // ------------------------------------------------------------------
 // ------------------------------------------------------------------
 implementation
 implementation
@@ -630,7 +630,6 @@ begin
   StructureChanged;
   StructureChanged;
 end;
 end;
 
 
-
 //--------------------- SkyDome Region ------------------------------
 //--------------------- SkyDome Region ------------------------------
 
 
 function StarRecordPositionYUp(const starRecord: TGLStarRecord): TAffineVector;
 function StarRecordPositionYUp(const starRecord: TGLStarRecord): TAffineVector;
@@ -649,14 +648,13 @@ begin
   SinCosine(starRecord.RA * (0.01 * PI / 180), f, Result.X, Result.Y);
   SinCosine(starRecord.RA * (0.01 * PI / 180), f, Result.X, Result.Y);
 end;
 end;
 
 
-function StarRecordColor(const starRecord: TGLStarRecord; bias: Single)
-  : TGLVector;
+function StarRecordColor(const starRecord: TGLStarRecord; bias: Single): TVector4f;
 const
 const
   // very *rough* approximation
   // very *rough* approximation
-  cBVm035: TGLVector = (X: 0.7; Y: 0.8; Z: 1.0; W: 1);
-  cBV015: TGLVector = (X: 1.0; Y: 1.0; Z: 1.0; W: 1);
-  cBV060: TGLVector = (X: 1.0; Y: 1.0; Z: 0.7; W: 1);
-  cBV135: TGLVector = (X: 1.0; Y: 0.8; Z: 0.7; W: 1);
+  cBVm035: TVector4f = (X: 0.7; Y: 0.8; Z: 1.0; W: 1);
+  cBV015: TVector4f = (X: 1.0; Y: 1.0; Z: 1.0; W: 1);
+  cBV060: TVector4f = (X: 1.0; Y: 1.0; Z: 0.7; W: 1);
+  cBV135: TVector4f = (X: 1.0; Y: 0.8; Z: 0.7; W: 1);
 var
 var
   bvIndex100: Integer;
   bvIndex100: Integer;
 begin
 begin
@@ -771,8 +769,8 @@ end;
 
 
 procedure TGLSkyDomeBand.BuildList(var rci: TGLRenderContextInfo);
 procedure TGLSkyDomeBand.BuildList(var rci: TGLRenderContextInfo);
 // coordinates system note: X is forward, Y is left and Z is up
 // coordinates system note: X is forward, Y is left and Z is up
-
 // always rendered as sphere of radius 1
 // always rendered as sphere of radius 1
+
   procedure RenderBand(start, stop: Single;
   procedure RenderBand(start, stop: Single;
     const colStart, colStop: TGLColorVector);
     const colStart, colStop: TGLColorVector);
   var
   var