Bladeren bron

Removed function BarycentricCoordinates to GLS.Coordinate unit

GLScene 3 jaren geleden
bovenliggende
commit
623fb3f251
46 gewijzigde bestanden met toevoegingen van 513 en 520 verwijderingen
  1. 5 0
      AdvDemos/Earth/fEarthD.dfm
  2. 16 14
      AdvDemos/Earth/fEarthD.pas
  3. 2 2
      AdvDemos/GLSViewer/Source/fMain.pas
  4. 1 1
      Demos/behaviours/Torque/fTorqueD.pas
  5. 6 6
      Demos/graph/heightfield/fHeightFieldD.pas
  6. 5 5
      Demos/materials/TransparencyAdvanced/fTransparencyAdv.pas
  7. 2 2
      Demos/materials/multipass/fMultiPassD.pas
  8. 2 2
      Demos/materials/multipass/fMultipassC.h
  9. 1 1
      Demos/meshes/actor/fActorD.dfm
  10. 1 1
      Demos/meshes/formula/fFormulaC.cpp
  11. 1 1
      Demos/meshes/formula/fFormulaC.h
  12. 2 2
      Demos/meshes/formula/fFormulaD.pas
  13. 1 1
      Demos/movements/objmove/fObjmoveC.cpp
  14. 1 1
      Demos/movements/objmove/fObjmoveD.pas
  15. 1 1
      Demos/physics/NewtonWalkCarry/fNewtonWalkCarryD.pas
  16. 1 2
      Demos/specialsFX/Atmosphere/AtmosphereC.cbproj
  17. 1 1
      Demos/specialsFX/Atmosphere/fAtmosphereC.h
  18. 8 8
      Packages/GLScene_Cg_DT.dproj
  19. 3 3
      Source/GLS.Atmosphere.pas
  20. 4 4
      Source/GLS.BitmapFont.pas
  21. 10 10
      Source/GLS.Canvas.pas
  22. 197 197
      Source/GLS.Color.pas
  23. 136 99
      Source/GLS.Coordinates.pas
  24. 1 1
      Source/GLS.Extrusion.pas
  25. 3 3
      Source/GLS.FBORenderer.pas
  26. 4 4
      Source/GLS.FileMS3D.pas
  27. 2 2
      Source/GLS.FireFX.pas
  28. 1 1
      Source/GLS.GameMenu.pas
  29. 7 7
      Source/GLS.Graph.pas
  30. 2 2
      Source/GLS.LensFlare.pas
  31. 1 1
      Source/GLS.LinePFX.pas
  32. 2 2
      Source/GLS.MaterialEx.pas
  33. 4 4
      Source/GLS.Mesh.pas
  34. 1 1
      Source/GLS.MeshBSP.pas
  35. 1 1
      Source/GLS.Mirror.pas
  36. 10 7
      Source/GLS.Objects.pas
  37. 8 8
      Source/GLS.ParticleFX.pas
  38. 29 29
      Source/GLS.RandomHDS.pas
  39. 1 1
      Source/GLS.RenderContextInfo.pas
  40. 3 3
      Source/GLS.SceneRegister.pas
  41. 1 1
      Source/GLS.ShadowPlane.pas
  42. 12 9
      Source/GLS.SkyDome.pas
  43. 1 1
      Source/GLS.ThorFX.pas
  44. 0 56
      Source/GLS.VectorGeometry.pas
  45. 11 11
      Source/GLS.Windows.pas
  46. 1 1
      Source/GLSL.BumpShaders.pas

+ 5 - 0
AdvDemos/Earth/fEarthD.dfm

@@ -67,6 +67,10 @@ object Form1: TForm1
         SplineMode = lsmSegments
         Options = []
       end
+      object ConstellationBorders: TGLLines
+        Nodes = <>
+        Options = []
+      end
     end
     object DCEarthSystem: TGLDummyCube
       ObjectsSorting = osNone
@@ -108,6 +112,7 @@ object Form1: TForm1
         Material.MaterialLibrary = GLMaterialLibrary
         Material.LibMaterialName = 'earthDay'
         Direction.Coordinates = {000000000000803F0000000000000000}
+        ShowAxes = True
         TurnAngle = -150.000000000000000000
         Up.Coordinates = {00000000000000800000803F00000000}
         Radius = 0.500000000000000000

+ 16 - 14
AdvDemos/Earth/fEarthD.pas

@@ -55,6 +55,7 @@ type
     GLCameraControler: TGLCamera;
     GLSkyDome: TGLSkyDome;
     ConstellationLines: TGLLines;
+    ConstellationBorders: TGLLines;
     procedure FormCreate(Sender: TObject);
     procedure GLDirectOpenGL1Render(Sender: TObject; var rci: TGLRenderContextInfo);
     procedure Timer1Timer(Sender: TObject);
@@ -71,7 +72,7 @@ type
     procedure GLSceneViewerBeforeRender(Sender: TObject);
   private
     procedure LoadConstellationLines;
-    function AtmosphereColor(const rayStart, rayEnd: TGLVector): TColorVector;
+    function AtmosphereColor(const rayStart, rayEnd: TGLVector): TGLColorVector;
   public
     ConstellationsAlpha: Single;
     TimeMultiplier: Single;
@@ -92,8 +93,8 @@ const
   cAtmosphereRadius: Single = 0.55;
   // use value slightly lower than actual radius, for antialiasing effect
   cPlanetRadius: Single = 0.495;
-  cLowAtmColor: TColorVector = (X:1; Y:1; Z:1; W:1);
-  cHighAtmColor: TColorVector = (X:0; Y:0; Z:1; W:1);
+  cLowAtmColor: TGLColorVector = (X:1; Y:1; Z:1; W:1);
+  cHighAtmColor: TGLColorVector = (X:0; Y:0; Z:1; W:1);
   cIntDivTable: array[2..20] of Single =
     (1 / 2, 1 / 3, 1 / 4, 1 / 5, 1 / 6, 1 / 7, 1 / 8, 1 / 9, 1 / 10,
     1 / 11, 1 / 12, 1 / 13, 1 / 14, 1 / 15, 1 / 16, 1 / 17, 1 / 18, 1 / 19, 1 / 20);
@@ -130,11 +131,11 @@ begin
 end;
 
 function TForm1.AtmosphereColor(const rayStart, rayEnd: TGLVector)
-  : TColorVector;
+  : TGLColorVector;
 var
   i, n: Integer;
   atmPoint, normal: TGLVector;
-  altColor: TColorVector;
+  altColor: TGLColorVector;
   alt, rayLength, contrib, decay, intensity, invN: Single;
 
 begin
@@ -177,7 +178,7 @@ end;
 
 procedure TForm1.GLDirectOpenGL1Render(Sender: TObject; var rci: TGLRenderContextInfo);
 
-  function ComputeColor(var rayDest: TGLVector; mayHitGround: Boolean): TColorVector;
+  function ComputeColor(var rayDest: TGLVector; mayHitGround: Boolean): TGLColorVector;
   var
     ai1, ai2, pi1, pi2: TGLVector;
     rayVector: TGLVector;
@@ -241,8 +242,7 @@ begin
     k1 := (cSlices + 1) - k0;
     for j := 0 to cSlices do
     begin
-      VectorCombine(diskRight, diskUp,
-        cosCache[j] * radius, sinCache[j] * radius,
+      VectorCombine(diskRight, diskUp, cosCache[j] * radius, sinCache[j] * radius,
         pVertex[k0 + j]);
       if i < 13 then
         pColor[k0 + j] := ComputeColor(pVertex[k0 + j], i <= 7);
@@ -316,6 +316,7 @@ begin
   sl := TStringList.Create;
   line := TStringList.Create;
   sl.LoadFromFile('Data\Constellations.dat');
+//  sl.LoadFromFile('Data\Constellation_borders.dat');
   for i := 0 to sl.Count - 1 do
   begin
     line.CommaText := sl[i];
@@ -372,12 +373,13 @@ begin
     cameraTimeSteps := cameraTimeSteps - 0.005;
   end;
   // smooth constellation appearance/disappearance
-  with ConstellationLines.LineColor do
-    if Alpha <> constellationsAlpha then
-    begin
-      Alpha := ClampValue(Alpha + Sign(constellationsAlpha - Alpha) * deltaTime, 0, 0.5);
-      ConstellationLines.Visible := (Alpha > 0);
-    end;
+  if ConstellationLines.LineColor.Alpha <> constellationsAlpha then
+  begin
+    ConstellationLines.LineColor.Alpha :=
+      ClampValue(ConstellationLines.LineColor.Alpha + Sign(constellationsAlpha -
+                 ConstellationLines.LineColor.Alpha) * deltaTime, 0, 0.5);
+    ConstellationLines.Visible := (ConstellationLines.LineColor.Alpha > 0);
+  end;
 end;
 
 procedure TForm1.GLSceneViewerMouseDown(Sender: TObject;

+ 2 - 2
AdvDemos/GLSViewer/Source/fMain.pas

@@ -248,8 +248,8 @@ type
   // Hidden line shader (specific implem for the viewer, *not* generic)
   THiddenLineShader = class(TGLShader)
   private
-    LinesColor: TColorVector;
-    BackgroundColor: TColorVector;
+    LinesColor: TGLColorVector;
+    BackgroundColor: TGLColorVector;
     PassCount: Integer;
   public
     procedure DoApply(var rci: TGLRenderContextInfo; Sender: TObject); override;

+ 1 - 1
Demos/behaviours/Torque/fTorqueD.pas

@@ -111,7 +111,7 @@ procedure TFormTorque.GLSceneViewer1MouseDown(Sender: TObject; Button: TMouseBut
   Shift: TShiftState; X, Y: Integer);
 var
   pickedObject: TGLCustomSceneObject;
-  oldColor: TColorVector;
+  oldColor: TGLColorVector;
   rci: TGLRenderContextInfo;
 begin
   // if an object is picked...

+ 6 - 6
Demos/graph/heightfield/fHeightFieldD.pas

@@ -71,11 +71,11 @@ type
   private
 
     procedure Formula1(const X, Y: Single; var z: Single;
-      var Color: TColorVector; var texPoint: TTexPoint);
+      var Color: TGLColorVector; var texPoint: TTexPoint);
     procedure Formula2(const X, Y: Single; var z: Single;
-      var Color: TColorVector; var texPoint: TTexPoint);
+      var Color: TGLColorVector; var texPoint: TTexPoint);
     procedure Formula3(const X, Y: Single; var z: Single;
-      var Color: TColorVector; var texPoint: TTexPoint);
+      var Color: TGLColorVector; var texPoint: TTexPoint);
   public
     mx, my: Integer;
   end;
@@ -97,7 +97,7 @@ begin
 end;
 
 procedure TFormHeightField.Formula1(const X, Y: Single; var z: Single;
-  var Color: TColorVector; var texPoint: TTexPoint);
+  var Color: TGLColorVector; var texPoint: TTexPoint);
 begin
   // first formula
   z := VectorNorm(X, Y);
@@ -106,7 +106,7 @@ begin
 end;
 
 procedure TFormHeightField.Formula2(const X, Y: Single; var z: Single;
-  var Color: TColorVector; var texPoint: TTexPoint);
+  var Color: TGLColorVector; var texPoint: TTexPoint);
 begin
   // 2nd formula
   z := 0.5 * cos(X * 6.28) * sin(Sqrt(abs(Y)) * 6.28);
@@ -114,7 +114,7 @@ begin
 end;
 
 procedure TFormHeightField.Formula3(const X, Y: Single; var z: Single;
-  var Color: TColorVector; var texPoint: TTexPoint);
+  var Color: TGLColorVector; var texPoint: TTexPoint);
 begin
   // 3rd formula, dynamic
   z := 1 / (1 + VectorNorm(Sphere1.position.X - X, Sphere1.position.Y - Y));

+ 5 - 5
Demos/materials/TransparencyAdvanced/fTransparencyAdv.pas

@@ -123,11 +123,11 @@ end;
 
 procedure TForm1.CreateShapes;
 const
-  vLtBlue: TColorVector = (X: 0.00; Y: 0.00; Z: 1.00; W:0.90);
-  vLtPink: TColorVector = (X: 0.40; Y:0.00; Z:0.20; W:0.50);
-  vLtYellow: TColorVector = (X: 0.98; Y:0.96; Z:0.14; W:0.30);
-  vLtMagenta: TColorVector = (X: 0.83; Y:0.04; Z:0.83; W:0.70);
-  vLtGreen: TColorVector = (X: 0.05; Y:0.98; Z:0.14; W:0.30);
+  vLtBlue: TGLColorVector = (X: 0.00; Y: 0.00; Z: 1.00; W:0.90);
+  vLtPink: TGLColorVector = (X: 0.40; Y:0.00; Z:0.20; W:0.50);
+  vLtYellow: TGLColorVector = (X: 0.98; Y:0.96; Z:0.14; W:0.30);
+  vLtMagenta: TGLColorVector = (X: 0.83; Y:0.04; Z:0.83; W:0.70);
+  vLtGreen: TGLColorVector = (X: 0.05; Y:0.98; Z:0.14; W:0.30);
 
 var
   vd: array [0 .. 3] of TGLVertexData;

+ 2 - 2
Demos/materials/multipass/fMultiPassD.pas

@@ -63,7 +63,7 @@ type
 
   THiddenLineShader = class(TGLShader)
   private
-    BackgroundColor, LineColor: TColorVector;
+    BackgroundColor, LineColor: TGLColorVector;
     PassCount: Integer;
   public
     procedure DoApply(var rci: TGLRenderContextInfo; Sender: TObject); override;
@@ -72,7 +72,7 @@ type
 
   TOutLineShader = class(TGLShader)
   private
-    BackgroundColor, LineColor: TColorVector;
+    BackgroundColor, LineColor: TGLColorVector;
     OutlineSmooth, Lighting: Boolean;
     OutlineWidth, Oldlinewidth: Single;
     PassCount: Integer;

+ 2 - 2
Demos/materials/multipass/fMultipassC.h

@@ -51,7 +51,7 @@ public:
 	__fastcall virtual THiddenLineShader(TComponent* AOwner);
 	__fastcall virtual ~THiddenLineShader(void);
 
-        TColorVector BackgroundColor, LineColor;
+        TGLColorVector BackgroundColor, LineColor;
         int PassCount;
 
 	void __fastcall DoApply(TGLRenderContextInfo &rci, System::TObject* Sender);
@@ -66,7 +66,7 @@ public:
 	__fastcall virtual TOutLineShader(TComponent* AOwner);
 	__fastcall virtual ~TOutLineShader(void);
         
-        TColorVector BackgroundColor, LineColor;
+        TGLColorVector BackgroundColor, LineColor;
         bool OutlineSmooth, Lighting;
         float OutlineWidth, OldlineWidth;
         int PassCount;

+ 1 - 1
Demos/meshes/actor/fActorD.dfm

@@ -237,7 +237,7 @@ object FormActor: TFormActor
         Position.Coordinates = {0000000000000000000080BF0000803F}
         Loops = 1
         OuterRadius = 3.000000000000000000
-        Slices = 8
+        Slices = 100
         SweepAngle = 360.000000000000000000
       end
     end

+ 1 - 1
Demos/meshes/formula/fFormulaC.cpp

@@ -40,7 +40,7 @@ TAffineVector __fastcall TForm1::MakeVect(const float aX, const float aY)
 void __fastcall TForm1::AddTriangle(const TAffineVector p1,
 									const TAffineVector p2,
 									const TAffineVector p3,
-									const TColorVector color)
+									const TGLColorVector color)
 {
   Mesh1->Vertices->AddVertex(p1, NullVector, color);
   Mesh1->Vertices->AddVertex(p2, NullVector, color);

+ 1 - 1
Demos/meshes/formula/fFormulaC.h

@@ -63,7 +63,7 @@ private:	// User declarations
 	void __fastcall AddTriangle(const TAffineVector p1,
 						  const TAffineVector p2,
 						  const TAffineVector p3,
-						  const TColorVector color);
+						  const TGLColorVector color);
 public:		// User declarations
 	__fastcall TForm1(TComponent* Owner);
 };

+ 2 - 2
Demos/meshes/formula/fFormulaD.pas

@@ -58,7 +58,7 @@ type
     invRes1, invRes2 : Single;
     function MakeVect(const aX, aY : Single) : TAffineVector;
     procedure AddTriangle(const p1, p2, p3 : TAffineVector;
-                          const color : TColorVector);
+                          const color : TGLColorVector);
   public
      
   end;
@@ -80,7 +80,7 @@ begin
 end;
 
 procedure TFormFormula.AddTriangle(const p1, p2, p3 : TAffineVector;
-                         const color : TColorVector);
+                         const color : TGLColorVector);
 begin
   with Mesh1.Vertices do begin
      AddVertex(p1, NullVector, color);

+ 1 - 1
Demos/movements/objmove/fObjmoveC.cpp

@@ -22,7 +22,7 @@
 #pragma resource "*.dfm"
 TForm1 *Form1;
 
-const TColorVector
+const TGLColorVector
   SelectionColor[]  = {0.243, 0.243, 0.243, 1.000};
 
 

+ 1 - 1
Demos/movements/objmove/fObjmoveD.pas

@@ -86,7 +86,7 @@ type
   end;
 
 const
-  SelectionColor: TColorVector = (X : 0.243; Y : 0.243; Z: 0.243; W : 1.000);
+  SelectionColor: TGLColorVector = (X : 0.243; Y : 0.243; Z: 0.243; W : 1.000);
 
 var
   FormObjmove: TFormObjmove;

+ 1 - 1
Demos/physics/NewtonWalkCarry/fNewtonWalkCarryD.pas

@@ -138,7 +138,7 @@ var
   cp: TPoint;
   visible_cursor: boolean;
   ScObj, FScObj: TGLBaseSceneObject;
-  targetColor: TColorVector;
+  targetColor: TGLColorVector;
   picked: TGLCustomSceneObject;
   mm: TMatrix4f;
 

+ 1 - 2
Demos/specialsFX/Atmosphere/AtmosphereC.cbproj

@@ -63,7 +63,7 @@
         <Multithreaded>true</Multithreaded>
         <ProjectType>CppVCLApplication</ProjectType>
         <_TCHARMapping>wchar_t</_TCHARMapping>
-        <AllPackageLibs>rtl.lib;vcl.lib;GLScene_RT.lib;fmx.lib;xmlrtl.lib;vclimg.lib;GR32_RT.lib</AllPackageLibs>
+        <AllPackageLibs>rtl.lib;vcl.lib;GLScene_RT.lib;fmx.lib;xmlrtl.lib;vclimg.lib</AllPackageLibs>
         <Icon_MainIcon>$(BDS)\bin\cbuilder_PROJECTICON.ico</Icon_MainIcon>
         <DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>
         <DynamicRTL>true</DynamicRTL>
@@ -127,7 +127,6 @@
         <BT_BuildType>Debug</BT_BuildType>
         <FinalOutputDir>.</FinalOutputDir>
         <AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
-        <LinkPackageStatics>GR32_RT.lib</LinkPackageStatics>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Cfg_1_Win64)'!=''">
         <VerInfo_Locale>1033</VerInfo_Locale>

+ 1 - 1
Demos/specialsFX/Atmosphere/fAtmosphereC.h

@@ -9,6 +9,7 @@
 #include <Vcl.StdCtrls.hpp>
 #include <Vcl.Forms.hpp>
 #include <Vcl.ExtCtrls.hpp>
+#include "Vcl.imaging.JPeg.hpp"
 
 #include "GLS.Scene.hpp"
 #include "GLS.Objects.hpp"
@@ -22,7 +23,6 @@
 #include "GLS.Atmosphere.hpp"
 #include "GLS.SimpleNavigation.hpp"
 #include "GLS.Behaviours.hpp"
-#include "JPeg.hpp"
 #include "GLS.Coordinates.hpp"
 #include "GLS.BaseClasses.hpp"
 #include "GLS.Color.hpp"

+ 8 - 8
Packages/GLScene_Cg_DT.dproj

@@ -164,23 +164,23 @@
                         <Overwrite>true</Overwrite>
                     </Platform>
                 </DeployFile>
-                <DeployFile LocalName="$(BDS)\Redist\iossim32\libcgunwind.1.0.dylib" Class="DependencyModule">
-                    <Platform Name="iOSSimulator">
+                <DeployFile LocalName="$(BDS)\Redist\osx32\libcgunwind.1.0.dylib" Class="DependencyModule">
+                    <Platform Name="OSX32">
                         <Overwrite>true</Overwrite>
                     </Platform>
                 </DeployFile>
-                <DeployFile LocalName="$(BDS)\Redist\iossimulator\libcgunwind.1.0.dylib" Class="DependencyModule">
-                    <Platform Name="iOSSimulator">
+                <DeployFile LocalName="$(BDS)\Redist\osx32\libcgsqlite3.dylib" Class="DependencyModule">
+                    <Platform Name="OSX32">
                         <Overwrite>true</Overwrite>
                     </Platform>
                 </DeployFile>
-                <DeployFile LocalName="$(BDS)\Redist\osx32\libcgunwind.1.0.dylib" Class="DependencyModule">
-                    <Platform Name="OSX32">
+                <DeployFile LocalName="$(BDS)\Redist\iossim32\libcgunwind.1.0.dylib" Class="DependencyModule">
+                    <Platform Name="iOSSimulator">
                         <Overwrite>true</Overwrite>
                     </Platform>
                 </DeployFile>
-                <DeployFile LocalName="$(BDS)\Redist\osx32\libcgsqlite3.dylib" Class="DependencyModule">
-                    <Platform Name="OSX32">
+                <DeployFile LocalName="$(BDS)\Redist\iossimulator\libcgunwind.1.0.dylib" Class="DependencyModule">
+                    <Platform Name="iOSSimulator">
                         <Overwrite>true</Overwrite>
                     </Platform>
                 </DeployFile>

+ 3 - 3
Source/GLS.Atmosphere.pas

@@ -169,11 +169,11 @@ var
   diskNormal, diskRight, diskUp:  TGLVector;
 
 
-  function AtmosphereColor(const rayStart, rayEnd: TGLVector): TColorVector;
+  function AtmosphereColor(const rayStart, rayEnd: TGLVector): TGLColorVector;
   var
     I, n:     Integer;
     atmPoint, normal: TGLVector;
-    altColor: TColorVector;
+    altColor: TGLColorVector;
     alt, rayLength, contrib, decay, intensity, invN: Single;
   begin
     Result := clrTransparent;
@@ -214,7 +214,7 @@ var
   end;
 
 
-  function ComputeColor(var rayDest: TGLVector; mayHitGround: Boolean): TColorVector;
+  function ComputeColor(var rayDest: TGLVector; mayHitGround: Boolean): TGLColorVector;
   var
     ai1, ai2, pi1, pi2: TGLVector;
     rayVector: TGLVector;

+ 4 - 4
Source/GLS.BitmapFont.pas

@@ -189,13 +189,13 @@ type
        Enable states are also possibly altered. *)
     procedure RenderString(var ARci: TGLRenderContextInfo;
       const aText: UnicodeString; aAlignment: TAlignment;
-      aLayout: TTextLayout; const aColor: TColorVector;
+      aLayout: TTextLayout; const aColor: TGLColorVector;
       aPosition: PGLVector = nil; aReverseY: boolean = False); overload; virtual;
     (* A simpler canvas-style TextOut helper for RenderString.
        The rendering is reversed along Y by default, to allow direct use
        with TGLCanvas *)
     procedure TextOut(var rci: TGLRenderContextInfo; X, Y: Single;
-      const Text: UnicodeString; const Color: TColorVector); overload;
+      const Text: UnicodeString; const Color: TGLColorVector); overload;
     procedure TextOut(var rci: TGLRenderContextInfo; X, Y: Single;
       const Text: UnicodeString; const Color: TColor); overload;
     function TextWidth(const Text: UnicodeString): Integer;
@@ -832,7 +832,7 @@ end;
 
 procedure TGLCustomBitmapFont.RenderString(var ARci: TGLRenderContextInfo;
   const aText: UnicodeString; aAlignment: TAlignment; aLayout: TTextLayout;
-  const aColor: TColorVector; aPosition: PGLVector = nil;
+  const aColor: TGLColorVector; aPosition: PGLVector = nil;
   aReverseY: boolean = False);
 
   function AlignmentAdjustement(p: Integer): Single;
@@ -964,7 +964,7 @@ begin
 end;
 
 procedure TGLCustomBitmapFont.TextOut(var rci: TGLRenderContextInfo; X, Y: Single;
-  const Text: UnicodeString; const Color: TColorVector);
+  const Text: UnicodeString; const Color: TGLColorVector);
 var
   V: TGLVector;
 begin

+ 10 - 10
Source/GLS.Canvas.pas

@@ -121,9 +121,9 @@ type
     procedure FillRect(const x1, y1, x2, y2: Single); overload;
     // Draw the (x1,y1)-(x2, y2) rectangle (filled with given gradient's color). 
     procedure FillRectGradient(const x1, y1, x2, y2: Single;
-      const x1y1Color, x2y1Color, x2y2Color, x1y2Color: TColorVector); overload;
+      const x1y1Color, x2y1Color, x2y2Color, x1y2Color: TGLColorVector); overload;
     procedure FillRectGradient(const x1, y1, x2, y2: Integer;
-      const x1y1Color, x2y1Color, x2y2Color, x1y2Color: TColorVector); overload;
+      const x1y1Color, x2y1Color, x2y2Color, x1y2Color: TGLColorVector); overload;
     // Draws an ellipse with (x1,y1)-(x2, y2) bounding rectangle. 
     procedure EllipseBB(const x1, y1, x2, y2: Integer); overload;
     procedure EllipseBB(const x1, y1, x2, y2: Single); overload;
@@ -139,11 +139,11 @@ type
     OpenGL will use the last PenColor and PenAlpha as the center color and do gradient 
   	to edge of ellipse using the edgeColor parameter. *)
     procedure FillEllipseGradient(const x, y, xRadius, yRadius: Single;
-      const edgeColor: TColorVector); overload;
+      const edgeColor: TGLColorVector); overload;
     procedure FillEllipseGradient(const x, y: Integer;
-      const xRadius, yRadius: Integer; const edgeColor: TColorVector); overload;
+      const xRadius, yRadius: Integer; const edgeColor: TGLColorVector); overload;
     procedure FillEllipseGradient(const x, y, Radius: Single;
-      const edgeColor: TColorVector); overload;
+      const edgeColor: TGLColorVector); overload;
     (* Draw an elliptical arc.
        The points (x1, y1) and (x2, y2) specify the bounding rectangle.
        An ellipse formed by the specified bounding rectangle defines the curve of the arc.
@@ -525,7 +525,7 @@ begin
 end;
 
 procedure TGLCanvas.FillRectGradient(const x1, y1, x2, y2: Single;
-  const x1y1Color, x2y1Color, x2y2Color, x1y2Color: TColorVector);
+  const x1y1Color, x2y1Color, x2y2Color, x1y2Color: TGLColorVector);
 begin
   StartPrimitive(GL_QUADS);
   gl.Color4f(x1y1Color.X, x1y1Color.Y, x1y1Color.Z, x1y1Color.W);
@@ -543,7 +543,7 @@ begin
 end;
 
 procedure TGLCanvas.FillRectGradient(const x1, y1, x2, y2: Integer;
-  const x1y1Color, x2y1Color, x2y2Color, x1y2Color: TColorVector);
+  const x1y1Color, x2y1Color, x2y2Color, x1y2Color: TGLColorVector);
 begin
   StartPrimitive(GL_QUADS);
   gl.Color4f(x1y1Color.X, x1y1Color.Y, x1y1Color.Z, x1y1Color.W);
@@ -560,7 +560,7 @@ begin
   gl.Color4fv(@FCurrentPenColorVector);
 end;
 
-procedure TGLCanvas.FillEllipseGradient(const x, y: Integer; const xRadius, yRadius: Integer; const edgeColor: TColorVector);
+procedure TGLCanvas.FillEllipseGradient(const x, y: Integer; const xRadius, yRadius: Integer; const edgeColor: TGLColorVector);
 begin
   StartPrimitive(GL_TRIANGLE_FAN);
 
@@ -576,7 +576,7 @@ begin
   gl.Color4fv(@FCurrentPenColorVector);
 end;
 
-procedure TGLCanvas.FillEllipseGradient(const x, y, xRadius, yRadius: Single; const edgeColor: TColorVector);
+procedure TGLCanvas.FillEllipseGradient(const x, y, xRadius, yRadius: Single; const edgeColor: TGLColorVector);
 begin
   StartPrimitive(GL_TRIANGLE_FAN);
   gl.Vertex2f(x, y); // really necessary now :)
@@ -588,7 +588,7 @@ begin
   gl.Color4fv(@FCurrentPenColorVector);
 end;
 
-procedure TGLCanvas.FillEllipseGradient(const x, y, Radius: Single; const edgeColor: TColorVector);
+procedure TGLCanvas.FillEllipseGradient(const x, y, Radius: Single; const edgeColor: TGLColorVector);
 begin
   FillEllipseGradient(x, y, Radius, Radius, edgeColor);
 end;

+ 197 - 197
Source/GLS.Color.pas

@@ -23,8 +23,8 @@ uses
   GLS.BaseClasses;
 
 type
-  PColorVector = ^TColorVector;
-  TColorVector = TVector4f;
+  PColorVector = ^TGLColorVector;
+  TGLColorVector = TVector4f;
 
   PRGBColor = ^TRGBColor;
   TRGBColor = TVector3b;
@@ -32,14 +32,14 @@ type
   // Wraps an OpenGL color.
   TGLColor = class(TGLUpdateAbleObject)
   private
-    FColor: TColorVector;
+    FColor: TGLColorVector;
     FPDefaultColor: PColorVector;
-    procedure SetColorVector(const aColor: TColorVector); overload;
+    procedure SetColorVector(const aColor: TGLColorVector); overload;
     procedure SetColorComponent(index: Integer; value: Single);
     function GetColorComponent(const index: Integer): Single;
     procedure SetAsWinColor(const val: TColor);
     function GetAsWinColor: TColor;
-    procedure SetDirectColorVector(const aColor: TColorVector);
+    procedure SetDirectColorVector(const aColor: TGLColorVector);
   protected
     procedure DefineProperties(Filer: TFiler); override;
     procedure ReadData(Stream: TStream);
@@ -49,19 +49,19 @@ type
   public
     constructor Create(AOwner: TPersistent); override;
     constructor CreateInitialized(AOwner: TPersistent;
-      const Color: TColorVector; changeEvent: TNotifyEvent = nil);
+      const Color: TGLColorVector; changeEvent: TNotifyEvent = nil);
     destructor Destroy; override;
     procedure NotifyChange(Sender: TObject); override;
     procedure Assign(Source: TPersistent); override;
-    procedure Initialize(const color: TColorVector);
+    procedure Initialize(const color: TGLColorVector);
     function AsAddress: PSingle;
     procedure RandomColor;
     procedure SetColor(Red, Green, Blue: Single; Alpha: Single = 1); overload;
-    property Color: TColorVector read FColor write SetColorVector;
-    property DirectColor: TColorVector read FColor write SetDirectColorVector;
+    property Color: TGLColorVector read FColor write SetColorVector;
+    property DirectColor: TGLColorVector read FColor write SetDirectColorVector;
     property AsWinColor: TColor read GetAsWinColor write SetAsWinColor;
     property hsva: TGLVector read GetHSVA write SetHSVA;
-    property DefaultColor: TColorVector read FColor;
+    property DefaultColor: TGLColorVector read FColor;
   published
     property Red: Single index 0 read GetColorComponent write SetColorComponent
       stored False;
@@ -73,23 +73,23 @@ type
       write SetColorComponent stored False;
   end;
 
-  PColorEntry = ^TColorEntry;
+  PGLColorEntry = ^TGLColorEntry;
 
-  TColorEntry = record
+  TGLColorEntry = record
     Name: String;
-    Color: TColorVector;
+    Color: TGLColorVector;
   end;
 
   TGLColorManager = class(TList)
   public
     destructor Destroy; override;
-    procedure AddColor(const aName: String; const aColor: TColorVector);
+    procedure AddColor(const aName: String; const aColor: TGLColorVector);
     procedure EnumColors(Proc: TGetStrProc); overload;
     procedure EnumColors(AValues: TStrings); overload;
-    function FindColor(const aName: String): TColorVector;
+    function FindColor(const aName: String): TGLColorVector;
     // Convert a clrXxxx or a '<Red Green Blue Alpha> to a color vector
-    function GetColor(const aName: String): TColorVector;
-    function GetColorName(const aColor: TColorVector): String;
+    function GetColor(const aName: String): TGLColorVector;
+    function GetColorName(const aColor: TGLColorVector): String;
     procedure RegisterDefaultColors;
     procedure RemoveColor(const aName: String);
   end;
@@ -97,21 +97,21 @@ type
 // Builds a TColor from Red Green Blue components.
 function RGB2Color(const r, g, b: Byte): TColor; inline;
 function ColorManager: TGLColorManager;
-procedure RegisterColor(const aName: String; const aColor: TColorVector);
+procedure RegisterColor(const aName: String; const aColor: TGLColorVector);
 procedure UnRegisterColor(const aName: String);
 function GetRValue(rgb: DWORD): Byte; {$NODEFINE GetRValue}
 function GetGValue(rgb: DWORD): Byte; {$NODEFINE GetGValue}
 function GetBValue(rgb: DWORD): Byte; {$NODEFINE GetBValue}
 procedure InitGLSceneColors;
 // Converts a delphi color into its RGB fragments and correct range.
-function ConvertWinColor(aColor: TColor; Alpha: Single = 1): TColorVector;
+function ConvertWinColor(aColor: TColor; Alpha: Single = 1): TGLColorVector;
 // Converts a color vector (containing float values)
-function ConvertColorVector(const aColor: TColorVector): TColor; overload;
+function ConvertColorVector(const aColor: TGLColorVector): TColor; overload;
 (* Converts a color vector (containing float values) and alter intensity.
   intensity is in [0..1] *)
-function ConvertColorVector(const aColor: TColorVector; intensity: Single): TColor; overload;
+function ConvertColorVector(const aColor: TGLColorVector; intensity: Single): TColor; overload;
 // Converts RGB components into a color vector with correct range
-function ConvertRGBColor(const aColor: array of Byte): TColorVector;
+function ConvertRGBColor(const aColor: array of Byte): TGLColorVector;
 
 // color definitions
 const
@@ -192,166 +192,166 @@ const
   // since they depend on the desktop scheme)
 const
 {$J+ - allow change of the following typed constants}
-  clrScrollBar: TColorVector = (X: 0; Y: 0; Z: 0; W: 1);
-  clrBackground: TColorVector = (X: 0; Y: 0; Z: 0; W: 1);
-  clrActiveCaption: TColorVector = (X: 0; Y: 0; Z: 0; W: 1);
-  clrInactiveCaption: TColorVector = (X: 0; Y: 0; Z: 0; W: 1);
-  clrMenu: TColorVector = (X: 0; Y: 0; Z: 0; W: 1);
-  clrWindow: TColorVector = (X: 0; Y: 0; Z: 0; W: 1);
-  clrWindowFrame: TColorVector = (X: 0; Y: 0; Z: 0; W: 1);
-  clrMenuText: TColorVector = (X: 0; Y: 0; Z: 0; W: 1);
-  clrWindowText: TColorVector = (X: 0; Y: 0; Z: 0; W: 1);
-  clrCaptionText: TColorVector = (X: 0; Y: 0; Z: 0; W: 1);
-  clrActiveBorder: TColorVector = (X: 0; Y: 0; Z: 0; W: 1);
-  clrInactiveBorder: TColorVector = (X: 0; Y: 0; Z: 0; W: 1);
-  clrAppWorkSpace: TColorVector = (X: 0; Y: 0; Z: 0; W: 1);
-  clrHighlight: TColorVector = (X: 0; Y: 0; Z: 0; W: 1);
-  clrHighlightText: TColorVector = (X: 0; Y: 0; Z: 0; W: 1);
-  clrBtnFace: TColorVector = (X: 0; Y: 0; Z: 0; W: 1);
-  clrBtnShadow: TColorVector = (X: 0; Y: 0; Z: 0; W: 1);
-  clrGrayText: TColorVector = (X: 0; Y: 0; Z: 0; W: 1);
-  clrBtnText: TColorVector = (X: 0; Y: 0; Z: 0; W: 1);
-  clrInactiveCaptionText: TColorVector = (X: 0; Y: 0; Z: 0; W: 1);
-  clrBtnHighlight: TColorVector = (X: 0; Y: 0; Z: 0; W: 1);
-  clr3DDkShadow: TColorVector = (X: 0; Y: 0; Z: 0; W: 1);
-  clr3DLight: TColorVector = (X: 0; Y: 0; Z: 0; W: 1);
-  clrInfoText: TColorVector = (X: 0; Y: 0; Z: 0; W: 1);
-  clrInfoBk: TColorVector = (X: 0; Y: 0; Z: 0; W: 1);
+  clrScrollBar: TGLColorVector = (X: 0; Y: 0; Z: 0; W: 1);
+  clrBackground: TGLColorVector = (X: 0; Y: 0; Z: 0; W: 1);
+  clrActiveCaption: TGLColorVector = (X: 0; Y: 0; Z: 0; W: 1);
+  clrInactiveCaption: TGLColorVector = (X: 0; Y: 0; Z: 0; W: 1);
+  clrMenu: TGLColorVector = (X: 0; Y: 0; Z: 0; W: 1);
+  clrWindow: TGLColorVector = (X: 0; Y: 0; Z: 0; W: 1);
+  clrWindowFrame: TGLColorVector = (X: 0; Y: 0; Z: 0; W: 1);
+  clrMenuText: TGLColorVector = (X: 0; Y: 0; Z: 0; W: 1);
+  clrWindowText: TGLColorVector = (X: 0; Y: 0; Z: 0; W: 1);
+  clrCaptionText: TGLColorVector = (X: 0; Y: 0; Z: 0; W: 1);
+  clrActiveBorder: TGLColorVector = (X: 0; Y: 0; Z: 0; W: 1);
+  clrInactiveBorder: TGLColorVector = (X: 0; Y: 0; Z: 0; W: 1);
+  clrAppWorkSpace: TGLColorVector = (X: 0; Y: 0; Z: 0; W: 1);
+  clrHighlight: TGLColorVector = (X: 0; Y: 0; Z: 0; W: 1);
+  clrHighlightText: TGLColorVector = (X: 0; Y: 0; Z: 0; W: 1);
+  clrBtnFace: TGLColorVector = (X: 0; Y: 0; Z: 0; W: 1);
+  clrBtnShadow: TGLColorVector = (X: 0; Y: 0; Z: 0; W: 1);
+  clrGrayText: TGLColorVector = (X: 0; Y: 0; Z: 0; W: 1);
+  clrBtnText: TGLColorVector = (X: 0; Y: 0; Z: 0; W: 1);
+  clrInactiveCaptionText: TGLColorVector = (X: 0; Y: 0; Z: 0; W: 1);
+  clrBtnHighlight: TGLColorVector = (X: 0; Y: 0; Z: 0; W: 1);
+  clr3DDkShadow: TGLColorVector = (X: 0; Y: 0; Z: 0; W: 1);
+  clr3DLight: TGLColorVector = (X: 0; Y: 0; Z: 0; W: 1);
+  clrInfoText: TGLColorVector = (X: 0; Y: 0; Z: 0; W: 1);
+  clrInfoBk: TGLColorVector = (X: 0; Y: 0; Z: 0; W: 1);
 
 {$J- - disable change of other typed constants}
   // 'static' color definitions sort of grays
-  clrTransparent: TColorVector = (X: 0; Y: 0; Z: 0; W: 0);
-  clrBlack: TColorVector = (X: 0; Y: 0; Z: 0; W: 1);
-  clrGray05: TColorVector = (X: 0.05; Y: 0.05; Z: 0.05; W: 1);
-  clrGray10: TColorVector = (X: 0.10; Y: 0.10; Z: 0.10; W: 1);
-  clrGray15: TColorVector = (X: 0.15; Y: 0.15; Z: 0.15; W: 1);
-  clrGray20: TColorVector = (X: 0.20; Y: 0.20; Z: 0.20; W: 1);
-  clrGray25: TColorVector = (X: 0.25; Y: 0.25; Z: 0.25; W: 1);
-  clrGray30: TColorVector = (X: 0.30; Y: 0.30; Z: 0.30; W: 1);
-  clrGray35: TColorVector = (X: 0.35; Y: 0.35; Z: 0.35; W: 1);
-  clrGray40: TColorVector = (X: 0.40; Y: 0.40; Z: 0.40; W: 1);
-  clrGray45: TColorVector = (X: 0.45; Y: 0.45; Z: 0.45; W: 1);
-  clrGray50: TColorVector = (X: 0.50; Y: 0.50; Z: 0.50; W: 1);
-  clrGray55: TColorVector = (X: 0.55; Y: 0.55; Z: 0.55; W: 1);
-  clrGray60: TColorVector = (X: 0.60; Y: 0.60; Z: 0.60; W: 1);
-  clrGray65: TColorVector = (X: 0.65; Y: 0.65; Z: 0.65; W: 1);
-  clrGray70: TColorVector = (X: 0.70; Y: 0.70; Z: 0.70; W: 1);
-  clrGray75: TColorVector = (X: 0.75; Y: 0.75; Z: 0.75; W: 1);
-  clrGray80: TColorVector = (X: 0.80; Y: 0.80; Z: 0.80; W: 1);
-  clrGray85: TColorVector = (X: 0.85; Y: 0.85; Z: 0.85; W: 1);
-  clrGray90: TColorVector = (X: 0.90; Y: 0.90; Z: 0.90; W: 1);
-  clrGray95: TColorVector = (X: 0.95; Y: 0.95; Z: 0.95; W: 1);
-  clrWhite: TColorVector = (X: 1; Y: 1; Z: 1; W: 1);
+  clrTransparent: TGLColorVector = (X: 0; Y: 0; Z: 0; W: 0);
+  clrBlack: TGLColorVector = (X: 0; Y: 0; Z: 0; W: 1);
+  clrGray05: TGLColorVector = (X: 0.05; Y: 0.05; Z: 0.05; W: 1);
+  clrGray10: TGLColorVector = (X: 0.10; Y: 0.10; Z: 0.10; W: 1);
+  clrGray15: TGLColorVector = (X: 0.15; Y: 0.15; Z: 0.15; W: 1);
+  clrGray20: TGLColorVector = (X: 0.20; Y: 0.20; Z: 0.20; W: 1);
+  clrGray25: TGLColorVector = (X: 0.25; Y: 0.25; Z: 0.25; W: 1);
+  clrGray30: TGLColorVector = (X: 0.30; Y: 0.30; Z: 0.30; W: 1);
+  clrGray35: TGLColorVector = (X: 0.35; Y: 0.35; Z: 0.35; W: 1);
+  clrGray40: TGLColorVector = (X: 0.40; Y: 0.40; Z: 0.40; W: 1);
+  clrGray45: TGLColorVector = (X: 0.45; Y: 0.45; Z: 0.45; W: 1);
+  clrGray50: TGLColorVector = (X: 0.50; Y: 0.50; Z: 0.50; W: 1);
+  clrGray55: TGLColorVector = (X: 0.55; Y: 0.55; Z: 0.55; W: 1);
+  clrGray60: TGLColorVector = (X: 0.60; Y: 0.60; Z: 0.60; W: 1);
+  clrGray65: TGLColorVector = (X: 0.65; Y: 0.65; Z: 0.65; W: 1);
+  clrGray70: TGLColorVector = (X: 0.70; Y: 0.70; Z: 0.70; W: 1);
+  clrGray75: TGLColorVector = (X: 0.75; Y: 0.75; Z: 0.75; W: 1);
+  clrGray80: TGLColorVector = (X: 0.80; Y: 0.80; Z: 0.80; W: 1);
+  clrGray85: TGLColorVector = (X: 0.85; Y: 0.85; Z: 0.85; W: 1);
+  clrGray90: TGLColorVector = (X: 0.90; Y: 0.90; Z: 0.90; W: 1);
+  clrGray95: TGLColorVector = (X: 0.95; Y: 0.95; Z: 0.95; W: 1);
+  clrWhite: TGLColorVector = (X: 1; Y: 1; Z: 1; W: 1);
 
   // other grays
-  clrDimGray: TColorVector = (X: 0.329412; Y: 0.329412; Z: 0.329412; W: 1);
-  clrGray: TColorVector = (X: 0.752941; Y: 0.752941; Z: 0.752941; W: 1);
-  clrLightGray: TColorVector = (X: 0.658824; Y: 0.658824; Z: 0.658824; W: 1);
+  clrDimGray: TGLColorVector = (X: 0.329412; Y: 0.329412; Z: 0.329412; W: 1);
+  clrGray: TGLColorVector = (X: 0.752941; Y: 0.752941; Z: 0.752941; W: 1);
+  clrLightGray: TGLColorVector = (X: 0.658824; Y: 0.658824; Z: 0.658824; W: 1);
 
   // colors en masse
-  clrAqua: TColorVector = (X: 0; Y: 1; Z: 1; W: 1);
-  clrAquamarine: TColorVector = (X: 0.439216; Y: 0.858824; Z: 0.576471; W: 1);
-  clrBakersChoc: TColorVector = (X: 0.36; Y: 0.20; Z: 0.09; W: 1);
-  clrBlue: TColorVector = (X: 0; Y: 0; Z: 1; W: 1);
-  clrBlueViolet: TColorVector = (X: 0.62352; Y: 0.372549; Z: 0.623529; W: 1);
-  clrBrown: TColorVector = (X: 0.647059; Y: 0.164706; Z: 0.164706; W: 1);
-  clrCadetBlue: TColorVector = (X: 0.372549; Y: 0.623529; Z: 0.623529; W: 1);
-  clrCoral: TColorVector = (X: 1; Y: 0.498039; Z: 0.0; W: 1);
-  clrCornflowerBlue: TColorVector = (X: 0.258824; Y: 0.258824; Z: 0.435294; W: 1);
-  clrDarkGreen: TColorVector = (X: 0.184314; Y: 0.309804; Z: 0.184314; W: 1);
-  clrDarkOliveGreen: TColorVector = (X: 0.309804; Y: 0.309804; Z: 0.184314; W: 1);
-  clrDarkOrchid: TColorVector = (X: 0.6; Y: 0.196078; Z: 0.8; W: 1);
-  clrDarkSlateBlue: TColorVector = (X: 0.419608; Y: 0.137255; Z: 0.556863; W: 1);
-  clrDarkSlateGray: TColorVector = (X: 0.184314; Y: 0.309804; Z: 0.309804; W: 1);
-  clrDarkSlateGrey: TColorVector = (X: 0.184314; Y: 0.309804; Z: 0.309804; W: 1);
-  clrDarkTurquoise: TColorVector = (X: 0.439216; Y: 0.576471; Z: 0.858824; W: 1);
-  clrFirebrick: TColorVector = (X: 0.556863; Y: 0.137255; Z: 0.137255; W: 1);
-  clrForestGreen: TColorVector = (X: 0.137255; Y: 0.556863; Z: 0.137255; W: 1);
-  clrFuchsia: TColorVector = (X: 1; Y: 0; Z: 1; W: 1);
-  clrGold: TColorVector = (X: 0.8; Y: 0.498039; Z: 0.196078; W: 1);
-  clrGoldenrod: TColorVector = (X: 0.858824; Y: 0.858824; Z: 0.439216; W: 1);
-  clrGreenYellow: TColorVector = (X: 0.576471; Y: 0.858824; Z: 0.439216; W: 1);
-  clrIndian: TColorVector = (X: 0.309804; Y: 0.184314; Z: 0.184314; W: 1);
-  clrKhaki: TColorVector = (X: 0.623529; Y: 0.623529; Z: 0.372549; W: 1);
-  clrLightBlue: TColorVector = (X: 0.74902; Y: 0.847059; Z: 0.847059; W: 1);
-  clrLightSteelBlue: TColorVector = (X: 0.560784; Y: 0.560784; Z: 0.737255; W: 1);
-  clrLime: TColorVector = (X: 0; Y: 1; Z: 0; W: 1);
-  clrLimeGreen: TColorVector = (X: 0.196078; Y: 0.8; Z: 0.196078; W: 1);
-  clrMaroon: TColorVector = (X: 0.556863; Y: 0.137255; Z: 0.419608; W: 1);
-  clrMediumAquamarine: TColorVector = (X: 0.196078; Y: 0.8; Z: 0.6; W: 1);
-  clrMediumBlue: TColorVector = (X: 0.196078; Y: 0.196078; Z: 0.8; W: 1);
-  clrMediumForestGreen: TColorVector = (X: 0.419608; Y: 0.556863; Z: 0.137255; W: 1);
-  clrMediumGoldenrod: TColorVector = (X: 0.917647; Y: 0.917647; Z: 0.678431; W: 1);
-  clrMediumOrchid: TColorVector = (X: 0.576471; Y: 0.439216; Z: 0.858824; W: 1);
-  clrMediumSeaGreen: TColorVector = (X: 0.258824; Y: 0.435294; Z: 0.258824; W: 1);
-  clrMediumSlateBlue: TColorVector = (X: 0.498039; Y: 0; Z: 1; W: 1);
-  clrMediumSpringGreen: TColorVector = (X: 0.498039; Y: 1; Z: 0; W: 1);
-  clrMediumTurquoise: TColorVector = (X: 0.439216; Y: 0.858824; Z: 0.858824; W: 1);
-  clrMediumViolet: TColorVector = (X: 0.858824; Y: 0.439216; Z: 0.576471; W: 1);
-  clrMediumPurple: TColorVector = (X: 0.73; Y: 0.16; Z: 0.96; W: 1);
-  clrMidnightBlue: TColorVector = (X: 0.184314; Y: 0.184314; Z: 0.309804; W: 1);
-  clrNavy: TColorVector = (X: 0.137255; Y: 0.137255; Z: 0.556863; W: 1);
-  clrNavyBlue: TColorVector = (X: 0.137255; Y: 0.137255; Z: 0.556863; W: 1);
-  clrOrange: TColorVector = (X: 1; Y: 0.5; Z: 0.0; W: 1);
-  clrOrangeRed: TColorVector = (X: 1; Y: 0.25; Z: 0; W: 1);
-  clrOrchid: TColorVector = (X: 0.858824; Y: 0.439216; Z: 0.858824; W: 1);
-  clrPaleGreen: TColorVector = (X: 0.560784; Y: 0.737255; Z: 0.560784; W: 1);
-  clrPink: TColorVector = (X: 0.737255; Y: 0.560784; Z: 0.560784; W: 1);
-  clrPlum: TColorVector = (X: 0.917647; Y: 0.678431; Z: 0.917647; W: 1);
-  clrSalmon: TColorVector = (X: 0.435294; Y: 0.258824; Z: 0.258824; W: 1);
-  clrSeaGreen: TColorVector = (X: 0.137255; Y: 0.556863; Z: 0.419608; W: 1);
-  clrSienna: TColorVector = (X: 0.556863; Y: 0.419608; Z: 0.137255; W: 1);
-  clrSkyBlue: TColorVector = (X: 0.196078; Y: 0.6; Z: 0.8; W: 1);
-  clrSlateBlue: TColorVector = (X: 0; Y: 0.498039; Z: 1; W: 1);
-  clrSpringGreen: TColorVector = (X: 0; Y: 1; Z: 0.498039; W: 1);
-  clrSteelBlue: TColorVector = (X: 0.137255; Y: 0.419608; Z: 0.556863; W: 1);
-  clrTan: TColorVector = (X: 0.858824; Y: 0.576471; Z: 0.439216; W: 1);
-  clrThistle: TColorVector = (X: 0.847059; Y: 0.74902; Z: 0.847059; W: 1);
-  clrTurquoise: TColorVector = (X: 0.678431; Y: 0.917647; Z: 0.917647; W: 1);
-  clrViolet: TColorVector = (X: 0.309804; Y: 0.184314; Z: 0.309804; W: 1);
-  clrVioletRed: TColorVector = (X: 0.8; Y: 0.196078; Z: 0.6; W: 1);
-  clrYellowGreen: TColorVector = (X: 0.6; Y: 0.8; Z: 0.196078; W: 1);
-  clrSummerSky: TColorVector = (X: 0.22; Y: 0.69; Z: 0.87; W: 1);
-  clrRichBlue: TColorVector = (X: 0.35; Y: 0.35; Z: 0.67; W: 1);
-  clrBrass: TColorVector = (X: 0.71; Y: 0.65; Z: 0.26; W: 1);
-  clrCopper: TColorVector = (X: 0.72; Y: 0.45; Z: 0.20; W: 1);
-  clrBronze: TColorVector = (X: 0.55; Y: 0.47; Z: 0.14; W: 1);
-  clrBronze2: TColorVector = (X: 0.65; Y: 0.49; Z: 0.24; W: 1);
-  clrSilver: TColorVector = (X: 0.90; Y: 0.91; Z: 0.98; W: 1);
-  clrBrightGold: TColorVector = (X: 0.85; Y: 0.85; Z: 0.10; W: 1);
-  clrOldGold: TColorVector = (X: 0.81; Y: 0.71; Z: 0.23; W: 1);
-  clrFeldspar: TColorVector = (X: 0.82; Y: 0.57; Z: 0.46; W: 1);
-  clrQuartz: TColorVector = (X: 0.85; Y: 0.85; Z: 0.95; W: 1);
-  clrNeonPink: TColorVector = (X: 1.00; Y: 0.43; Z: 0.78; W: 1);
-  clrDarkPurple: TColorVector = (X: 0.53; Y: 0.12; Z: 0.47; W: 1);
-  clrNeonBlue: TColorVector = (X: 0.30; Y: 0.30; Z: 1.00; W: 1);
-  clrCoolCopper: TColorVector = (X: 0.85; Y: 0.53; Z: 0.10; W: 1);
-  clrMandarinOrange: TColorVector = (X: 0.89; Y: 0.47; Z: 0.20; W: 1);
-  clrLightWood: TColorVector = (X: 0.91; Y: 0.76; Z: 0.65; W: 1);
-  clrMediumWood: TColorVector = (X: 0.65; Y: 0.50; Z: 0.39; W: 1);
-  clrDarkWood: TColorVector = (X: 0.52; Y: 0.37; Z: 0.26; W: 1);
-  clrSpicyPink: TColorVector = (X: 1.00; Y: 0.11; Z: 0.68; W: 1);
-  clrSemiSweetChoc: TColorVector = (X: 0.42; Y: 0.26; Z: 0.15; W: 1);
-  clrFlesh: TColorVector = (X: 0.96; Y: 0.80; Z: 0.69; W: 1);
-  clrNewTan: TColorVector = (X: 0.92; Y: 0.78; Z: 0.62; W: 1);
-  clrNewMidnightBlue: TColorVector = (X: 0.00; Y: 0.00; Z: 0.61; W: 1);
-  clrVeryDarkBrown: TColorVector = (X: 0.35; Y: 0.16; Z: 0.14; W: 1);
-  clrDarkBrown: TColorVector = (X: 0.36; Y: 0.25; Z: 0.20; W: 1);
-  clrDarkTan: TColorVector = (X: 0.59; Y: 0.41; Z: 0.31; W: 1);
-  clrGreenCopper: TColorVector = (X: 0.32; Y: 0.49; Z: 0.46; W: 1);
-  clrDkGreenCopper: TColorVector = (X: 0.29; Y: 0.46; Z: 0.43; W: 1);
-  clrDustyRose: TColorVector = (X: 0.52; Y: 0.39; Z: 0.39; W: 1);
-  clrHuntersGreen: TColorVector = (X: 0.13; Y: 0.37; Z: 0.31; W: 1);
-  clrScarlet: TColorVector = (X: 0.55; Y: 0.09; Z: 0.09; W: 1);
-  clrLightPurple: TColorVector = (X: 0.87; Y: 0.58; Z: 0.98; W: 1);
-  clrVeryLightPurple: TColorVector = (X: 0.94; Y: 0.81; Z: 0.99; W: 1);
-  clrGreen: TColorVector = (X: 0; Y: 0.5; Z: 0; W: 1);
-  clrOlive: TColorVector = (X: 0.5; Y: 0.5; Z: 1; W: 1);
-  clrPurple: TColorVector = (X: 1; Y: 0; Z: 1; W: 1);
-  clrTeal: TColorVector = (X: 0; Y: 0.5; Z: 0.5; W: 1);
-  clrRed: TColorVector = (X: 1; Y: 0; Z: 0; W: 1);
-  clrYellow: TColorVector = (X: 1; Y: 1; Z: 0; W: 1);
-  clrWheat: TColorVector = (X: 0.847059; Y: 0.847059; Z: 0.74902; W: 1);
+  clrAqua: TGLColorVector = (X: 0; Y: 1; Z: 1; W: 1);
+  clrAquamarine: TGLColorVector = (X: 0.439216; Y: 0.858824; Z: 0.576471; W: 1);
+  clrBakersChoc: TGLColorVector = (X: 0.36; Y: 0.20; Z: 0.09; W: 1);
+  clrBlue: TGLColorVector = (X: 0; Y: 0; Z: 1; W: 1);
+  clrBlueViolet: TGLColorVector = (X: 0.62352; Y: 0.372549; Z: 0.623529; W: 1);
+  clrBrown: TGLColorVector = (X: 0.647059; Y: 0.164706; Z: 0.164706; W: 1);
+  clrCadetBlue: TGLColorVector = (X: 0.372549; Y: 0.623529; Z: 0.623529; W: 1);
+  clrCoral: TGLColorVector = (X: 1; Y: 0.498039; Z: 0.0; W: 1);
+  clrCornflowerBlue: TGLColorVector = (X: 0.258824; Y: 0.258824; Z: 0.435294; W: 1);
+  clrDarkGreen: TGLColorVector = (X: 0.184314; Y: 0.309804; Z: 0.184314; W: 1);
+  clrDarkOliveGreen: TGLColorVector = (X: 0.309804; Y: 0.309804; Z: 0.184314; W: 1);
+  clrDarkOrchid: TGLColorVector = (X: 0.6; Y: 0.196078; Z: 0.8; W: 1);
+  clrDarkSlateBlue: TGLColorVector = (X: 0.419608; Y: 0.137255; Z: 0.556863; W: 1);
+  clrDarkSlateGray: TGLColorVector = (X: 0.184314; Y: 0.309804; Z: 0.309804; W: 1);
+  clrDarkSlateGrey: TGLColorVector = (X: 0.184314; Y: 0.309804; Z: 0.309804; W: 1);
+  clrDarkTurquoise: TGLColorVector = (X: 0.439216; Y: 0.576471; Z: 0.858824; W: 1);
+  clrFirebrick: TGLColorVector = (X: 0.556863; Y: 0.137255; Z: 0.137255; W: 1);
+  clrForestGreen: TGLColorVector = (X: 0.137255; Y: 0.556863; Z: 0.137255; W: 1);
+  clrFuchsia: TGLColorVector = (X: 1; Y: 0; Z: 1; W: 1);
+  clrGold: TGLColorVector = (X: 0.8; Y: 0.498039; Z: 0.196078; W: 1);
+  clrGoldenrod: TGLColorVector = (X: 0.858824; Y: 0.858824; Z: 0.439216; W: 1);
+  clrGreenYellow: TGLColorVector = (X: 0.576471; Y: 0.858824; Z: 0.439216; W: 1);
+  clrIndian: TGLColorVector = (X: 0.309804; Y: 0.184314; Z: 0.184314; W: 1);
+  clrKhaki: TGLColorVector = (X: 0.623529; Y: 0.623529; Z: 0.372549; W: 1);
+  clrLightBlue: TGLColorVector = (X: 0.74902; Y: 0.847059; Z: 0.847059; W: 1);
+  clrLightSteelBlue: TGLColorVector = (X: 0.560784; Y: 0.560784; Z: 0.737255; W: 1);
+  clrLime: TGLColorVector = (X: 0; Y: 1; Z: 0; W: 1);
+  clrLimeGreen: TGLColorVector = (X: 0.196078; Y: 0.8; Z: 0.196078; W: 1);
+  clrMaroon: TGLColorVector = (X: 0.556863; Y: 0.137255; Z: 0.419608; W: 1);
+  clrMediumAquamarine: TGLColorVector = (X: 0.196078; Y: 0.8; Z: 0.6; W: 1);
+  clrMediumBlue: TGLColorVector = (X: 0.196078; Y: 0.196078; Z: 0.8; W: 1);
+  clrMediumForestGreen: TGLColorVector = (X: 0.419608; Y: 0.556863; Z: 0.137255; W: 1);
+  clrMediumGoldenrod: TGLColorVector = (X: 0.917647; Y: 0.917647; Z: 0.678431; W: 1);
+  clrMediumOrchid: TGLColorVector = (X: 0.576471; Y: 0.439216; Z: 0.858824; W: 1);
+  clrMediumSeaGreen: TGLColorVector = (X: 0.258824; Y: 0.435294; Z: 0.258824; W: 1);
+  clrMediumSlateBlue: TGLColorVector = (X: 0.498039; Y: 0; Z: 1; W: 1);
+  clrMediumSpringGreen: TGLColorVector = (X: 0.498039; Y: 1; Z: 0; W: 1);
+  clrMediumTurquoise: TGLColorVector = (X: 0.439216; Y: 0.858824; Z: 0.858824; W: 1);
+  clrMediumViolet: TGLColorVector = (X: 0.858824; Y: 0.439216; Z: 0.576471; W: 1);
+  clrMediumPurple: TGLColorVector = (X: 0.73; Y: 0.16; Z: 0.96; W: 1);
+  clrMidnightBlue: TGLColorVector = (X: 0.184314; Y: 0.184314; Z: 0.309804; W: 1);
+  clrNavy: TGLColorVector = (X: 0.137255; Y: 0.137255; Z: 0.556863; W: 1);
+  clrNavyBlue: TGLColorVector = (X: 0.137255; Y: 0.137255; Z: 0.556863; W: 1);
+  clrOrange: TGLColorVector = (X: 1; Y: 0.5; Z: 0.0; W: 1);
+  clrOrangeRed: TGLColorVector = (X: 1; Y: 0.25; Z: 0; W: 1);
+  clrOrchid: TGLColorVector = (X: 0.858824; Y: 0.439216; Z: 0.858824; W: 1);
+  clrPaleGreen: TGLColorVector = (X: 0.560784; Y: 0.737255; Z: 0.560784; W: 1);
+  clrPink: TGLColorVector = (X: 0.737255; Y: 0.560784; Z: 0.560784; W: 1);
+  clrPlum: TGLColorVector = (X: 0.917647; Y: 0.678431; Z: 0.917647; W: 1);
+  clrSalmon: TGLColorVector = (X: 0.435294; Y: 0.258824; Z: 0.258824; W: 1);
+  clrSeaGreen: TGLColorVector = (X: 0.137255; Y: 0.556863; Z: 0.419608; W: 1);
+  clrSienna: TGLColorVector = (X: 0.556863; Y: 0.419608; Z: 0.137255; W: 1);
+  clrSkyBlue: TGLColorVector = (X: 0.196078; Y: 0.6; Z: 0.8; W: 1);
+  clrSlateBlue: TGLColorVector = (X: 0; Y: 0.498039; Z: 1; W: 1);
+  clrSpringGreen: TGLColorVector = (X: 0; Y: 1; Z: 0.498039; W: 1);
+  clrSteelBlue: TGLColorVector = (X: 0.137255; Y: 0.419608; Z: 0.556863; W: 1);
+  clrTan: TGLColorVector = (X: 0.858824; Y: 0.576471; Z: 0.439216; W: 1);
+  clrThistle: TGLColorVector = (X: 0.847059; Y: 0.74902; Z: 0.847059; W: 1);
+  clrTurquoise: TGLColorVector = (X: 0.678431; Y: 0.917647; Z: 0.917647; W: 1);
+  clrViolet: TGLColorVector = (X: 0.309804; Y: 0.184314; Z: 0.309804; W: 1);
+  clrVioletRed: TGLColorVector = (X: 0.8; Y: 0.196078; Z: 0.6; W: 1);
+  clrYellowGreen: TGLColorVector = (X: 0.6; Y: 0.8; Z: 0.196078; W: 1);
+  clrSummerSky: TGLColorVector = (X: 0.22; Y: 0.69; Z: 0.87; W: 1);
+  clrRichBlue: TGLColorVector = (X: 0.35; Y: 0.35; Z: 0.67; W: 1);
+  clrBrass: TGLColorVector = (X: 0.71; Y: 0.65; Z: 0.26; W: 1);
+  clrCopper: TGLColorVector = (X: 0.72; Y: 0.45; Z: 0.20; W: 1);
+  clrBronze: TGLColorVector = (X: 0.55; Y: 0.47; Z: 0.14; W: 1);
+  clrBronze2: TGLColorVector = (X: 0.65; Y: 0.49; Z: 0.24; W: 1);
+  clrSilver: TGLColorVector = (X: 0.90; Y: 0.91; Z: 0.98; W: 1);
+  clrBrightGold: TGLColorVector = (X: 0.85; Y: 0.85; Z: 0.10; W: 1);
+  clrOldGold: TGLColorVector = (X: 0.81; Y: 0.71; Z: 0.23; W: 1);
+  clrFeldspar: TGLColorVector = (X: 0.82; Y: 0.57; Z: 0.46; W: 1);
+  clrQuartz: TGLColorVector = (X: 0.85; Y: 0.85; Z: 0.95; W: 1);
+  clrNeonPink: TGLColorVector = (X: 1.00; Y: 0.43; Z: 0.78; W: 1);
+  clrDarkPurple: TGLColorVector = (X: 0.53; Y: 0.12; Z: 0.47; W: 1);
+  clrNeonBlue: TGLColorVector = (X: 0.30; Y: 0.30; Z: 1.00; W: 1);
+  clrCoolCopper: TGLColorVector = (X: 0.85; Y: 0.53; Z: 0.10; W: 1);
+  clrMandarinOrange: TGLColorVector = (X: 0.89; Y: 0.47; Z: 0.20; W: 1);
+  clrLightWood: TGLColorVector = (X: 0.91; Y: 0.76; Z: 0.65; W: 1);
+  clrMediumWood: TGLColorVector = (X: 0.65; Y: 0.50; Z: 0.39; W: 1);
+  clrDarkWood: TGLColorVector = (X: 0.52; Y: 0.37; Z: 0.26; W: 1);
+  clrSpicyPink: TGLColorVector = (X: 1.00; Y: 0.11; Z: 0.68; W: 1);
+  clrSemiSweetChoc: TGLColorVector = (X: 0.42; Y: 0.26; Z: 0.15; W: 1);
+  clrFlesh: TGLColorVector = (X: 0.96; Y: 0.80; Z: 0.69; W: 1);
+  clrNewTan: TGLColorVector = (X: 0.92; Y: 0.78; Z: 0.62; W: 1);
+  clrNewMidnightBlue: TGLColorVector = (X: 0.00; Y: 0.00; Z: 0.61; W: 1);
+  clrVeryDarkBrown: TGLColorVector = (X: 0.35; Y: 0.16; Z: 0.14; W: 1);
+  clrDarkBrown: TGLColorVector = (X: 0.36; Y: 0.25; Z: 0.20; W: 1);
+  clrDarkTan: TGLColorVector = (X: 0.59; Y: 0.41; Z: 0.31; W: 1);
+  clrGreenCopper: TGLColorVector = (X: 0.32; Y: 0.49; Z: 0.46; W: 1);
+  clrDkGreenCopper: TGLColorVector = (X: 0.29; Y: 0.46; Z: 0.43; W: 1);
+  clrDustyRose: TGLColorVector = (X: 0.52; Y: 0.39; Z: 0.39; W: 1);
+  clrHuntersGreen: TGLColorVector = (X: 0.13; Y: 0.37; Z: 0.31; W: 1);
+  clrScarlet: TGLColorVector = (X: 0.55; Y: 0.09; Z: 0.09; W: 1);
+  clrLightPurple: TGLColorVector = (X: 0.87; Y: 0.58; Z: 0.98; W: 1);
+  clrVeryLightPurple: TGLColorVector = (X: 0.94; Y: 0.81; Z: 0.99; W: 1);
+  clrGreen: TGLColorVector = (X: 0; Y: 0.5; Z: 0; W: 1);
+  clrOlive: TGLColorVector = (X: 0.5; Y: 0.5; Z: 1; W: 1);
+  clrPurple: TGLColorVector = (X: 1; Y: 0; Z: 1; W: 1);
+  clrTeal: TGLColorVector = (X: 0; Y: 0.5; Z: 0.5; W: 1);
+  clrRed: TGLColorVector = (X: 1; Y: 0; Z: 0; W: 1);
+  clrYellow: TGLColorVector = (X: 1; Y: 1; Z: 0; W: 1);
+  clrWheat: TGLColorVector = (X: 0.847059; Y: 0.847059; Z: 0.74902; W: 1);
 
   cDefaultNormalMapScale = 0.125;
 
@@ -386,7 +386,7 @@ begin
   Result := vColorManager;
 end;
 
-function ConvertWinColor(aColor: TColor; alpha: Single = 1): TColorVector;
+function ConvertWinColor(aColor: TColor; alpha: Single = 1): TGLColorVector;
 var
   winColor: Integer;
 begin
@@ -443,13 +443,13 @@ begin
   clrBackground := ConvertWinColor(clBackground);
 end;
 
-function ConvertColorVector(const aColor: TColorVector): TColor;
+function ConvertColorVector(const aColor: TGLColorVector): TColor;
 begin
   Result := RGB2Color(Round(255 * aColor.X), Round(255 * aColor.Y),
     Round(255 * aColor.Z));
 end;
 
-function ConvertColorVector(const aColor: TColorVector;
+function ConvertColorVector(const aColor: TGLColorVector;
   intensity: Single): TColor;
 begin
   intensity := 255 * intensity;
@@ -457,7 +457,7 @@ begin
     Round(intensity * aColor.Z));
 end;
 
-function ConvertRGBColor(const aColor: array of Byte): TColorVector;
+function ConvertRGBColor(const aColor: array of Byte): TGLColorVector;
 var
   n: Integer;
 begin
@@ -488,7 +488,7 @@ begin
 end;
 
 constructor TGLColor.CreateInitialized(AOwner: TPersistent;
-  const color: TColorVector; changeEvent: TNotifyEvent = nil);
+  const color: TGLColorVector; changeEvent: TNotifyEvent = nil);
 begin
   Create(AOwner);
   Initialize(color);
@@ -502,7 +502,7 @@ begin
   inherited;
 end;
 
-procedure TGLColor.Initialize(const color: TColorVector);
+procedure TGLColor.Initialize(const color: TGLColorVector);
 begin
   SetVector(FColor, color);
   if vUseDefaultColorSets then
@@ -513,13 +513,13 @@ begin
   end;
 end;
 
-procedure TGLColor.SetColorVector(const aColor: TColorVector);
+procedure TGLColor.SetColorVector(const aColor: TGLColorVector);
 begin
   SetVector(FColor, aColor);
   NotifyChange(Self);
 end;
 
-procedure TGLColor.SetDirectColorVector(const aColor: TColorVector);
+procedure TGLColor.SetDirectColorVector(const aColor: TGLColorVector);
 begin
   SetVector(FColor, aColor);
 end;
@@ -719,20 +719,20 @@ end;
 // ------------------ TGLColorManager ------------------
 // ------------------
 
-function TGLColorManager.FindColor(const aName: String): TColorVector;
+function TGLColorManager.FindColor(const aName: String): TGLColorVector;
 var
   i: Integer;
 begin
   Result := clrBlack;
   for i := 0 to Count - 1 do
-    if CompareText(string(TColorEntry(Items[i]^).Name), aName) = 0 then
+    if CompareText(string(TGLColorEntry(Items[i]^).Name), aName) = 0 then
     begin
-      SetVector(Result, TColorEntry(Items[i]^).color);
+      SetVector(Result, TGLColorEntry(Items[i]^).color);
       Break;
     end;
 end;
 
-function TGLColorManager.GetColor(const aName: String): TColorVector;
+function TGLColorManager.GetColor(const aName: String): TGLColorVector;
 var
   workCopy: String;
   delimiter: Integer;
@@ -788,7 +788,7 @@ end;
 
 // ------------------------------------------------------------------------------
 
-function TGLColorManager.GetColorName(const aColor: TColorVector): String;
+function TGLColorManager.GetColorName(const aColor: TGLColorVector): String;
 
 const
   MinDiff = 1E-6;
@@ -798,14 +798,14 @@ var
 
 begin
   for i := 0 to Count - 1 do
-    with TColorEntry(Items[i]^) do
+    with TGLColorEntry(Items[i]^) do
       if (Abs(Color.X - aColor.X) < MinDiff) and
         (Abs(Color.Y - aColor.Y) < MinDiff) and
         (Abs(Color.Z - aColor.Z) < MinDiff) and
         (Abs(Color.W - aColor.W) < MinDiff) then
         Break;
   if i < Count then
-    Result := string(TColorEntry(Items[i]^).Name)
+    Result := string(TGLColorEntry(Items[i]^).Name)
   else
     Result := Format('<%.3f %.3f %.3f %.3f>', [aColor.X, aColor.Y, aColor.Z,
       aColor.W]);
@@ -818,16 +818,16 @@ var
   i: Integer;
 begin
   for i := 0 to Count - 1 do
-    FreeMem(Items[i], SizeOf(TColorEntry));
+    FreeMem(Items[i], SizeOf(TGLColorEntry));
   inherited Destroy;
 end;
 
 // ------------------------------------------------------------------------------
 
 procedure TGLColorManager.AddColor(const aName: String;
-  const aColor: TColorVector);
+  const aColor: TGLColorVector);
 var
-  newEntry: PColorEntry;
+  newEntry: PGLColorEntry;
 begin
   New(newEntry);
   if newEntry = nil then
@@ -845,7 +845,7 @@ var
   i: Integer;
 begin
   for i := 0 to Count - 1 do
-    Proc(string(TColorEntry(Items[i]^).Name));
+    Proc(string(TGLColorEntry(Items[i]^).Name));
 end;
 
 procedure TGLColorManager.EnumColors(AValues: TStrings);
@@ -853,7 +853,7 @@ var
   i: Integer;
 begin
   for i := 0 to Count - 1 do
-    AValues.Add(string(TColorEntry(Items[i]^).Name));
+    AValues.Add(string(TGLColorEntry(Items[i]^).Name));
 end;
 
 procedure TGLColorManager.RegisterDefaultColors;
@@ -1020,7 +1020,7 @@ var
 begin
   for i := 0 to Count - 1 do
   begin
-    if CompareText(string(TColorEntry(Items[i]^).Name), aName) = 0 then
+    if CompareText(string(TGLColorEntry(Items[i]^).Name), aName) = 0 then
     begin
       Delete(i);
       Break;
@@ -1028,7 +1028,7 @@ begin
   end;
 end;
 
-procedure RegisterColor(const aName: String; const aColor: TColorVector);
+procedure RegisterColor(const aName: String; const aColor: TGLColorVector);
 begin
   ColorManager.AddColor(aName, aColor);
 end;

+ 136 - 99
Source/GLS.Coordinates.pas

@@ -161,6 +161,17 @@ type
     procedure CoordinateChanged(Sender: TGLCustomCoordinates); virtual; abstract;
   end;
 
+(* Calculates the barycentric coordinates for the point p on the triangle
+  defined by the vertices v1, v2 and v3. That is, solves
+  p = u * v1 + v * v2 + (1-u-v) * v3
+  for u,v.
+  Returns true if the point is inside the triangle, false otherwise.
+  NOTE: This function assumes that the point lies on the plane defined by the triangle.
+  If this is not the case, the function will not work correctly!
+  https://mathworld.wolfram.com/BarycentricCoordinates.html *)
+function BarycentricCoordinates(const V1, V2, V3, p: TAffineVector; var u, V: Single): Boolean;
+
+
 //-------------------- Conversions of Coordinates --------------------
 (*
   Helper functions to convert between different three dimensional coordinate
@@ -170,43 +181,89 @@ type
 (* Convert Cylindrical to Cartesian [single] with no checks, theta in rad
   Ref: http://mathworld.wolfram.com/CylindricalCoordinates.html *)
 procedure Cylindrical_Cartesian(const r, theta, z1: single; var x, y, z: single); overload;
-// Convert cylindrical to cartesian [double]. theta in rads
+(* Convert Cylindrical to Cartesian with no checks. Double version, theta in rads
+  Ref: http://mathworld.wolfram.com/CylindricalCoordinates.html *)
 procedure Cylindrical_Cartesian(const r, theta, z1: double; var x, y, z: double); overload;
-// Convert cylindrical to cartesian [single] (with error check). theta in rad
+(* Convert Cylindrical to Cartesian with checks. [single], theta in rad
+  ierr: [0] = ok,
+  [1] = r out of bounds. Acceptable r: [0,inf)
+  [2] = theta out of bounds. Acceptable theta: [0,2pi)
+  [3] = z1 out of bounds. Acceptable z1 : (-inf,inf)
+  Ref: http://mathworld.wolfram.com/CylindricalCoordinates.html *)
 procedure Cylindrical_Cartesian(const r, theta, z1: single; var x, y, z: single;
   var ierr: integer); overload;
-// Convert cylindrical to cartesian [double] (with error check). theta in rad
+(* Convert Cylindrical to Cartesian with checks. [double], theta in rad
+  ierr: [0] = ok,
+  [1] = r out of bounds. Acceptable r: [0,inf)
+  [2] = theta out of bounds. Acceptable theta: [0,2pi)
+  [3] = z1 out of bounds. Acceptable z1 : (-inf,inf)
+  Ref: http://mathworld.wolfram.com/CylindricalCoordinates.html *)
 procedure Cylindrical_Cartesian(const r, theta, z1: double; var x, y, z: double;
   var ierr: integer); overload;
-// Convert cartesian to cylindrical [single]
+(* Convert Cartesian to Cylindrical no checks. Single *)
 procedure Cartesian_Cylindrical(const x, y, z1: single; var r, theta, z: single); overload;
-// Convert cartesion to cylindrical [double]
+(* Convert Cartesian to Cylindrical no checks. Duoble *)
 procedure Cartesian_Cylindrical(const x, y, z1: double; var r, theta, z: double); overload;
-// Convert spherical to cartesion. [single] theta,phi in rads
+
+(* Convert Spherical to Cartesian with no checks. [single] theta,phi in rads
+   Ref: http://mathworld.wolfram.com/SphericalCoordinates.html *)
 procedure Spherical_Cartesian(const r, theta, phi: single; var x, y, z: single); overload;
-// Convert spherical to cartesion. [double] theta,phi in rads
+(* Convert Spherical to Cartesian with no checks. Double version. theta,phi in rads *)
 procedure Spherical_Cartesian(const r, theta, phi: double; var x, y, z: double); overload;
-// Convert spherical to cartesian [single] (with error check).theta,phi in rad
+(* Convert Spherical to Cartesian [single] (with error check).theta,phi in rad
+  ierr: [0] = ok,
+  [1] = r out of bounds
+  [2] = theta out of bounds
+  [3] = phi out of bounds
+  Ref: http://mathworld.wolfram.com/SphericalCoordinates.html *)
 procedure Spherical_Cartesian(const r, theta, phi: single; var x, y, z: single;
   var ierr: integer); overload;
 // Convert spherical to cartesian [double] (with error check).theta,phi in rad
 procedure Spherical_Cartesian(const r, theta, phi: double; var x, y, z: double;
   var ierr: integer); overload;
-// Convert cartesian to spherical [single]
+(* Convert Cartesian to Spherical, no checks, single
+  Ref: http://mathworld.wolfram.com/SphericalCoordinates.html
+  NB: Could be optimised by using jclmath.pas unit *)
 procedure Cartesian_Spherical(const x, y, z: single; var r, theta, phi: single); overload;
 procedure Cartesian_Spherical(const v: TAffineVector; var r, theta, phi: single); overload;
-// Convert cartesion to spherical [double]
+(* convert Cartesian to Spherical, no checks, double
+  Ref: http://mathworld.wolfram.com/SphericalCoordinates.html
+  NB: Could be optimised by using jclmath.pas unit? *)
 procedure Cartesian_Spherical(const x, y, z: double; var r, theta, phi: double); overload;
-// Convert Prolate-Spheroidal to Cartesian. [single] eta, phi in rad
+(* Convert Prolate-Spheroidal to Cartesian with no checks. [single] eta, phi in rad
+  A system of curvilinear coordinates in which two sets of coordinate surfaces are
+  obtained by revolving the curves of the elliptic cylindrical coordinates about
+  the x-axis, which is relabeled the z-axis. The third set of coordinates
+  consists of planes passing through this axis.
+  The coordinate system is parameterised by parameter a.
+  A default value of a=1 is suggesed:
+  Ref: http://mathworld.wolfram.com/ProlateSpheroidalCoordinates.html *)
 procedure ProlateSpheroidal_Cartesian(const xi, eta, phi, a: single;
   var x, y, z: single); overload;
-// Convert Prolate-Spheroidal to Cantesian. [double] eta,phi in rad
+(* Convert Prolate-Spheroidal to Cartesian [double] eta,phi in rad
+  A system of curvilinear coordinates in which two sets of coordinate surfaces are
+  obtained by revolving the curves of the elliptic cylindrical coordinates about
+  the x-axis, which is relabeled the z-axis. The third set of coordinates
+  consists of planes passing through this axis.
+  The coordinate system is parameterised by parameter a. A default value of a=1 is
+  suggesed:
+  Ref: http://mathworld.wolfram.com/ProlateSpheroidalCoordinates.html *)
 procedure ProlateSpheroidal_Cartesian(const xi, eta, phi, a: double;
   var x, y, z: double); overload;
-// Convert Prolate-Spheroidal to Cartesian [single](with error check). eta,phi in rad
+(* Convert Prolate-Spheroidal to Cartesian [single](with error check). eta,phi in rad
+  ierr: [0] = ok,
+  [1] = xi out of bounds. Acceptable xi: [0,inf)
+  [2] = eta out of bounds. Acceptable eta: [0,pi]
+  [3] = phi out of bounds. Acceptable phi: [0,2pi)
+  Ref: http://mathworld.wolfram.com/ProlateSpheroidalCoordinates.html *)
 procedure ProlateSpheroidal_Cartesian(const xi, eta, phi, a: single;
   var x, y, z: single; var ierr: integer); overload;
-// Convert Prolate-Spheroidal to Cartesian [single](with error check). eta,phi in rad
+(* Convert Prolate-Spheroidal to Cartesian [double](with error check). eta,phi in rad
+  ierr: [0] = ok,
+  [1] = xi out of bounds. Acceptable xi: [0,inf)
+  [2] = eta out of bounds. Acceptable eta: [0,pi]
+  [3] = phi out of bounds. Acceptable phi: [0,2pi)
+  Ref: http://mathworld.wolfram.com/ProlateSpheroidalCoordinates.html *)
 procedure ProlateSpheroidal_Cartesian(const xi, eta, phi, a: double;
   var x, y, z: double;  var ierr: integer); overload;
 // Convert Oblate-Spheroidal to Cartesian. [Single] eta, phi in rad
@@ -218,19 +275,30 @@ procedure OblateSpheroidal_Cartesian(const xi, eta, phi, a: double;
 // Convert Oblate-Spheroidal to Cartesian (with error check). eta,phi in rad
 procedure OblateSpheroidal_Cartesian(const xi, eta, phi, a: single;
   var x, y, z: single; var ierr: integer); overload;
-// Convert Oblate-Spheroidal to Cartesian (with error check).[Double] eta,phi in rad
+(* Convert Oblate-Spheroidal to Cartesian with checks. [Double] eta,phi in rad
+  ierr: [0] = ok,
+  [1] = xi out of bounds. Acceptable xi: [0,inf)
+  [2] = eta out of bounds. Acceptable eta: [-0.5*pi,0.5*pi]
+  [3] = phi out of bounds. Acceptable phi: [0,2*pi)
+  Ref: http://mathworld.wolfram.com/ProlateSpheroidalCoordinates.html *)
 procedure OblateSpheroidal_Cartesian(const xi, eta, phi, a: double;
   var x, y, z: double; var ierr: integer); overload;
 // Convert Bipolar to Cartesian. u in rad
 procedure BipolarCylindrical_Cartesian(const u, v, z1, a: single;
   var x, y, z: single); overload;
-// Convert Bipolar to Cartesian. [Double] u in rad
+(* Convert BiPolarCylindrical to Cartesian with no checks. Double, u in rad
+  http://mathworld.wolfram.com/BipolarCylindricalCoordinates.html *)
 procedure BipolarCylindrical_Cartesian(const u, v, z1, a: double;
   var x, y, z: double); overload;
 // Convert Bipolar to Cartesian (with error check). u in rad
 procedure BipolarCylindrical_Cartesian(const u, v, z1, a: single;
   var x, y, z: single; var ierr: integer); overload;
-// Convert Bipolar to Cartesian (with error check). [Double] u in rad
+(* Convert Oblate-Spheroidal to Cartesian with checks. Double, u in rad
+  ierr: [0] = ok,
+  [1] = u out of bounds. Acceptable u: [0,2*pi)
+  [2] = v out of bounds. Acceptable v: (-inf,inf)
+  [3] = z1 out of bounds. Acceptable z1: (-inf,inf)
+  Ref: https://mathworld.wolfram.com/BipolarCylindricalCoordinates.html *)
 procedure BipolarCylindrical_Cartesian(const u, v, z1, a: double;
   var x, y, z: double; var ierr: integer); overload;
 
@@ -640,31 +708,20 @@ end;
 // ----------------- Conversions of coordinates --------------------
 
 // ----------------- Cylindrical_Cartesian ----------------------
-
 procedure Cylindrical_Cartesian(const r, theta, z1: single; var x, y, z: single);
-
 begin
   SinCosine(theta, r, y, x);
   z := z1;
 end;
 
 // ----- Cylindrical_Cartesian -------------------------------------
-(* Convert Cylindrical to Cartesian with no checks. Double version
-  Ref: http://mathworld.wolfram.com/CylindricalCoordinates.html *)
 procedure Cylindrical_Cartesian(const r, theta, z1: double; var x, y, z: double);
-
 begin
   SinCosine(theta, r, y, x);
   z := z1;
 end;
 
 // ------------------ Cylindrical_Cartesian -----------------------
-(* Convert Cylindrical to Cartesian with checks.
-  ierr: [0] = ok,
-  [1] = r out of bounds. Acceptable r: [0,inf)
-  [2] = theta out of bounds. Acceptable theta: [0,2pi)
-  [3] = z1 out of bounds. Acceptable z1 : (-inf,inf)
-  Ref: http://mathworld.wolfram.com/CylindricalCoordinates.html *)
 procedure Cylindrical_Cartesian(const r, theta, z1: single; var x, y, z: single;
   var ierr: integer);
 
@@ -685,12 +742,6 @@ begin
 end;
 
 // ----- Cylindrical_Cartesian -------------------------------------------------
-(* Convert Cylindrical to Cartesian with checks.
-  ierr: [0] = ok,
-  [1] = r out of bounds. Acceptable r: [0,inf)
-  [2] = theta out of bounds. Acceptable theta: [0,2pi)
-  [3] = z1 out of bounds. Acceptable z1 : (-inf,inf)
-  Ref: http://mathworld.wolfram.com/CylindricalCoordinates.html *)
 procedure Cylindrical_Cartesian(const r, theta, z1: double; var x, y, z: double;
   var ierr: integer);
 
@@ -711,7 +762,6 @@ begin
 end;
 
 // ----- Cartesian_Cylindrical -------------------------------------------------
-(* Convert Cartesian to Cylindrical no checks. Single *)
 procedure Cartesian_Cylindrical(const x, y, z1: single; var r, theta, z: single);
 begin
   r := sqrt(x * x + y * y);
@@ -720,7 +770,6 @@ begin
 end;
 
 // ----- Cartesian_Cylindrical -------------------------------------------------
-(* Convert Cartesian to Cylindrical no checks. Duoble *)
 procedure Cartesian_Cylindrical(const x, y, z1: double; var r, theta, z: double);
 begin
   r := sqrt(x * x + y * y);
@@ -729,34 +778,24 @@ begin
 end;
 
 // ----- Spherical_Cartesian ---------------------------------------------------
-(* Convert Spherical to Cartesian with no checks.
-  Ref: http://mathworld.wolfram.com/SphericalCoordinates.html *)
 procedure Spherical_Cartesian(const r, theta, phi: single; var x, y, z: single);
 var
   a: single;
 begin
-  SinCosine(phi, r, a, z); // z = r*cos(phi), a=r*sin(phi)
+  SinCosine(phi, r, a, z); // z = r*cos(phi), a = r*sin(phi)
   SinCosine(theta, a, y, x); // x = a*cos(theta), y = a*sin(theta)}
 end;
 
 // ----- Spherical_Cartesian ---------------------------------------------------
-(* Convert Spherical to Cartesian with no checks. Double version.
-  Ref: http://mathworld.wolfram.com/SphericalCoordinates.html *)
 procedure Spherical_Cartesian(const r, theta, phi: double; var x, y, z: double);
 var
   a: double;
 begin
-  SinCosine(phi, r, a, z); // z = r*cos(phi), a=r*sin(phi)
+  SinCosine(phi, r, a, z); // z = r*cos(phi), a = r*sin(phi)
   SinCosine(theta, a, y, x); // x = a*cos(theta), y = a*sin(theta)}
 end;
 
 // ----- Spherical_Cartesian ---------------------------------------------------
-(* Convert Spherical to Cartesian with checks.
-  ierr: [0] = ok,
-  [1] = r out of bounds
-  [2] = theta out of bounds
-  [3] = phi out of bounds
-  Ref: http://mathworld.wolfram.com/SphericalCoordinates.html *)
 procedure Spherical_Cartesian(const r, theta, phi: single; var x, y, z: single;
   var ierr: integer);
 var
@@ -772,7 +811,7 @@ begin
     ierr := 0;
   if (ierr = 0) then
   begin
-    SinCosine(phi, r, a, z); // z = r*cos(phi), a=r*sin(phi)
+    SinCosine(phi, r, a, z); // z = r*cos(phi), a = r*sin(phi)
     SinCosine(theta, a, y, x); // x = a*cos(theta), y = a*sin(theta)}
   end;
 end;
@@ -806,9 +845,6 @@ begin
 end;
 
 // ----- Cartesian_Spherical ---------------------------------------------------
-(* convert Cartesian to Spherical, no checks, single
-  Ref: http://mathworld.wolfram.com/SphericalCoordinates.html
-  NB: Could be optimised by using jclmath.pas unit? *)
 procedure Cartesian_Spherical(const x, y, z: single; var r, theta, phi: single);
 begin
   r := sqrt((x * x) + (y * y) + (z * z));
@@ -824,9 +860,6 @@ begin
 end;
 
 // ----- Cartesian_Spherical ---------------------------------------------------
-(* convert Cartesian to Spherical, no checks, double
-  Ref: http://mathworld.wolfram.com/SphericalCoordinates.html
-  NB: Could be optimised by using jclmath.pas unit? *)
 procedure Cartesian_Spherical(const x, y, z: double; var r, theta, phi: double);
 begin
   r := sqrt((x * x) + (y * y) + (z * z));
@@ -835,15 +868,6 @@ begin
 end;
 
 // ----- ProlateSpheroidal_Cartesian -------------------------------------------
-(* Convert Prolate-Spheroidal to Cartesian with no checks.
-  A system of curvilinear coordinates in which two sets of coordinate surfaces are
-  obtained by revolving the curves of the elliptic cylindrical coordinates about
-  the x-axis, which is relabeled the z-axis. The third set of coordinates
-  consists of planes passing through this axis.
-  The coordinate system is parameterised by parameter a. A default value of a=1 is
-  suggesed:
-  http://documents.wolfram.com/v4/AddOns/StandardPackages/Calculus/VectorAnalysis.html
-  Ref: http://mathworld.wolfram.com/ProlateSpheroidalCoordinates.html *)
 procedure ProlateSpheroidal_Cartesian(const xi, eta, phi, a: single; var x, y, z: single);
 var
   sn, cs, snphi, csphi, shx, chx: single;
@@ -858,15 +882,6 @@ begin
 end;
 
 // ----- ProlateSpheroidal_Cartesian -------------------------------------------
-(* Convert Prolate-Spheroidal to Cartesian with no checks. Double version.
-  A system of curvilinear coordinates in which two sets of coordinate surfaces are
-  obtained by revolving the curves of the elliptic cylindrical coordinates about
-  the x-axis, which is relabeled the z-axis. The third set of coordinates
-  consists of planes passing through this axis.
-  The coordinate system is parameterised by parameter a. A default value of a=1 is
-  suggesed:
-  http://documents.wolfram.com/v4/AddOns/StandardPackages/Calculus/VectorAnalysis.html
-  Ref: http://mathworld.wolfram.com/ProlateSpheroidalCoordinates.html *)
 procedure ProlateSpheroidal_Cartesian(const xi, eta, phi, a: double; var x, y, z: double);
 var
   sn, cs, snphi, csphi, shx, chx: double;
@@ -881,12 +896,6 @@ begin
 end;
 
 // ----- ProlateSpheroidal_Cartesian -------------------------------------------
-(* Convert Prolate-Spheroidal to Cartesian with checks.
-  ierr: [0] = ok,
-  [1] = xi out of bounds. Acceptable xi: [0,inf)
-  [2] = eta out of bounds. Acceptable eta: [0,pi]
-  [3] = phi out of bounds. Acceptable phi: [0,2pi)
-  Ref: http://mathworld.wolfram.com/ProlateSpheroidalCoordinates.html *)
 procedure ProlateSpheroidal_Cartesian(const xi, eta, phi, a: single;
   var x, y, z: single; var ierr: integer); overload;
 var
@@ -913,12 +922,6 @@ begin
 end;
 
 // ----- ProlateSpheroidal_Cartesian -------------------------------------------
-(* Convert Prolate-Spheroidal to Cartesian with checks. Double Version.
-  ierr: [0] = ok,
-  [1] = xi out of bounds. Acceptable xi: [0,inf)
-  [2] = eta out of bounds. Acceptable eta: [0,pi]
-  [3] = phi out of bounds. Acceptable phi: [0,2pi)
-  Ref: http://mathworld.wolfram.com/ProlateSpheroidalCoordinates.html *)
 procedure ProlateSpheroidal_Cartesian(const xi, eta, phi, a: double;
   var x, y, z: double; var ierr: integer); overload;
 var
@@ -1023,12 +1026,6 @@ begin
 end;
 
 // ----- OblateSpheroidal_Cartesian -------------------------------------------
-(* Convert Oblate-Spheroidal to Cartesian with checks. Double Version.
-  ierr: [0] = ok,
-  [1] = xi out of bounds. Acceptable xi: [0,inf)
-  [2] = eta out of bounds. Acceptable eta: [-0.5*pi,0.5*pi]
-  [3] = phi out of bounds. Acceptable phi: [0,2*pi)
-  Ref: http://mathworld.wolfram.com/ProlateSpheroidalCoordinates.html *)
 procedure OblateSpheroidal_Cartesian(const xi, eta, phi, a: double;
   var x, y, z: double; var ierr: integer); overload;
 var
@@ -1070,8 +1067,6 @@ begin
 end;
 
 // ----- BipolarCylindrical_Cartesian ------------------------------------------
-(* Convert BiPolarCylindrical to Cartesian with no checks. Double Version
-  http://mathworld.wolfram.com/BipolarCylindricalCoordinates.html *)
 procedure BipolarCylindrical_Cartesian(const u, v, z1, a: double; var x, y, z: double);
 var
   cs, sn, shx, chx: double;
@@ -1112,12 +1107,6 @@ begin
 end;
 
 // ----- BipolarCylindrical_Cartesian ------------------------------------------
-(* Convert Oblate-Spheroidal to Cartesian with checks. Double Version
-  ierr: [0] = ok,
-  [1] = u out of bounds. Acceptable u: [0,2*pi)
-  [2] = v out of bounds. Acceptable v: (-inf,inf)
-  [3] = z1 out of bounds. Acceptable z1: (-inf,inf)
-  Ref: http://mathworld.wolfram.com/BiPolarCylindricalCoordinates.html *)
 procedure BipolarCylindrical_Cartesian(const u, v, z1, a: double;
   var x, y, z: double; var ierr: integer); overload;
 var
@@ -1138,6 +1127,54 @@ begin
   end;
 end;
 
+function BarycentricCoordinates(const V1, V2, V3, p: TAffineVector;
+  var u, V: Single): Boolean;
+var
+  a1, a2: Integer;
+  n, e1, e2, pt: TAffineVector;
+begin
+  // calculate edges
+  VectorSubtract(V1, V3, e1);
+  VectorSubtract(V2, V3, e2);
+
+  // calculate p relative to v3
+  VectorSubtract(p, V3, pt);
+
+  // find the dominant axis
+  n := VectorCrossProduct(e1, e2);
+  AbsVector(n);
+  a1 := 0;
+  if n.Y > n.V[a1] then
+    a1 := 1;
+  if n.Z > n.V[a1] then
+    a1 := 2;
+
+  // use dominant axis for projection
+  case a1 of
+    0:
+      begin
+        a1 := 1;
+        a2 := 2;
+      end;
+    1:
+      begin
+        a1 := 0;
+        a2 := 2;
+      end;
+  else // 2:
+    a1 := 0;
+    a2 := 1;
+  end;
+
+  // solve for u and v
+  u := (pt.V[a2] * e2.V[a1] - pt.V[a1] * e2.V[a2]) /
+    (e1.V[a2] * e2.V[a1] - e1.V[a1] * e2.V[a2]);
+  V := (pt.V[a2] * e1.V[a1] - pt.V[a1] * e1.V[a2]) /
+    (e2.V[a2] * e1.V[a1] - e2.V[a1] * e1.V[a2]);
+
+  result := (u >= 0) and (V >= 0) and (u + V <= 1);
+end;
+
 
 //=====================================================================
 initialization

+ 1 - 1
Source/GLS.Extrusion.pas

@@ -926,7 +926,7 @@ type
   end;
   TRowData = record
     node: array of TNodeData;
-    color: TColorVector;
+    color: TGLColorVector;
     center: TVector3f;
     textcoordT: Single;
   end;

+ 3 - 3
Source/GLS.FBORenderer.pas

@@ -808,7 +808,7 @@ end;
 procedure TGLFrameBuffer.Render(var rci: TGLRenderContextInfo; baseObject:
   TGLBaseSceneObject);
 var
-  backColor: TColorVector;
+  backColor: TGLColorVector;
   buffer: TGLSceneBuffer;
 begin
   Bind;
@@ -1278,7 +1278,7 @@ procedure TGLFBORenderer.RenderToFBO(var ARci: TGLRenderContextInfo);
 
 type
   TGLStoredStates = record
-    ColorClearValue: TColorVector;
+    ColorClearValue: TGLColorVector;
     ColorWriteMask: TGLColorMask;
     Tests: TGLStates;
   end;
@@ -1306,7 +1306,7 @@ type
   end;
 
 var
-  backColor: TColorVector;
+  backColor: TGLColorVector;
   buffer: TGLSceneBuffer;
   savedStates: TGLStoredStates;
   w, h: Integer;

+ 4 - 4
Source/GLS.FileMS3D.pas

@@ -123,10 +123,10 @@ type
   // *) ms3d_material_t;
   TMS3DMaterial = record
     Name: array[0..31] of AnsiChar;
-    Ambient: TColorVector;
-    Diffuse: TColorVector;
-    Specular: TColorVector;
-    Emissive: TColorVector;
+    Ambient: TGLColorVector;
+    Diffuse: TGLColorVector;
+    Specular: TGLColorVector;
+    Emissive: TGLColorVector;
     Shininess: single;
     Transparency: single;
     Mode: AnsiChar;

+ 2 - 2
Source/GLS.FireFX.pas

@@ -79,7 +79,7 @@ type
     procedure Notification(AComponent: TComponent; Operation: TOperation); override;
     procedure CalcFire(deltaTime: Double; ParticleInterval, ParticleLife: Single;
       FireAlpha: Single);
-    procedure AffParticle3d(Color2: TColorVector; const mat: TGLMatrix);
+    procedure AffParticle3d(Color2: TGLColorVector; const mat: TGLMatrix);
   public
     constructor Create(AOwner: TComponent); override;
     destructor Destroy; override;
@@ -526,7 +526,7 @@ begin
   end;
 end;
 
-procedure TGLFireFXManager.AffParticle3d(Color2: TColorVector; const mat: TGLMatrix);
+procedure TGLFireFXManager.AffParticle3d(Color2: TGLColorVector; const mat: TGLMatrix);
 var
   vx, vy: TGLVector;
   i: Integer;

+ 1 - 1
Source/GLS.GameMenu.pas

@@ -164,7 +164,7 @@ var
   canvas: TGLCanvas;
   buffer: TGLSceneBuffer;
   i, w, h, tw, Y: Integer;
-  color: TColorVector;
+  color: TGLColorVector;
   libMat: TGLLibMaterial;
 begin
   if Font = nil then

+ 7 - 7
Source/GLS.Graph.pas

@@ -62,9 +62,9 @@ type
   end;
 
   TGLHeightFieldGetHeightEvent = procedure(const x, y: Single; var z: Single;
-    var Color: TColorVector; var TexPoint: TTexPoint) of object;
+    var Color: TGLColorVector; var TexPoint: TTexPoint) of object;
   TGLHeightFieldGetHeight2Event = procedure(Sender: TObject; const x, y: Single;
-    var z: Single; var Color: TColorVector; var TexPoint: TTexPoint) of object;
+    var z: Single; var Color: TGLColorVector; var TexPoint: TTexPoint) of object;
 
   TGLHeightFieldOption = (hfoTextureCoordinates, hfoTwoSided);
   TGLHeightFieldOptions = set of TGLHeightFieldOption;
@@ -95,9 +95,9 @@ type
     procedure SetOnGetHeight2(const val: TGLHeightFieldGetHeight2Event);
     procedure SetColorMode(const val: TGLHeightFieldColorMode);
     procedure DefaultHeightField(const x, y: Single; var z: Single;
-      var Color: TColorVector; var TexPoint: TTexPoint);
+      var Color: TGLColorVector; var TexPoint: TTexPoint);
     procedure Height2Field(const x, y: Single; var z: Single;
-      var Color: TColorVector; var texPoint: TTexPoint);
+      var Color: TGLColorVector; var texPoint: TTexPoint);
   public
     constructor Create(AOwner: TComponent); override;
     destructor Destroy; override;
@@ -331,7 +331,7 @@ end;
 procedure TGLHeightField.BuildList(var rci: TGLRenderContextInfo);
 type
   TRowData = packed record
-    Color: TColorVector;
+    Color: TGLColorVector;
     Z: Single;
     TexPoint: TTexPoint;
     Normal: TAffineVector;
@@ -553,7 +553,7 @@ end;
 
 
 procedure TGLHeightField.DefaultHeightField(const x, y: Single; var z: Single;
-  var color: TColorVector; var texPoint: TTexPoint);
+  var color: TGLColorVector; var texPoint: TTexPoint);
 begin
   z := VectorNorm(x, y);
   z := cos(z * 12) / (2 * (z * 6.28 + 1));
@@ -562,7 +562,7 @@ end;
 
 
 procedure TGLHeightField.Height2Field(const x, y: Single; var z: Single;
-  var color: TColorVector; var texPoint: TTexPoint);
+  var color: TGLColorVector; var texPoint: TTexPoint);
 begin
   FOnGetHeight2(Self, x, y, z, color, texPoint);
 end;

+ 2 - 2
Source/GLS.LensFlare.pas

@@ -50,7 +50,7 @@ type
   public
     constructor Create(AOwner: TPersistent); override;
     constructor CreateInitialized(AOwner: TPersistent;
-      const fromColor, toColor: TColorVector);
+      const fromColor, toColor: TGLColorVector);
     destructor Destroy; override;
     procedure Assign(Source: TPersistent); override;
   published
@@ -206,7 +206,7 @@ begin
 end;
 
 constructor TGLFlareGradient.CreateInitialized(AOwner: TPersistent;
-  const fromColor, toColor: TColorVector);
+  const fromColor, toColor: TGLColorVector);
 begin
   Create(AOwner);
   FFromColor.Initialize(fromColor);

+ 1 - 1
Source/GLS.LinePFX.pas

@@ -135,7 +135,7 @@ procedure TGLLinePFXManager.RenderParticle(var rci: TGLRenderContextInfo;
   aParticle: TGLParticle);
 var
   lifeTime, sizeScale, fx, fy, f: Single;
-  inner, outer: TColorVector;
+  inner, outer: TGLColorVector;
   pos, dir, start, stop, dv: TAffineVector;
 begin
   lifeTime := CurrentTime - aParticle.CreationTime;

+ 2 - 2
Source/GLS.MaterialEx.pas

@@ -2590,7 +2590,7 @@ begin
       FWrap[0] := TGLSeparateTextureWrap(ReadInteger);
       FWrap[1] := TGLSeparateTextureWrap(ReadInteger);
       FWrap[2] := TGLSeparateTextureWrap(ReadInteger);
-      Read(FBorderColor.AsAddress^, SizeOf(TColorVector));
+      Read(FBorderColor.AsAddress^, SizeOf(TGLColorVector));
       FCompareMode := TGLTextureCompareMode(ReadInteger);
       FCompareFunc := TGLDepthFunction(ReadInteger);
       FDecodeSRGB := ReadBoolean;
@@ -2701,7 +2701,7 @@ begin
     WriteInteger(Integer(FWrap[0]));
     WriteInteger(Integer(FWrap[1]));
     WriteInteger(Integer(FWrap[2]));
-    Write(FBorderColor.AsAddress^, SizeOf(TColorVector));
+    Write(FBorderColor.AsAddress^, SizeOf(TGLColorVector));
     WriteInteger(Integer(FCompareMode));
     WriteInteger(Integer(FCompareFunc));
     WriteBoolean(FDecodeSRGB);

+ 4 - 4
Source/GLS.Mesh.pas

@@ -98,10 +98,10 @@ type
       Use the NullVector, NullHmgVector or NullTexPoint constants for
       params you don't want to set. *)
     procedure AddVertex(const aVertex: TVertex; const aNormal: TAffineVector;
-      const aColor: TColorVector; const aTexPoint: TTexPoint); overload;
+      const aColor: TGLColorVector; const aTexPoint: TTexPoint); overload;
     //  Adds a vertex to the list, no texturing version.  
     procedure AddVertex(const vertex: TVertex; const normal: TAffineVector;
-      const color: TColorVector); overload;
+      const color: TGLColorVector); overload;
     //  Adds a vertex to the list, no texturing, not color version.  
     procedure AddVertex(const vertex: TVertex; const normal: TAffineVector); overload;
     //  Duplicates the vertex of given index and adds it at the end of the list. 
@@ -415,7 +415,7 @@ begin
 end;
 
 procedure TGLVertexList.AddVertex(const aVertex: TVertex;
-  const aNormal: TAffineVector; const aColor: TColorVector;
+  const aNormal: TAffineVector; const aColor: TGLColorVector;
   const aTexPoint: TTexPoint);
 begin
   if FCount = FCapacity then
@@ -433,7 +433,7 @@ begin
 end;
 
 procedure TGLVertexList.AddVertex(const vertex: TVertex;
-  const normal: TAffineVector; const color: TColorVector);
+  const normal: TAffineVector; const color: TGLColorVector);
 begin
   AddVertex(vertex, normal, color, NullTexPoint);
 end;

+ 1 - 1
Source/GLS.MeshBSP.pas

@@ -762,7 +762,7 @@ end;
 function TFGBSPNode.AddLerpIfDistinct(iA, iB, iMid: Integer): Integer;
 var
   midNormal: TAffineVector;
-  midColor: TColorVector;
+  midColor: TGLColorVector;
   midTexCoord: TAffineVector;
   midLightmapTexCoord: TAffineVector;
   f: Single;

+ 1 - 1
Source/GLS.Mirror.pas

@@ -141,7 +141,7 @@ var
   oldProxySubObject: Boolean;
   refMat, curMat, ModelMat: TGLMatrix;
   clipPlane: TDoubleHmgPlane;
-  bgColor: TColorVector;
+  bgColor: TGLColorVector;
   cameraPosBackup, cameraDirectionBackup: TGLVector;
   CurrentBuffer: TGLSceneBuffer;
 begin

+ 10 - 7
Source/GLS.Objects.pas

@@ -396,7 +396,7 @@ type
     FNodesAspect: TGLLineNodesAspect;
     FNodeColor: TGLColor;
     FNodeSize: Single;
-    FOldNodeColor: TColorVector;
+    FOldNodeColor: TGLColorVector;
   protected
     procedure SetNodesAspect(const Value: TGLLineNodesAspect);
     procedure SetNodeColor(const Value: TGLColor);
@@ -483,7 +483,8 @@ type
   (* A simple cube object.
     This cube use the same material for each of its faces, ie. all faces look
     the same. If you want a multi-material cube, use a mesh in conjunction
-    with a TGLFreeForm and a material library. *)
+    with a TGLFreeForm and a material library.
+    Ref: https://mathworld.wolfram.com/Cube.html *)
   TGLCube = class(TGLSceneObject)
   private
     FCubeSize: TAffineVector;
@@ -554,8 +555,9 @@ type
   TGLCapType = (ctNone, ctCenter, ctFlat);
 
   (* A sphere object.
-    The sphere can have to and bottom caps, as well as being just a slice
-    of sphere. *)
+    The sphere can have to and bottom caps, as well as being just a slice of sphere.
+    Ref: https://mathworld.wolfram.com/Sphere.html
+    Ref: https://mathworld.wolfram.com/GeodesicDome.html *)
   TGLSphere = class(TGLQuadricObject)
   private
     FRadius: TGLFloat;
@@ -630,7 +632,8 @@ type
   end;
 
   (* A Superellipsoid object. The Superellipsoid can have top and bottom caps,
-    as well as being just a slice of Superellipsoid. *)
+    as well as being just a slice of Superellipsoid.
+    Ref: https://mathworld.wolfram.com/Superellipse.html  *)
   TGLSuperellipsoid = class(TGLQuadricObject)
   private
     FRadius, FVCurve, FHCurve: TGLFloat;
@@ -678,7 +681,7 @@ type
 
 // Issues for a unit-size cube stippled wireframe
 procedure CubeWireframeBuildList(var rci: TGLRenderContextInfo; Size: TGLFloat;
-  Stipple: Boolean; const Color: TColorVector);
+  Stipple: Boolean; const Color: TGLColorVector);
 
 const
   TangentAttributeName: PAnsiChar = 'Tangent';
@@ -689,7 +692,7 @@ implementation
 // -------------------------------------------------------------
 
 procedure CubeWireframeBuildList(var rci: TGLRenderContextInfo; Size: TGLFloat;
-  Stipple: Boolean; const Color: TColorVector);
+  Stipple: Boolean; const Color: TGLColorVector);
 var
   mi, ma: Single;
 begin

+ 8 - 8
Source/GLS.ParticleFX.pas

@@ -497,9 +497,9 @@ type
     procedure InitializeRendering(var rci: TGLRenderContextInfo); override;
     procedure FinalizeRendering(var rci: TGLRenderContextInfo); override;
     function MaxParticleAge: Single; override;
-    procedure ComputeColors(var lifeTime: Single; var inner, outer: TColorVector);
-    procedure ComputeInnerColor(var lifeTime: Single; var inner: TColorVector);
-    procedure ComputeOuterColor(var lifeTime: Single; var outer: TColorVector);
+    procedure ComputeColors(var lifeTime: Single; var inner, outer: TGLColorVector);
+    procedure ComputeInnerColor(var lifeTime: Single; var inner: TGLColorVector);
+    procedure ComputeOuterColor(var lifeTime: Single; var outer: TGLColorVector);
     function ComputeSizeScale(var lifeTime: Single; var sizeScale: Single): Boolean;
     function ComputeRotateAngle(var lifeTime, rotateAngle: Single): Boolean;
     procedure RotateVertexBuf(buf: TAffineVectorList; lifeTime: Single;
@@ -2054,7 +2054,7 @@ begin
   Result := LifeColors.MaxLifeTime;
 end;
 
-procedure TGLLifeColoredPFXManager.ComputeColors(var lifeTime: Single; var inner, outer: TColorVector);
+procedure TGLLifeColoredPFXManager.ComputeColors(var lifeTime: Single; var inner, outer: TGLColorVector);
 var
   i, k, n: Integer;
   f: Single;
@@ -2100,7 +2100,7 @@ begin
   end;
 end;
 
-procedure TGLLifeColoredPFXManager.ComputeInnerColor(var lifeTime: Single; var inner: TColorVector);
+procedure TGLLifeColoredPFXManager.ComputeInnerColor(var lifeTime: Single; var inner: TGLColorVector);
 var
   i, k, n: Integer;
   f: Single;
@@ -2143,7 +2143,7 @@ begin
   end;
 end;
 
-procedure TGLLifeColoredPFXManager.ComputeOuterColor(var lifeTime: Single; var outer: TColorVector);
+procedure TGLLifeColoredPFXManager.ComputeOuterColor(var lifeTime: Single; var outer: TGLColorVector);
 var
   i, k, n: Integer;
   f: Single;
@@ -2451,7 +2451,7 @@ procedure TGLPolygonPFXManager.RenderParticle(var rci: TGLRenderContextInfo; aPa
 var
   i: Integer;
   lifeTime, sizeScale: Single;
-  inner, outer: TColorVector;
+  inner, outer: TGLColorVector;
   pos: TAffineVector;
   vertexList: PAffineVectorArray;
 begin
@@ -2686,7 +2686,7 @@ const
     ((S: 0.5; T: 0.5), (S: 0.0; T: 0.5), (S: 0.0; T: 0.0), (S: 0.5; T: 0.0)));
 var
   lifeTime, sizeScale: Single;
-  inner, outer: TColorVector;
+  inner, outer: TGLColorVector;
   pos: TAffineVector;
   vertexList: PAffineVectorArray;
   i: Integer;

+ 29 - 29
Source/GLS.RandomHDS.pas

@@ -108,7 +108,7 @@ type
   TGLBaseRandomHDS = class;
 
   // Function type to use for topography-based texture
-  TOnDrawTexture = function(const Sender: TGLBaseRandomHDS; x, y: integer; z: double; Normal: TGLVector): TColorVector of object;
+  TOnDrawTexture = function(const Sender: TGLBaseRandomHDS; x, y: integer; z: double; Normal: TGLVector): TGLColorVector of object;
 
   TSingleClamp = procedure(var x, y: single) of object;
   TIntegerClamp = procedure(var x, y: integer) of object;
@@ -131,7 +131,7 @@ type
     FLighting: boolean;
     FLightDirection: TGLVector;
     FTerrainRenderer: TGLTerrainRenderer;
-    FLightColor: TColorVector;
+    FLightColor: TGLColorVector;
     FShadows: boolean;
     FSea: boolean;
     FSeaLevel: single;
@@ -145,13 +145,13 @@ type
     FPrimerLandscape: boolean;
     FLandTileInfo: TLandTileInfo;
     FOnDrawTexture: TOnDrawTexture;
-    function OnDrawTextureDefault(const Sender: TGLBaseRandomHDS; x, y: integer; z: double; Normal: TGLVector): TColorVector;
+    function OnDrawTextureDefault(const Sender: TGLBaseRandomHDS; x, y: integer; z: double; Normal: TGLVector): TGLColorVector;
     procedure SetSeed(const Value: integer);
     procedure SetMaterialName(const Value: string);
     procedure SetLighting(const Value: boolean);
     procedure SetLightDirection(const Value: TGLVector);
     procedure SetTerrainRenderer(const Value: TGLTerrainRenderer); virtual; abstract;
-    procedure SetLightColor(const Value: TColorVector);
+    procedure SetLightColor(const Value: TGLColorVector);
     procedure SetShadows(const Value: boolean);
     procedure SetSea(const Value: boolean);
     procedure SetSeaLevel(const Value: single);
@@ -177,7 +177,7 @@ type
     constructor Create(AOwner: TComponent); override;
     destructor Destroy; override;
     // Usually white, but you can generate e.g.sunset ambiance by setting it to red
-    property LightColor: TColorVector read FLightColor write SetLightColor;
+    property LightColor: TGLColorVector read FLightColor write SetLightColor;
     // Light is parallel (sun light)
     property LightDirection: TGLVector read FLightDirection write SetLightDirection;
     (* This function must be supplied by the user. Here he/she can define which
@@ -274,7 +274,7 @@ type
     procedure BuildNormals;
     (* For every pixel of the texture, computes slope and interpolated height and
       sends these information to a user-supplied function (OnDrawTexture), whose
-      result is a tColorVector. If no OnDrawTexture is supplied, a basic default
+      result is a TGLColorVector. If no OnDrawTexture is supplied, a basic default
       texture will be used. *)
     procedure BuildTexture;
     // Fill the heightfield with "Empty" values (-999)
@@ -571,14 +571,14 @@ type
 
 (* Texture functions *)
 function LoadJPGtexture(const JpgName: string): tBitmap;
-function NoisyColor(const Color: tColor; const Noise: single = 0.05): TColorVector;
-function TextureGreen(const x, y: integer): TColorVector;
-function TextureBlue(const x, y: integer): TColorVector;
-function TextureSand(const x, y: integer): TColorVector;
-function TextureBrownSoil(const x, y: integer): TColorVector;
-function TextureDarkGreen(const x, y: integer): TColorVector;
-function TextureDarkGray(const x, y: integer): TColorVector;
-function TextureWhite(const x, y: integer): TColorVector;
+function NoisyColor(const Color: tColor; const Noise: single = 0.05): TGLColorVector;
+function TextureGreen(const x, y: integer): TGLColorVector;
+function TextureBlue(const x, y: integer): TGLColorVector;
+function TextureSand(const x, y: integer): TGLColorVector;
+function TextureBrownSoil(const x, y: integer): TGLColorVector;
+function TextureDarkGreen(const x, y: integer): TGLColorVector;
+function TextureDarkGray(const x, y: integer): TGLColorVector;
+function TextureWhite(const x, y: integer): TGLColorVector;
 
 (* Random HDS functions *)
 procedure FractalMiddlePointHDS(const aDepth, aSeed, aAmplitude: integer; const aRoughness: single; aCyclic: boolean;
@@ -620,7 +620,7 @@ begin
   Jpg.Free;
 end;
 
-function NoisyColor(const Color: tColor; const Noise: single = 0.05): TColorVector;
+function NoisyColor(const Color: tColor; const Noise: single = 0.05): TGLColorVector;
 var
   r: single;
 begin
@@ -629,37 +629,37 @@ begin
   AddVector(Result, r);
 end;
 
-function TextureSand(const x, y: integer): TColorVector;
+function TextureSand(const x, y: integer): TGLColorVector;
 begin
   Result := NoisyColor($0071D8FF);
 end;
 
-function TextureBrownSoil(const x, y: integer): TColorVector;
+function TextureBrownSoil(const x, y: integer): TGLColorVector;
 begin
   Result := NoisyColor($00008BBF);
 end;
 
-function TextureDarkGreen(const x, y: integer): TColorVector;
+function TextureDarkGreen(const x, y: integer): TGLColorVector;
 begin
   Result := NoisyColor($00004000);
 end;
 
-function TextureDarkGray(const x, y: integer): TColorVector;
+function TextureDarkGray(const x, y: integer): TGLColorVector;
 begin
   Result := NoisyColor(clDkGray);
 end;
 
-function TextureWhite(const x, y: integer): TColorVector;
+function TextureWhite(const x, y: integer): TGLColorVector;
 begin
   Result := NoisyColor(clWhite);
 end;
 
-function TextureBlue(const x, y: integer): TColorVector;
+function TextureBlue(const x, y: integer): TGLColorVector;
 begin
   Result := NoisyColor(clBlue);
 end;
 
-function TextureGreen(const x, y: integer): TColorVector;
+function TextureGreen(const x, y: integer): TGLColorVector;
 begin
   Result := NoisyColor(clGreen);
 end;
@@ -727,7 +727,7 @@ begin
 end;
 
 function TGLBaseRandomHDS.OnDrawTextureDefault(const Sender: TGLBaseRandomHDS; x, y: integer; z: double; Normal: TGLVector)
-  : TColorVector;
+  : TGLColorVector;
 begin
   if z > Sender.SeaLevel * VSF then
     Result := TextureGreen(x, y)
@@ -770,7 +770,7 @@ begin
   FLandTileInfo := Value;
 end;
 
-procedure TGLBaseRandomHDS.SetLightColor(const Value: TColorVector);
+procedure TGLBaseRandomHDS.SetLightColor(const Value: TGLColorVector);
 begin
   FLightColor := Value;
 end;
@@ -1116,7 +1116,7 @@ var
     Result := RGB((r1 + r2) div 2, (g1 + g2) div 2, (b1 + b2) div 2);
   end;
 
-  procedure MakeRGBTriple(const Color: TColorVector; var RGBTriple: TRGBTriple);
+  procedure MakeRGBTriple(const Color: TGLColorVector; var RGBTriple: TRGBTriple);
   begin
     with RGBTriple do
     begin
@@ -1129,8 +1129,8 @@ var
   function ComputePixel(const x, y: integer): TRGBTriple;
   var
     i, j: integer;
-    Shade: TColorVector;
-    Cover: TColorVector;
+    Shade: TGLColorVector;
+    Cover: TGLColorVector;
     z: double;
   begin
     i := (x0 + x) div TextureScale;
@@ -1244,8 +1244,8 @@ end; // *)
   Mat	:TGLLibMaterial;
   x,y	:integer;
   i,j	:integer;
-  Shade	:tColorVector;
-  Cover	:tColorVector;
+  Shade	:TGLColorVector;
+  Cover	:TGLColorVector;
   z		:double;
   begin
   if not fTextureCreated then CreateTexture;

+ 1 - 1
Source/GLS.RenderContextInfo.pas

@@ -78,7 +78,7 @@ type
     GLStates: TGLStateCache;
     PipelineTransformation: TGLTransformation;
     Rcci: TRenderContextClippingInfo;
-    SceneAmbientColor: TColorVector;
+    SceneAmbientColor: TGLColorVector;
     BufferFaceCull: Boolean;
     BufferLighting: Boolean;
     BufferFog: Boolean;

+ 3 - 3
Source/GLS.SceneRegister.pas

@@ -85,7 +85,7 @@ type
   TGLColorProperty = class(TClassProperty, ICustomPropertyDrawing,
     ICustomPropertyListDrawing)
   protected
-    function ColorToBorderColor(aColor: TColorVector; selected: Boolean): TColor;
+    function ColorToBorderColor(aColor: TGLColorVector; selected: Boolean): TColor;
   public
     function GetAttributes: TPropertyAttributes; override;
     procedure GetValues(Proc: TGetStrProc); override;
@@ -688,7 +688,7 @@ begin
   Modified;
 end;
 
-function TGLColorProperty.ColorToBorderColor(aColor: TColorVector; selected: Boolean): TColor;
+function TGLColorProperty.ColorToBorderColor(aColor: TGLColorVector; selected: Boolean): TColor;
 begin
   if (aColor.X > 0.75) or (aColor.Y > 0.75) or (aColor.Z > 0.75) then
     Result := clBlack
@@ -712,7 +712,7 @@ procedure TGLColorProperty.ListDrawValue(const Value: string; ACanvas: TCanvas;
 var
   vRight: Integer;
   vOldPenColor, vOldBrushColor: TColor;
-  Color: TColorVector;
+  Color: TGLColorVector;
 begin
   vRight := (ARect.Bottom - ARect.Top) + ARect.Left;
   with ACanvas do

+ 1 - 1
Source/GLS.ShadowPlane.pas

@@ -112,7 +112,7 @@ implementation
 
 constructor TGLShadowPlane.Create(AOwner: Tcomponent);
 const
-  cDefaultShadowColor: TColorVector = (X:0; Y:0; Z:0; W:0.5);
+  cDefaultShadowColor: TGLColorVector = (X:0; Y:0; Z:0; W:0.5);
 begin
   inherited Create(AOwner);
   FShadowOptions := cDefaultShadowPlaneOptions;

+ 12 - 9
Source/GLS.SkyDome.pas

@@ -190,7 +190,8 @@ type
     (* 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 limitToTopDome: Boolean = False); overload;
+    procedure AddRandomStars(const nb: Integer; const ColorMin, ColorMax:TVector3b;
+      const Magnitude_min, Magnitude_max: Single;const limitToTopDome: Boolean = False); overload;
     (* 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);
@@ -243,7 +244,7 @@ type
   private
     FSunElevation: Single;
     FTurbidity: Single;
-    FCurSunColor, FCurSkyColor, FCurHazeColor: TColorVector;
+    FCurSunColor, FCurSkyColor, FCurHazeColor: TGLColorVector;
     FCurHazeTurbid, FCurSunSkyTurbid: Single;
     FSunZenithColor: TGLColor;
     FSunDawnColor: TGLColor;
@@ -269,7 +270,7 @@ type
     procedure OnColorChanged(Sender: TObject);
     procedure PreCalculate;
     procedure RenderDome;
-    function CalculateColor(const theta, cosGamma: Single): TColorVector;
+    function CalculateColor(const theta, cosGamma: Single): TGLColorVector;
   public
     constructor Create(AOwner: TComponent); override;
     destructor Destroy; override;
@@ -791,7 +792,7 @@ procedure TGLSkyDomeBand.BuildList(var rci: TGLRenderContextInfo);
 
 // always rendered as sphere of radius 1
   procedure RenderBand(start, stop: Single;
-    const colStart, colStop: TColorVector);
+    const colStart, colStop: TGLColorVector);
   var
     i: Integer;
     f, r, r2: Single;
@@ -1008,7 +1009,7 @@ var
   star: TGLSkyDomeStar;
   lastColor: TColor;
   lastPointSize10, pointSize10: Integer;
-  Color, twinkleColor: TColorVector;
+  Color, twinkleColor: TGLColorVector;
 
   procedure DoTwinkle;
   begin
@@ -1080,6 +1081,7 @@ begin
   rci.GLStates.SetGLAlphaFunction(cfGreater, 0);
 end;
 
+//------------------------------------------------------------
 procedure TGLSkyDomeStars.AddRandomStars(const nb: Integer; const Color: TColor;
   const limitToTopDome: Boolean = False);
 var
@@ -1105,6 +1107,7 @@ begin
   end;
 end;
 
+//------------------------------------------------------------
 procedure TGLSkyDomeStars.AddRandomStars(const nb: Integer;
   const ColorMin, ColorMax: TVector3b;
   const Magnitude_min, Magnitude_max: Single;
@@ -1144,7 +1147,7 @@ procedure TGLSkyDomeStars.LoadStarsFile(const starsFileName: string);
 var
   fs: TFileStream;
   sr: TGLStarRecord;
-  colorVector: TColorVector;
+  colorVector: TGLColorVector;
 begin
   fs := TFileStream.Create(starsFileName, fmOpenRead + fmShareDenyWrite);
   try
@@ -1559,7 +1562,7 @@ begin
 end;
 
 function TGLEarthSkyDome.CalculateColor(const theta, cosGamma: Single)
-  : TColorVector;
+  : TGLColorVector;
 var
   t: Single;
 begin
@@ -1592,7 +1595,7 @@ var
     i: Integer;
     r, thetaStart: Single;
     vertex1: TGLVector;
-    Color: TColorVector;
+    Color: TGLColorVector;
   begin
     r := 0;
     vertex1.W := 1;
@@ -1619,7 +1622,7 @@ var
     i: Integer;
     r, r2, thetaStart, thetaStop: Single;
     vertex1, vertex2: TGLVector;
-    Color: TColorVector;
+    Color: TGLColorVector;
   begin
     vertex1.W := 1;
     if stop = 90 then

+ 1 - 1
Source/GLS.ThorFX.pas

@@ -472,7 +472,7 @@ var
 
   vx, vy: TGLVector;
   m: integer;
-  Icol, Ocol, Ccol: TColorVector;
+  Icol, Ocol, Ccol: TGLColorVector;
   Ppos, Ppos2: TAffineVector;
 begin
   if Manager = nil then

+ 0 - 56
Source/GLS.VectorGeometry.pas

@@ -1368,14 +1368,6 @@ function PackRotationMatrix(const mat: TGLMatrix): TPackedRotationMatrix;
 // Restores a packed rotation matrix. See PackRotationMatrix
 function UnPackRotationMatrix(const packedMatrix: TPackedRotationMatrix): TGLMatrix;
 
-(* Calculates the barycentric coordinates for the point p on the triangle
-  defined by the vertices v1, v2 and v3. That is, solves
-  p = u * v1 + v * v2 + (1-u-v) * v3
-  for u,v.
-  Returns true if the point is inside the triangle, false otherwise.
-  NOTE: This function assumes that the point lies on the plane defined by the triangle.
-  If this is not the case, the function will not work correctly! *)
-function BarycentricCoordinates(const V1, V2, V3, p: TAffineVector; var u, V: Single): Boolean;
 (*Calculates angles for the Camera.MoveAroundTarget(pitch, turn) procedure.
   Initially from then GLCameraColtroller unit, requires AOriginalUpVector to contain only -1, 0 or 1.
   Result contains pitch and turn angles *)
@@ -6603,54 +6595,6 @@ begin
   result := QuaternionToMatrix(Q);
 end;
 
-function BarycentricCoordinates(const V1, V2, V3, p: TAffineVector;
-  var u, V: Single): Boolean;
-var
-  a1, a2: Integer;
-  n, e1, e2, pt: TAffineVector;
-begin
-  // calculate edges
-  VectorSubtract(V1, V3, e1);
-  VectorSubtract(V2, V3, e2);
-
-  // calculate p relative to v3
-  VectorSubtract(p, V3, pt);
-
-  // find the dominant axis
-  n := VectorCrossProduct(e1, e2);
-  AbsVector(n);
-  a1 := 0;
-  if n.Y > n.V[a1] then
-    a1 := 1;
-  if n.Z > n.V[a1] then
-    a1 := 2;
-
-  // use dominant axis for projection
-  case a1 of
-    0:
-      begin
-        a1 := 1;
-        a2 := 2;
-      end;
-    1:
-      begin
-        a1 := 0;
-        a2 := 2;
-      end;
-  else // 2:
-    a1 := 0;
-    a2 := 1;
-  end;
-
-  // solve for u and v
-  u := (pt.V[a2] * e2.V[a1] - pt.V[a1] * e2.V[a2]) /
-    (e1.V[a2] * e2.V[a1] - e1.V[a1] * e2.V[a2]);
-  V := (pt.V[a2] * e1.V[a1] - pt.V[a1] * e1.V[a2]) /
-    (e2.V[a2] * e1.V[a1] - e2.V[a1] * e1.V[a2]);
-
-  result := (u >= 0) and (V >= 0) and (u + V <= 1);
-end;
-
 //**********************************************************************
 
 function Vector2fMake(const X, Y: Single): TVector2f;

+ 11 - 11
Source/GLS.Windows.pas

@@ -161,16 +161,16 @@ type
   TGLBaseFontControl = class(TGLBaseControl)
   private
     FBitmapFont: TGLCustomBitmapFont;
-    FDefaultColor: TColorVector;
+    FDefaultColor: TGLColorVector;
   protected
     function GetDefaultColor: TColor;
     procedure SetDefaultColor(value: TColor);
     procedure SetBitmapFont(NewFont: TGLCustomBitmapFont);
     function GetBitmapFont: TGLCustomBitmapFont;
     procedure WriteTextAt(var rci: TGLRenderContextInfo; const X, Y: TGLFloat;
-      const Data: UnicodeString; const Color: TColorVector); overload;
+      const Data: UnicodeString; const Color: TGLColorVector); overload;
     procedure WriteTextAt(var rci: TGLRenderContextInfo; const X1, Y1, X2, Y2:
-      TGLFloat; const Data: UnicodeString; const Color: TColorVector); overload;
+      TGLFloat; const Data: UnicodeString; const Color: TGLColorVector); overload;
     function GetFontHeight: Integer;
   public
     constructor Create(AOwner: TComponent); override;
@@ -199,7 +199,7 @@ type
     FOnKeyUp: TKeyEvent;
     FOnKeyPress: TKeyPressEvent;
     FShiftState: TShiftState;
-    FFocusedColor: TColorVector;
+    FFocusedColor: TGLColorVector;
   protected
     procedure InternalKeyPress(var Key: Char); virtual;
     procedure InternalKeyDown(var Key: Word; Shift: TShiftState); virtual;
@@ -318,7 +318,7 @@ type
     Moving: Boolean;
     OldX: Integer;
     OldY: Integer;
-    FTitleColor: TColorVector;
+    FTitleColor: TGLColorVector;
     FTitleOffset: Single;
   protected
     procedure InternalMouseDown(Shift: TShiftState; Button: TMouseButton; X, Y: Integer); override;
@@ -528,7 +528,7 @@ type
     FColSelect: Boolean;
     FColumns: TStrings;
     FRows: TList;
-    FHeaderColor: TColorVector;
+    FHeaderColor: TGLColorVector;
     FMarginSize: Integer;
     FColumnSize: Integer;
     FRowHeight: Integer;
@@ -1642,7 +1642,7 @@ begin
 end;
 
 procedure TGLBaseFontControl.WriteTextAt(var rci: TGLRenderContextInfo; const X,
-  Y: TGLFloat; const Data: UnicodeString; const Color: TColorVector);
+  Y: TGLFloat; const Data: UnicodeString; const Color: TGLColorVector);
 var
   Position: TGLVector;
 begin
@@ -1657,7 +1657,7 @@ begin
 end;
 
 procedure TGLBaseFontControl.WriteTextAt(var rci: TGLRenderContextInfo; const X1,
-  Y1, X2, Y2: TGLFloat; const Data: UnicodeString; const Color: TColorVector);
+  Y1, X2, Y2: TGLFloat; const Data: UnicodeString; const Color: TGLColorVector);
 var
   Position: TGLVector;
 begin
@@ -2173,7 +2173,7 @@ end;
 procedure TGLForm.InternalRender(var rci: TGLRenderContextInfo; renderSelf,
   renderChildren: Boolean);
 var
-  ATitleColor: TColorVector;
+  ATitleColor: TGLColorVector;
 begin
   if Assigned(FGuiComponent) then
   begin
@@ -2486,7 +2486,7 @@ var
   TexHeight: Integer;
   Material: TGLMaterial;
   LibMaterial: TGLLibMaterial;
-  TextColor: TColorVector;
+  TextColor: TGLColorVector;
 begin
   if Pressed then
   begin
@@ -2773,7 +2773,7 @@ procedure TGLLabel.InternalRender(var rci: TGLRenderContextInfo; renderSelf,
 var
   TekstPos: TGLVector;
   Tekst: UnicodeString;
-  TextColor: TColorVector;
+  TextColor: TGLColorVector;
 begin
   if Assigned(BitmapFont) then
   begin

+ 1 - 1
Source/GLSL.BumpShaders.pas

@@ -1667,7 +1667,7 @@ end;
 procedure TGLBumpShader.DoApply(var rci: TGLRenderContextInfo; Sender: TObject);
 var
   maxTextures, i: Integer;
-  ambient, LMaterialAmbient: TColorVector;
+  ambient, LMaterialAmbient: TGLColorVector;
   success: Boolean;
 begin
   if (csDesigning in ComponentState) and not DesignTimeEnabled then