2
0
Эх сурвалжийг харах

Upgraded transparancyadv sample and fixed physics dpk installation

GLScene 2 жил өмнө
parent
commit
2546c59165
47 өөрчлөгдсөн 2721 нэмэгдсэн , 4036 устгасан
  1. BIN
      Assets/Audio/intro.mp3
  2. 1 0
      Examples/AdvDemos/Archipelago/fArchipelagoD.dfm
  3. 10 3
      Examples/AdvDemos/Archipelago/fArchipelagoD.pas
  4. 0 14
      Examples/Demos/glslshaders/Ocean/OceanD.dproj
  5. 8 5
      Examples/Demos/interface/SimpleNavigation/fSimpleNaviD.dfm
  6. 1 1
      Examples/Demos/interface/SimpleNavigation/fSimpleNaviD.pas
  7. 8 8
      Examples/Demos/materials/TransparencyAdvanced/TransparencyAdv.dproj
  8. 4 7
      Examples/Demos/materials/TransparencyAdvanced/fTransparencyAdv.dfm
  9. 6 2
      Examples/Demos/materials/TransparencyAdvanced/fTransparencyAdv.pas
  10. 59 65
      Examples/Demos/materials/cubemap/fCubeMapC.cpp
  11. 12 8
      Examples/Demos/materials/cubemap/fCubeMapC.dfm
  12. 28 25
      Examples/Demos/materials/cubemap/fCubeMapC.h
  13. 30 14
      Examples/Demos/materials/cubemap/fCubemapD.dfm
  14. 43 20
      Examples/Demos/materials/cubemap/fCubemapD.pas
  15. 29 12
      Examples/Demos/materials/dynamictexture/fDynTextureD.dfm
  16. 2 1
      Examples/Demos/materials/dynamictexture/fDynTextureD.pas
  17. 27 3
      Examples/Demos/materials/materials.groupproj
  18. 0 2
      Examples/Demos/materials/multimaterial/fMultiMaterialD.dfm
  19. 14 0
      Examples/Demos/materials/objectmats/ObjectMatsD.dpr
  20. 59 591
      Examples/Demos/materials/objectmats/ObjectMatsD.dproj
  21. 230 0
      Examples/Demos/materials/objectmats/fObjectMatsD.dfm
  22. 114 0
      Examples/Demos/materials/objectmats/fObjectMatsD.pas
  23. 0 44
      Examples/Demos/rendering/bunnybump/BunnyBumpD.dpr
  24. 0 144
      Examples/Demos/rendering/bunnybump/BunnyBumpD.dproj
  25. 0 35
      Examples/Demos/rendering/bunnybump/BunnybumpC.cpp
  26. 0 225
      Examples/Demos/rendering/bunnybump/fBunnyBumpC.cpp
  27. 0 300
      Examples/Demos/rendering/bunnybump/fBunnyBumpC.dfm
  28. 0 92
      Examples/Demos/rendering/bunnybump/fBunnyBumpC.h
  29. 0 243
      Examples/Demos/rendering/bunnybump/fBunnyBumpD.dfm
  30. 0 246
      Examples/Demos/rendering/bunnybump/fBunnyBumpD.pas
  31. 0 3
      Examples/Demos/specialsFX/Atmosphere/fAtmosphereD.dfm
  32. 2 1
      Examples/Demos/specialsFX/PFXCursor/PfxCursor.dpr
  33. 4 1
      Examples/Demos/specialsFX/PFXCursor/PfxCursor.dproj
  34. 15 3
      Examples/Demos/specialsFX/SpecialFX.groupproj
  35. 25 25
      Packages/GLScene.groupproj
  36. 2 2
      Packages/GLScene_Cg_DT.dpk
  37. 3 3
      Packages/GLScene_Cg_DT.dproj
  38. 1 7
      Packages/GLScene_DT.dproj
  39. 10 8
      Packages/GLScene_Physics_RT.dpk
  40. 9 7
      Packages/GLScene_Physics_RT.dproj
  41. 0 1583
      Source/Physics.GLxManager.pas
  42. 4 4
      Source/Physics.Register.pas
  43. 342 0
      Source/Physics.SPIFields.pas
  44. 414 0
      Source/Physics.SPIForces.pas
  45. 279 251
      Source/Physics.SPIInertias.pas
  46. 28 28
      Source/Physics.SPIJoints.pas
  47. 898 0
      Source/Physics.SPIManager.pas

BIN
Assets/Audio/intro.mp3


+ 1 - 0
Examples/AdvDemos/Archipelago/fArchipelagoD.dfm

@@ -14,6 +14,7 @@ object Form1: TForm1
   Font.Style = []
   Font.Style = []
   OnCreate = FormCreate
   OnCreate = FormCreate
   OnKeyPress = FormKeyPress
   OnKeyPress = FormKeyPress
+  OnShow = FormShow
   TextHeight = 13
   TextHeight = 13
   object GLSceneViewer1: TGLSceneViewer
   object GLSceneViewer1: TGLSceneViewer
     Left = 0
     Left = 0

+ 10 - 3
Examples/AdvDemos/Archipelago/fArchipelagoD.pas

@@ -17,7 +17,7 @@ uses
   Vcl.Dialogs, 
   Vcl.Dialogs, 
   Vcl.Imaging.Jpeg,
   Vcl.Imaging.Jpeg,
 
 
-  GLS.Scene, 
+  GLS.Scene,
   GLS.Cadencer, 
   GLS.Cadencer, 
   GLS.Objects, 
   GLS.Objects, 
   GLS.TerrainRenderer,
   GLS.TerrainRenderer,
@@ -44,7 +44,7 @@ uses
   GLS.State,
   GLS.State,
   GLS.TextureFormat,
   GLS.TextureFormat,
   GLS.File3DS,
   GLS.File3DS,
-  GLS.Utils;
+  GLS.Utils, GLS.Navigator;
 
 
 type
 type
   TForm1 = class(TForm)
   TForm1 = class(TForm)
@@ -85,6 +85,7 @@ type
     procedure doWakeRender(Sender: TObject; var rci: TGLRenderContextInfo);
     procedure doWakeRender(Sender: TObject; var rci: TGLRenderContextInfo);
     procedure TerrainRendererHeightDataPostRender(var rci: TGLRenderContextInfo;
     procedure TerrainRendererHeightDataPostRender(var rci: TGLRenderContextInfo;
       var HeightDatas: TList);
       var HeightDatas: TList);
+    procedure FormShow(Sender: TObject);
   public
   public
     FullScreen: Boolean;
     FullScreen: Boolean;
     CamHeight: Single;
     CamHeight: Single;
@@ -450,6 +451,12 @@ begin
   Key := #0;
   Key := #0;
 end;
 end;
 
 
+procedure TForm1.FormShow(Sender: TObject);
+begin
+  TerrainRenderer.Up.SetVector(0, 0, 1);
+  TerrainRenderer.Direction.SetVector(0, 1, 0);
+end;
+
 procedure TForm1.GLCustomHDS1MarkDirtyEvent(const area: TRect);
 procedure TForm1.GLCustomHDS1MarkDirtyEvent(const area: TRect);
 begin
 begin
   GLHeightTileFileHDS1.MarkDirty(area);
   GLHeightTileFileHDS1.MarkDirty(area);
@@ -463,7 +470,7 @@ var
 begin
 begin
 
 
   htfHD := GLHeightTileFileHDS1.GetData(heightData.XLeft, heightData.YTop, heightData.Size, heightData.DataType);
   htfHD := GLHeightTileFileHDS1.GetData(heightData.XLeft, heightData.YTop, heightData.Size, heightData.DataType);
-  if (htfHD.DataState = hdsNone) then //or (htfHD.HeightMax<=cWaterLevel-cWaterOpaqueDepth) then
+  if (htfHD.DataState = hdsNone) then //or (htfHD.HeightMax <= cWaterLevel - cWaterOpaqueDepth) then
     heightData.DataState := hdsNone
     heightData.DataState := hdsNone
   else
   else
   begin
   begin

+ 0 - 14
Examples/Demos/glslshaders/Ocean/OceanD.dproj

@@ -127,8 +127,6 @@
         <DCCReference Include="fOceanD.pas">
         <DCCReference Include="fOceanD.pas">
             <Form>Form1</Form>
             <Form>Form1</Form>
         </DCCReference>
         </DCCReference>
-        <None Include="..\..\..\media\Shaders\ocean_fp.glsl"/>
-        <None Include="..\..\..\media\Shaders\Shader.Vert"/>
         <BuildConfiguration Include="Base">
         <BuildConfiguration Include="Base">
             <Key>Base</Key>
             <Key>Base</Key>
         </BuildConfiguration>
         </BuildConfiguration>
@@ -161,18 +159,6 @@
                 <Platform value="Win64">True</Platform>
                 <Platform value="Win64">True</Platform>
             </Platforms>
             </Platforms>
             <Deployment Version="3">
             <Deployment Version="3">
-                <DeployFile LocalName="..\..\..\media\Shaders\ocean_fp.glsl" Configuration="Debug" Class="ProjectFile">
-                    <Platform Name="Win32">
-                        <RemoteDir>.\</RemoteDir>
-                        <Overwrite>true</Overwrite>
-                    </Platform>
-                </DeployFile>
-                <DeployFile LocalName="..\..\..\media\Shaders\Shader.Vert" Configuration="Debug" Class="ProjectFile">
-                    <Platform Name="Win32">
-                        <RemoteDir>.\</RemoteDir>
-                        <Overwrite>true</Overwrite>
-                    </Platform>
-                </DeployFile>
                 <DeployFile LocalName="Win32\Debug\OceanD.exe" Configuration="Debug" Class="ProjectOutput">
                 <DeployFile LocalName="Win32\Debug\OceanD.exe" Configuration="Debug" Class="ProjectOutput">
                     <Platform Name="Win32">
                     <Platform Name="Win32">
                         <RemoteName>OceanD.exe</RemoteName>
                         <RemoteName>OceanD.exe</RemoteName>

+ 8 - 5
Examples/Demos/interface/SimpleNavigation/fSimpleNaviD.dfm

@@ -2,26 +2,29 @@ object FormSimpleNavigation: TFormSimpleNavigation
   Left = 326
   Left = 326
   Top = 126
   Top = 126
   Caption = 'Simple Navigation'
   Caption = 'Simple Navigation'
-  ClientHeight = 268
-  ClientWidth = 395
+  ClientHeight = 357
+  ClientWidth = 514
   Color = clBtnFace
   Color = clBtnFace
   Font.Charset = DEFAULT_CHARSET
   Font.Charset = DEFAULT_CHARSET
   Font.Color = clWindowText
   Font.Color = clWindowText
   Font.Height = -11
   Font.Height = -11
   Font.Name = 'MS Sans Serif'
   Font.Name = 'MS Sans Serif'
   Font.Style = []
   Font.Style = []
+  Position = poScreenCenter
   TextHeight = 13
   TextHeight = 13
   object GLSceneViewer1: TGLSceneViewer
   object GLSceneViewer1: TGLSceneViewer
     Left = 0
     Left = 0
     Top = 0
     Top = 0
-    Width = 395
-    Height = 268
+    Width = 514
+    Height = 357
     Camera = GLCamera1
     Camera = GLCamera1
     Buffer.BackgroundColor = clBackground
     Buffer.BackgroundColor = clBackground
-    FieldOfView = 139.075454711914100000
+    FieldOfView = 148.703598022460900000
     PenAsTouch = False
     PenAsTouch = False
     Align = alClient
     Align = alClient
     TabOrder = 0
     TabOrder = 0
+    ExplicitWidth = 492
+    ExplicitHeight = 338
   end
   end
   object GLScene1: TGLScene
   object GLScene1: TGLScene
     Left = 48
     Left = 48

+ 1 - 1
Examples/Demos/interface/SimpleNavigation/fSimpleNaviD.pas

@@ -50,7 +50,7 @@ procedure TFormSimpleNavigation.GLCadencer1Progress(Sender: TObject; const delta
   newTime: Double);
   newTime: Double);
 begin
 begin
   GLSceneViewer1.Invalidate;
   GLSceneViewer1.Invalidate;
-  GLCube1.Turn(0.1);
+  GLCube1.Turn(-0.05);
 end;
 end;
 
 
 end.
 end.

+ 8 - 8
Examples/Demos/materials/TransparencyAdvanced/TransparencyAdv.dproj

@@ -7,7 +7,7 @@
         <TargetedPlatforms>1</TargetedPlatforms>
         <TargetedPlatforms>1</TargetedPlatforms>
         <AppType>Application</AppType>
         <AppType>Application</AppType>
         <FrameworkType>VCL</FrameworkType>
         <FrameworkType>VCL</FrameworkType>
-        <ProjectVersion>19.3</ProjectVersion>
+        <ProjectVersion>19.4</ProjectVersion>
         <Platform Condition="'$(Platform)'==''">Win32</Platform>
         <Platform Condition="'$(Platform)'==''">Win32</Platform>
     </PropertyGroup>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
     <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
@@ -1213,17 +1213,17 @@
                         <Operation>1</Operation>
                         <Operation>1</Operation>
                     </Platform>
                     </Platform>
                 </DeployClass>
                 </DeployClass>
-                <ProjectRoot Platform="OSX32" Name="$(PROJECTNAME).app"/>
-                <ProjectRoot Platform="OSX64" Name="$(PROJECTNAME).app"/>
-                <ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
-                <ProjectRoot Platform="Android64" Name="$(PROJECTNAME)"/>
                 <ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
                 <ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
-                <ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
-                <ProjectRoot Platform="OSXARM64" Name="$(PROJECTNAME).app"/>
+                <ProjectRoot Platform="Android64" Name="$(PROJECTNAME)"/>
                 <ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
                 <ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
                 <ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
                 <ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
-                <ProjectRoot Platform="Linux64" Name="$(PROJECTNAME)"/>
                 <ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
                 <ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
+                <ProjectRoot Platform="Linux64" Name="$(PROJECTNAME)"/>
+                <ProjectRoot Platform="OSX32" Name="$(PROJECTNAME).app"/>
+                <ProjectRoot Platform="OSX64" Name="$(PROJECTNAME).app"/>
+                <ProjectRoot Platform="OSXARM64" Name="$(PROJECTNAME).app"/>
+                <ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
+                <ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
             </Deployment>
             </Deployment>
         </BorlandProject>
         </BorlandProject>
         <ProjectFileVersion>12</ProjectFileVersion>
         <ProjectFileVersion>12</ProjectFileVersion>

+ 4 - 7
Examples/Demos/materials/TransparencyAdvanced/fTransparencyAdv.dfm

@@ -13,7 +13,6 @@ object Form1: TForm1
   Position = poScreenCenter
   Position = poScreenCenter
   OnCreate = FormCreate
   OnCreate = FormCreate
   OnResize = FormResize
   OnResize = FormResize
-  PixelsPerInch = 96
   TextHeight = 13
   TextHeight = 13
   object GLSceneViewer1: TGLSceneViewer
   object GLSceneViewer1: TGLSceneViewer
     Left = 0
     Left = 0
@@ -179,15 +178,13 @@ object Form1: TForm1
       end
       end
       item
       item
         Name = 'Surround'
         Name = 'Surround'
-        Tag = 0
+        Tag = 1
         Material.MaterialOptions = [moNoLighting]
         Material.MaterialOptions = [moNoLighting]
-        Material.Texture.ImageClassName = 'TGLCompositeImage'
-        Material.Texture.Image.Width = 256
-        Material.Texture.Image.Height = 256
-        Material.Texture.Image.Depth = 0
-        Material.Texture.TextureWrap = twSeparate
+        Material.Texture.MagFilter = maNearest
+        Material.Texture.MinFilter = miNearest
         Material.Texture.TextureWrapS = twMirrorRepeat
         Material.Texture.TextureWrapS = twMirrorRepeat
         Material.Texture.TextureWrapR = twMirrorRepeat
         Material.Texture.TextureWrapR = twMirrorRepeat
+        Material.Texture.Compression = tcNone
         Material.Texture.Disabled = False
         Material.Texture.Disabled = False
         TextureScale.Coordinates = {000080400000803F0000803F00000000}
         TextureScale.Coordinates = {000080400000803F0000803F00000000}
       end
       end

+ 6 - 2
Examples/Demos/materials/TransparencyAdvanced/fTransparencyAdv.pas

@@ -97,8 +97,12 @@ var
 begin
 begin
   var Path: TFileName := GetCurrentAssetPath();
   var Path: TFileName := GetCurrentAssetPath();
   SetCurrentDir(Path  + '\texture');
   SetCurrentDir(Path  + '\texture');
-  GLMaterialLibrary1.TextureByName('Surround').Image.LoadFromFile('WheatFld.JPG');
-    SetCurrentDir(Path  + '\shader');
+
+  // loadable only for Persistent Images
+  GLMaterialLibrary1.TextureByName('Surround').Image.LoadFromFile('wheatfld.jpg');
+  GLMaterialLibrary1.TextureByName('Surround').Disabled := False;
+
+  SetCurrentDir(Path  + '\shader');
   GLSLShader1.LoadShaderPrograms('OIT_vtx.glsl','OIT_frag.glsl');
   GLSLShader1.LoadShaderPrograms('OIT_vtx.glsl','OIT_frag.glsl');
   GLSLShader1.Enabled := true;
   GLSLShader1.Enabled := true;
 
 

+ 59 - 65
Examples/Demos/materials/cubemap/fCubeMapC.cpp

@@ -14,92 +14,86 @@
 #pragma link "GLS.GeomObjects"
 #pragma link "GLS.GeomObjects"
 #pragma link "GLS.SceneViewer"
 #pragma link "GLS.SceneViewer"
 #pragma link "GLS.Texture"
 #pragma link "GLS.Texture"
+#pragma link "GLS.FileDDS"
 #pragma resource "*.dfm"
 #pragma resource "*.dfm"
-TForm1 *Form1;
+TForm1* Form1;
 
 
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
-__fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) {
-}
+__fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) {}
 
 
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
-void __fastcall TForm1::GLSceneViewer1BeforeRender(TObject *Sender) {
-	// CubmapSupported = !GL_ARB_texture_cube_map;
-	GLSceneViewer1->BeforeRender = NULL;
-
+void __fastcall TForm1::GLSceneViewer1BeforeRender(TObject* Sender)
+{
+    // CubmapSupported = !GL_ARB_texture_cube_map;
+    GLSceneViewer1->BeforeRender = NULL;
 }
 }
 
 
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
-void __fastcall TForm1::FormCreate(TObject *Sender)
+void __fastcall TForm1::FormCreate(TObject* Sender)
 {
 {
-  // Our cube map images are here
-  TFileName Path = GetCurrentAssetPath();
-  SetCurrentDir(Path + "\\cubemap");
+    // Our cube map images are here
+    TFileName Path = GetCurrentAssetPath();
+    SetCurrentDir(Path + "\\cubemap");
 }
 }
 
 
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
-void __fastcall TForm1::Button1Click(TObject *Sender) {
-	// Cube map warning message
-	// If you don't check and turn off cube maps yourself in your apps when
-	// cube maps aren't supported, GLScene will just turn off texturing
-	// (ie. no error generated, just a different output)
-
-	/*
-	 if (!CubmapSupported)
-	 {
-	 ShowMessage("Your graphics board does not support cube maps...");
-	 exit;
-	 }
-	 */
-
-	// We need a CubeMapImage, which unlike the "regular Images" stores
-	// multiple images.
-
-	// with Teapot1->Material->Texture->
-	Teapot1->Material->Texture->ImageClassName =
-		__classid(TGLCubeMapImage)->ClassName();
-	TGLCubeMapImage *Image =
-		(TGLCubeMapImage*) Teapot1->Material->Texture->Image;
-
-	// Load all 6 texture map components of the cube map
-	// The 'PX', 'NX', etc. refer to 'positive X', 'negative X', etc.
-	// and follow the RenderMan specs/conventions
-	Image->Picture[CmtPX]->LoadFromFile("cm_left.jpg");
-	Image->Picture[CmtNX]->LoadFromFile("cm_right.jpg");
-	Image->Picture[CmtPY]->LoadFromFile("cm_top.jpg");
-	Image->Picture[CmtNY]->LoadFromFile("cm_bottom.jpg");
-	Image->Picture[CmtPZ]->LoadFromFile("cm_back.jpg");
-	Image->Picture[CmtNZ]->LoadFromFile("cm_front.jpg");
-	// Select reflection cube map environment mapping
-	// This is the mode you'll most commonly use with cube maps, normal cube
-	// map generation is also supported (used for diffuse environment lighting)
-	Teapot1->Material->Texture->MappingMode = tmmCubeMapReflection;
-	// That's all folks, let us see the thing!
-	Teapot1->Material->Texture->Disabled = false;
-	Button1->Visible = false;
+void __fastcall TForm1::btnApplyClick(TObject* Sender)
+{
+    // We need a CubeMapImage, which unlike the "regular Images" stores multiple images.
+
+    Teapot1->Material->Texture->ImageClassName =
+        __classid(TGLCubeMapImage)->ClassName();
+    TGLCubeMapImage* Image =
+        (TGLCubeMapImage*)Teapot1->Material->Texture->Image;
+
+    // Load all 6 texture map components of the cube map
+    // The 'PX', 'NX', etc. refer to 'positive X', 'negative X', etc.
+    // and follow the RenderMan specs/conventions
+    Image->Picture[CmtPX]->LoadFromFile("cm_left.jpg");
+    Image->Picture[CmtNX]->LoadFromFile("cm_right.jpg");
+    Image->Picture[CmtPY]->LoadFromFile("cm_top.jpg");
+    Image->Picture[CmtNY]->LoadFromFile("cm_bottom.jpg");
+    Image->Picture[CmtPZ]->LoadFromFile("cm_back.jpg");
+    Image->Picture[CmtNZ]->LoadFromFile("cm_front.jpg");
+    // Select reflection cube map environment mapping
+    // This is the mode you'll most commonly use with cube maps, normal cube
+    // map generation is also supported (used for diffuse environment lighting)
+    Teapot1->Material->Texture->MappingMode = tmmCubeMapReflection;
+    // That's all folks, let us see the thing!
+    Teapot1->Material->Texture->Disabled = false;
+
+    // apply .dds cubemaps to next objects
+    DDStex(Plane1->Material->Texture, "skybox.dds");
+    Plane1->Material->Texture->MappingMode = tmmEyeLinear;
+
+    btnApply->Visible = false;
 }
 }
 
 
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
-void __fastcall TForm1::GLSceneViewer1MouseDown(TObject *Sender,
-	TMouseButton Button, TShiftState Shift, int X, int Y) {
-	mx = X;
-	my = Y;
+void __fastcall TForm1::GLSceneViewer1MouseDown(
+    TObject* Sender, TMouseButton Button, TShiftState Shift, int X, int Y)
+{
+    mx = X;
+    my = Y;
 }
 }
 
 
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
-void __fastcall TForm1::GLSceneViewer1MouseMove(TObject *Sender,
-	TShiftState Shift, int X, int Y) {
-	if (Shift.Contains(ssLeft))
-		GLCamera1->MoveAroundTarget(my - Y, mx - X);
-	else if (Shift.Contains(ssRight))
-		GLCamera1->RotateTarget(my - Y, mx - X, 0);
-	mx = X;
-	my = Y;
+void __fastcall TForm1::GLSceneViewer1MouseMove(
+    TObject* Sender, TShiftState Shift, int X, int Y)
+{
+    if (Shift.Contains(ssLeft))
+        GLCamera1->MoveAroundTarget(my - Y, mx - X);
+    else if (Shift.Contains(ssRight))
+        GLCamera1->RotateTarget(my - Y, mx - X, 0);
+    mx = X;
+    my = Y;
 }
 }
 
 
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
-void __fastcall TForm1::FormMouseWheel(TObject *Sender, TShiftState Shift,
-	int WheelDelta, TPoint &MousePos, bool &Handled) {
-	GLCamera1->AdjustDistanceToTarget(Power(1.1, (WheelDelta / 120.0)));
+void __fastcall TForm1::FormMouseWheel(TObject* Sender, TShiftState Shift,
+    int WheelDelta, TPoint &MousePos, bool &Handled)
+{
+    GLCamera1->AdjustDistanceToTarget(Power(1.1, (WheelDelta / 120.0)));
 }
 }
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
 
 

+ 12 - 8
Examples/Demos/materials/cubemap/fCubeMapC.dfm

@@ -28,23 +28,21 @@ object Form1: TForm1
     OnMouseDown = GLSceneViewer1MouseDown
     OnMouseDown = GLSceneViewer1MouseDown
     OnMouseMove = GLSceneViewer1MouseMove
     OnMouseMove = GLSceneViewer1MouseMove
     TabOrder = 0
     TabOrder = 0
-    ExplicitWidth = 540
-    ExplicitHeight = 384
   end
   end
-  object Button1: TButton
-    Left = 200
+  object btnApply: TButton
+    Left = 240
     Top = 16
     Top = 16
-    Width = 163
+    Width = 105
     Height = 25
     Height = 25
-    Caption = 'Apply Cube Environment Map'
+    Caption = 'Apply Cube Map'
     TabOrder = 1
     TabOrder = 1
-    OnClick = Button1Click
+    OnClick = btnApplyClick
   end
   end
   object GLScene1: TGLScene
   object GLScene1: TGLScene
     Left = 24
     Left = 24
     Top = 8
     Top = 8
     object DummyCube1: TGLDummyCube
     object DummyCube1: TGLDummyCube
-      CubeSize = 0.800000011920929000
+      CubeSize = 1.000000000000000000
       VisibleAtRunTime = True
       VisibleAtRunTime = True
     end
     end
     object GLLightSource1: TGLLightSource
     object GLLightSource1: TGLLightSource
@@ -55,6 +53,12 @@ object Form1: TForm1
     object Teapot1: TGLTeapot
     object Teapot1: TGLTeapot
       Material.Texture.TextureMode = tmReplace
       Material.Texture.TextureMode = tmReplace
     end
     end
+    object Plane1: TGLPlane
+      Position.Coordinates = {0000000000000000000000BF0000803F}
+      Up.Coordinates = {0000803F000000000000008000000000}
+      Height = 1.000000000000000000
+      Width = 1.000000000000000000
+    end
     object GLCamera1: TGLCamera
     object GLCamera1: TGLCamera
       DepthOfView = 100.000000000000000000
       DepthOfView = 100.000000000000000000
       FocalLength = 300.000000000000000000
       FocalLength = 300.000000000000000000

+ 28 - 25
Examples/Demos/materials/cubemap/fCubeMapC.h

@@ -12,6 +12,8 @@
 #include <Vcl.Controls.hpp>
 #include <Vcl.Controls.hpp>
 #include <Vcl.StdCtrls.hpp>
 #include <Vcl.StdCtrls.hpp>
 #include <Vcl.Forms.hpp>
 #include <Vcl.Forms.hpp>
+#include "Jpeg.hpp"
+
 #include "GLS.BaseClasses.hpp"
 #include "GLS.BaseClasses.hpp"
 #include "GLS.Coordinates.hpp"
 #include "GLS.Coordinates.hpp"
 
 
@@ -19,39 +21,40 @@
 #include "GLS.Scene.hpp"
 #include "GLS.Scene.hpp"
 #include "GLS.GeomObjects.hpp"
 #include "GLS.GeomObjects.hpp"
 #include "GLS.SceneViewer.hpp"
 #include "GLS.SceneViewer.hpp"
-#include "Jpeg.hpp"
 #include "GLS.Color.hpp"
 #include "GLS.Color.hpp"
 #include "GLS.Context.hpp"
 #include "GLS.Context.hpp"
 #include "GLS.Texture.hpp"
 #include "GLS.Texture.hpp"
-
+#include "GLS.FileDDS.hpp"
 
 
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
 class TForm1 : public TForm
 class TForm1 : public TForm
 {
 {
-__published:	// IDE-managed Components
-	TGLSceneViewer *GLSceneViewer1;
-	TButton *Button1;
-	TGLScene *GLScene1;
-	TGLDummyCube *DummyCube1;
-	TGLLightSource *GLLightSource1;
-	TGLTeapot *Teapot1;
-	TGLCamera *GLCamera1;
-	void __fastcall GLSceneViewer1BeforeRender(TObject *Sender);
-	void __fastcall Button1Click(TObject *Sender);
-	void __fastcall GLSceneViewer1MouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift,
-          int X, int Y);
-	void __fastcall GLSceneViewer1MouseMove(TObject *Sender, TShiftState Shift, int X,
-          int Y);
-	void __fastcall FormMouseWheel(TObject *Sender, TShiftState Shift, int WheelDelta,
-          TPoint &MousePos, bool &Handled);
-	void __fastcall FormCreate(TObject *Sender);
-private:	// User declarations
-	int mx,my;
-	bool CubmapSupported;
-public:		// User declarations
-	__fastcall TForm1(TComponent* Owner);
+  __published: // IDE-managed Components
+    TGLSceneViewer* GLSceneViewer1;
+    TButton* btnApply;
+    TGLScene* GLScene1;
+	TGLDummyCube* DummyCube1;
+    TGLLightSource* GLLightSource1;
+    TGLTeapot* Teapot1;
+    TGLCamera* GLCamera1;
+    TGLPlane* Plane1;
+    void __fastcall GLSceneViewer1BeforeRender(TObject* Sender);
+    void __fastcall btnApplyClick(TObject* Sender);
+    void __fastcall GLSceneViewer1MouseDown(
+        TObject* Sender, TMouseButton Button, TShiftState Shift, int X, int Y);
+    void __fastcall GLSceneViewer1MouseMove(
+        TObject* Sender, TShiftState Shift, int X, int Y);
+    void __fastcall FormMouseWheel(TObject* Sender, TShiftState Shift,
+        int WheelDelta, TPoint &MousePos, bool &Handled);
+    void __fastcall FormCreate(TObject* Sender);
+  private: // User declarations
+    int mx, my;
+    bool CubmapSupported;
+  public: // User declarations
+    __fastcall TForm1(TComponent* Owner);
 };
 };
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
-extern PACKAGE TForm1 *Form1;
+extern PACKAGE TForm1* Form1;
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
 #endif
 #endif
+

+ 30 - 14
Examples/Demos/materials/cubemap/fCubemapD.dfm

@@ -27,24 +27,27 @@ object FormCubeMap: TFormCubeMap
     OnMouseDown = GLSceneViewer1MouseDown
     OnMouseDown = GLSceneViewer1MouseDown
     OnMouseMove = GLSceneViewer1MouseMove
     OnMouseMove = GLSceneViewer1MouseMove
     TabOrder = 0
     TabOrder = 0
-    ExplicitWidth = 539
-    ExplicitHeight = 373
   end
   end
-  object ButtonApply: TButton
-    Left = 224
-    Top = 312
-    Width = 163
+  object btnApply: TButton
+    Left = 232
+    Top = 16
+    Width = 131
     Height = 25
     Height = 25
-    Caption = 'Apply Cube Environment Map'
+    Caption = 'Apply Cube Map'
     TabOrder = 1
     TabOrder = 1
-    OnClick = ButtonApplyClick
+    OnClick = btnApplyClick
   end
   end
   object GLScene1: TGLScene
   object GLScene1: TGLScene
     Left = 8
     Left = 8
     Top = 8
     Top = 8
+    object GLLightSource1: TGLLightSource
+      ConstAttenuation = 1.000000000000000000
+      Position.Coordinates = {0000E0400000A040000040400000803F}
+      SpotCutOff = 180.000000000000000000
+    end
     object DummyCube1: TGLDummyCube
     object DummyCube1: TGLDummyCube
       Position.Coordinates = {000000C0000000C0000000C00000803F}
       Position.Coordinates = {000000C0000000C0000000C00000803F}
-      CubeSize = 0.800000011920929000
+      CubeSize = 1.000000000000000000
       VisibleAtRunTime = True
       VisibleAtRunTime = True
       object Teapot1: TGLTeapot
       object Teapot1: TGLTeapot
         Material.BackProperties.Ambient.Color = {ADAC2C3FCDCC4C3ECDCC4C3E0000803F}
         Material.BackProperties.Ambient.Color = {ADAC2C3FCDCC4C3ECDCC4C3E0000803F}
@@ -59,11 +62,24 @@ object FormCubeMap: TFormCubeMap
         Material.Texture.TextureMode = tmReplace
         Material.Texture.TextureMode = tmReplace
         Position.Coordinates = {00000000000080BE000000000000803F}
         Position.Coordinates = {00000000000080BE000000000000803F}
       end
       end
-    end
-    object GLLightSource1: TGLLightSource
-      ConstAttenuation = 1.000000000000000000
-      Position.Coordinates = {0000E0400000A040000040400000803F}
-      SpotCutOff = 180.000000000000000000
+      object Cylinder1: TGLCylinder
+        Position.Coordinates = {000000BF000000000000803F0000803F}
+        Scale.Coordinates = {0000003F0000003F0000003F00000000}
+        BottomRadius = 0.500000000000000000
+        Height = 1.000000000000000000
+        TopRadius = 0.500000000000000000
+      end
+      object Cone1: TGLCone
+        Position.Coordinates = {0000803F00000000000000BF0000803F}
+        Scale.Coordinates = {9A99193F9A99193F9A99193F00000000}
+        BottomRadius = 0.500000000000000000
+        Height = 1.000000000000000000
+      end
+      object Plane1: TGLPlane
+        Position.Coordinates = {0000000000000000000000BF0000803F}
+        Height = 1.000000000000000000
+        Width = 1.000000000000000000
+      end
     end
     end
     object GLCamera1: TGLCamera
     object GLCamera1: TGLCamera
       DepthOfView = 100.000000000000000000
       DepthOfView = 100.000000000000000000

+ 43 - 20
Examples/Demos/materials/cubemap/fCubemapD.pas

@@ -1,5 +1,7 @@
 unit fCubemapD;
 unit fCubemapD;
+
 interface
 interface
+
 uses
 uses
   System.SysUtils,
   System.SysUtils,
   System.Classes,
   System.Classes,
@@ -13,11 +15,13 @@ uses
   GLS.SceneViewer,
   GLS.SceneViewer,
   GLS.Objects,
   GLS.Objects,
   GLS.Texture,
   GLS.Texture,
+  GLS.FileDDS,
   GLS.Context,
   GLS.Context,
   GLS.Utils,
   GLS.Utils,
   GLS.Coordinates,
   GLS.Coordinates,
   GLS.BaseClasses,
   GLS.BaseClasses,
   GLS.GeomObjects;
   GLS.GeomObjects;
+
 type
 type
   TFormCubeMap = class(TForm)
   TFormCubeMap = class(TForm)
     GLScene1: TGLScene;
     GLScene1: TGLScene;
@@ -25,31 +29,38 @@ type
     GLCamera1: TGLCamera;
     GLCamera1: TGLCamera;
     DummyCube1: TGLDummyCube;
     DummyCube1: TGLDummyCube;
     GLLightSource1: TGLLightSource;
     GLLightSource1: TGLLightSource;
-    ButtonApply: TButton;
+    btnApply: TButton;
     Teapot1: TGLTeapot;
     Teapot1: TGLTeapot;
-    procedure GLSceneViewer1MouseMove(Sender: TObject; Shift: TShiftState;
+    Cylinder1: TGLCylinder;
+    Cone1: TGLCone;
+    Plane1: TGLPlane;
+    procedure GLSceneViewer1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
+    procedure GLSceneViewer1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState;
       X, Y: Integer);
       X, Y: Integer);
-    procedure GLSceneViewer1MouseDown(Sender: TObject;
-      Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
-    procedure ButtonApplyClick(Sender: TObject);
+    procedure btnApplyClick(Sender: TObject);
     procedure GLSceneViewer1BeforeRender(Sender: TObject);
     procedure GLSceneViewer1BeforeRender(Sender: TObject);
     procedure FormCreate(Sender: TObject);
     procedure FormCreate(Sender: TObject);
   private
   private
+    Path: TFileName;
     CubmapSupported: Boolean;
     CubmapSupported: Boolean;
-    CubemapPath: TFilename;
+    CubemapPath: TFileName;
     Cubemap: TGLTexture;
     Cubemap: TGLTexture;
   public
   public
     mx, my: Integer;
     mx, my: Integer;
   end;
   end;
+
 var
 var
   FormCubeMap: TFormCubeMap;
   FormCubeMap: TFormCubeMap;
+
 implementation
 implementation
+
 {$R *.dfm}
 {$R *.dfm}
+
 procedure TFormCubeMap.FormCreate(Sender: TObject);
 procedure TFormCubeMap.FormCreate(Sender: TObject);
 begin
 begin
   // Our cube map images are here
   // Our cube map images are here
-  var Path: TFileName := GetCurrentAssetPath();
-  SetCurrentDir(Path  + '\cubemap');  
+  Path := GetCurrentAssetPath();
+  SetCurrentDir(Path + '\cubemap');
 end;
 end;
 
 
 procedure TFormCubeMap.GLSceneViewer1BeforeRender(Sender: TObject);
 procedure TFormCubeMap.GLSceneViewer1BeforeRender(Sender: TObject);
@@ -57,7 +68,8 @@ begin
   CubmapSupported := GL.ARB_texture_cube_map;
   CubmapSupported := GL.ARB_texture_cube_map;
   GLSceneViewer1.BeforeRender := nil;
   GLSceneViewer1.BeforeRender := nil;
 end;
 end;
-procedure TFormCubeMap.ButtonApplyClick(Sender: TObject);
+
+procedure TFormCubeMap.btnApplyClick(Sender: TObject);
 begin
 begin
   // Cube map warning message
   // Cube map warning message
   // If you don't check and turn off cube maps yourself in your apps when
   // If you don't check and turn off cube maps yourself in your apps when
@@ -92,26 +104,37 @@ begin
     // That's all folks, let us see the thing!
     // That's all folks, let us see the thing!
     Disabled := False;
     Disabled := False;
   end;
   end;
-  ButtonApply.Visible := False;
+
+  // apply .dds cubemaps to next objects
+  DDStex(Cylinder1.Material.Texture, 'skybox.dds');
+  Cylinder1.Material.Texture.MappingMode := tmmEyeLinear;
+  DDStex(Cone1.Material.Texture, 'skybox.dds');
+  Cone1.Material.Texture.MappingMode := tmmEyeLinear;
+  DDStex(Plane1.Material.Texture, 'skybox.dds');
+  Plane1.Material.Texture.MappingMode := tmmEyeLinear;
+
+  btnApply.Visible := False;
 end;
 end;
+
 // standard issue handlers for mouse movement
 // standard issue handlers for mouse movement
-procedure TFormCubeMap.GLSceneViewer1MouseDown(Sender: TObject;
-  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
+procedure TFormCubeMap.GLSceneViewer1MouseDown(Sender: TObject; Button: TMouseButton;
+  Shift: TShiftState; X, Y: Integer);
 begin
 begin
-  mx := x;
-  my := y;
+  mx := X;
+  my := Y;
 end;
 end;
-procedure TFormCubeMap.GLSceneViewer1MouseMove(Sender: TObject;
-  Shift: TShiftState; X, Y: Integer);
+
+procedure TFormCubeMap.GLSceneViewer1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
 begin
 begin
   if Shift <> [] then
   if Shift <> [] then
   begin
   begin
     if ssLeft in Shift then
     if ssLeft in Shift then
-      GLCamera1.MoveAroundTarget(my - y, mx - x)
+      GLCamera1.MoveAroundTarget(my - Y, mx - X)
     else
     else
-      GLCamera1.RotateTarget(my - y, mx - x);
-    mx := x;
-    my := y;
+      GLCamera1.RotateTarget(my - Y, mx - X);
+    mx := X;
+    my := Y;
   end;
   end;
 end;
 end;
+
 end.
 end.

+ 29 - 12
Examples/Demos/materials/dynamictexture/fDynTextureD.dfm

@@ -2,35 +2,32 @@ object FormDynamicTexture: TFormDynamicTexture
   Left = 407
   Left = 407
   Top = 201
   Top = 201
   Caption = 'Dynamic Texture'
   Caption = 'Dynamic Texture'
-  ClientHeight = 453
-  ClientWidth = 548
+  ClientHeight = 415
+  ClientWidth = 600
   Color = clBtnFace
   Color = clBtnFace
   Font.Charset = DEFAULT_CHARSET
   Font.Charset = DEFAULT_CHARSET
   Font.Color = clWindowText
   Font.Color = clWindowText
-  Font.Height = -14
+  Font.Height = -11
   Font.Name = 'Tahoma'
   Font.Name = 'Tahoma'
   Font.Style = []
   Font.Style = []
   Position = poScreenCenter
   Position = poScreenCenter
   OnCreate = FormCreate
   OnCreate = FormCreate
   OnKeyDown = FormKeyDown
   OnKeyDown = FormKeyDown
   OnResize = FormResize
   OnResize = FormResize
-  PixelsPerInch = 120
-  TextHeight = 17
+  TextHeight = 13
   object SceneViewer: TGLSceneViewer
   object SceneViewer: TGLSceneViewer
     Left = 0
     Left = 0
     Top = 0
     Top = 0
-    Width = 548
-    Height = 453
-    Margins.Left = 4
-    Margins.Top = 4
-    Margins.Right = 4
-    Margins.Bottom = 4
+    Width = 600
+    Height = 415
     Camera = GLCamera1
     Camera = GLCamera1
     Buffer.BackgroundColor = clGray
     Buffer.BackgroundColor = clGray
-    FieldOfView = 155.103134155273400000
+    FieldOfView = 152.904129028320300000
     PenAsTouch = False
     PenAsTouch = False
     Align = alClient
     Align = alClient
     TabOrder = 0
     TabOrder = 0
+    ExplicitWidth = 440
+    ExplicitHeight = 362
   end
   end
   object Scene: TGLScene
   object Scene: TGLScene
     Left = 64
     Left = 64
@@ -81,4 +78,24 @@ object FormDynamicTexture: TFormDynamicTexture
     Left = 160
     Left = 160
     Top = 88
     Top = 88
   end
   end
+  object GLSimpleNavigation1: TGLSimpleNavigation
+    Form = Owner
+    GLSceneViewer = SceneViewer
+    FormCaption = 'Dynamic Texture - %FPS'
+    KeyCombinations = <
+      item
+        ShiftState = [ssLeft, ssRight]
+        Action = snaZoom
+      end
+      item
+        ShiftState = [ssLeft]
+        Action = snaMoveAroundTarget
+      end
+      item
+        ShiftState = [ssRight]
+        Action = snaMoveAroundTarget
+      end>
+    Left = 392
+    Top = 24
+  end
 end
 end

+ 2 - 1
Examples/Demos/materials/dynamictexture/fDynTextureD.pas

@@ -23,7 +23,7 @@ uses
   GLS.RenderContextInfo, 
   GLS.RenderContextInfo, 
   GLS.Context, 
   GLS.Context, 
   GLS.DynamicTexture, 
   GLS.DynamicTexture, 
-  GLS.Utils;
+  GLS.Utils, GLS.Navigator, GLS.SimpleNavigation;
 
 
 type
 type
   TFormDynamicTexture = class(TForm)
   TFormDynamicTexture = class(TForm)
@@ -37,6 +37,7 @@ type
     GLDirectOpenGL1: TGLDirectOpenGL;
     GLDirectOpenGL1: TGLDirectOpenGL;
     Cadencer: TGLCadencer;
     Cadencer: TGLCadencer;
     Timer: TTimer;
     Timer: TTimer;
+    GLSimpleNavigation1: TGLSimpleNavigation;
     procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
     procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
     procedure FormResize(Sender: TObject);
     procedure FormResize(Sender: TObject);
     procedure FormCreate(Sender: TObject);
     procedure FormCreate(Sender: TObject);

+ 27 - 3
Examples/Demos/materials/materials.groupproj

@@ -87,6 +87,12 @@
         <Projects Include="transparency\TransparencyC.cbproj">
         <Projects Include="transparency\TransparencyC.cbproj">
             <Dependencies/>
             <Dependencies/>
         </Projects>
         </Projects>
+        <Projects Include="objectmats\ObjectMatsD.dproj">
+            <Dependencies/>
+        </Projects>
+        <Projects Include="TransparencyAdvanced\TransparencyAdv.dproj">
+            <Dependencies/>
+        </Projects>
     </ItemGroup>
     </ItemGroup>
     <ProjectExtensions>
     <ProjectExtensions>
         <Borland.Personality>Default.Personality.12</Borland.Personality>
         <Borland.Personality>Default.Personality.12</Borland.Personality>
@@ -347,14 +353,32 @@
     <Target Name="TransparencyC:Make">
     <Target Name="TransparencyC:Make">
         <MSBuild Projects="transparency\TransparencyC.cbproj" Targets="Make"/>
         <MSBuild Projects="transparency\TransparencyC.cbproj" Targets="Make"/>
     </Target>
     </Target>
+    <Target Name="ObjectMatsD">
+        <MSBuild Projects="objectmats\ObjectMatsD.dproj"/>
+    </Target>
+    <Target Name="ObjectMatsD:Clean">
+        <MSBuild Projects="objectmats\ObjectMatsD.dproj" Targets="Clean"/>
+    </Target>
+    <Target Name="ObjectMatsD:Make">
+        <MSBuild Projects="objectmats\ObjectMatsD.dproj" Targets="Make"/>
+    </Target>
+    <Target Name="TransparencyAdv">
+        <MSBuild Projects="TransparencyAdvanced\TransparencyAdv.dproj"/>
+    </Target>
+    <Target Name="TransparencyAdv:Clean">
+        <MSBuild Projects="TransparencyAdvanced\TransparencyAdv.dproj" Targets="Clean"/>
+    </Target>
+    <Target Name="TransparencyAdv:Make">
+        <MSBuild Projects="TransparencyAdvanced\TransparencyAdv.dproj" Targets="Make"/>
+    </Target>
     <Target Name="Build">
     <Target Name="Build">
-        <CallTarget Targets="CubemapD;CubemapC;CustomQuadD;CustomQuadC;DynTextureD;DynTextureC;DynCubemapD;DynCubemapC;Fire2D_GR32;MatScriptD;MatScriptC;MirrorD;MirrorC;MultiMaterialD;MultiMaterialC;MultipassD;MultipassC;MultiTextureD;MultiTextureC;ProcCloudsD;ProcCloudsC;TexAnimD;TexAnimC;TexCombineD;TexFormatD;TexFormatC;TransparencyD;TransparencyC"/>
+        <CallTarget Targets="CubemapD;CubemapC;CustomQuadD;CustomQuadC;DynTextureD;DynTextureC;DynCubemapD;DynCubemapC;Fire2D_GR32;MatScriptD;MatScriptC;MirrorD;MirrorC;MultiMaterialD;MultiMaterialC;MultipassD;MultipassC;MultiTextureD;MultiTextureC;ProcCloudsD;ProcCloudsC;TexAnimD;TexAnimC;TexCombineD;TexFormatD;TexFormatC;TransparencyD;TransparencyC;ObjectMatsD;TransparencyAdv"/>
     </Target>
     </Target>
     <Target Name="Clean">
     <Target Name="Clean">
-        <CallTarget Targets="CubemapD:Clean;CubemapC:Clean;CustomQuadD:Clean;CustomQuadC:Clean;DynTextureD:Clean;DynTextureC:Clean;DynCubemapD:Clean;DynCubemapC:Clean;Fire2D_GR32:Clean;MatScriptD:Clean;MatScriptC:Clean;MirrorD:Clean;MirrorC:Clean;MultiMaterialD:Clean;MultiMaterialC:Clean;MultipassD:Clean;MultipassC:Clean;MultiTextureD:Clean;MultiTextureC:Clean;ProcCloudsD:Clean;ProcCloudsC:Clean;TexAnimD:Clean;TexAnimC:Clean;TexCombineD:Clean;TexFormatD:Clean;TexFormatC:Clean;TransparencyD:Clean;TransparencyC:Clean"/>
+        <CallTarget Targets="CubemapD:Clean;CubemapC:Clean;CustomQuadD:Clean;CustomQuadC:Clean;DynTextureD:Clean;DynTextureC:Clean;DynCubemapD:Clean;DynCubemapC:Clean;Fire2D_GR32:Clean;MatScriptD:Clean;MatScriptC:Clean;MirrorD:Clean;MirrorC:Clean;MultiMaterialD:Clean;MultiMaterialC:Clean;MultipassD:Clean;MultipassC:Clean;MultiTextureD:Clean;MultiTextureC:Clean;ProcCloudsD:Clean;ProcCloudsC:Clean;TexAnimD:Clean;TexAnimC:Clean;TexCombineD:Clean;TexFormatD:Clean;TexFormatC:Clean;TransparencyD:Clean;TransparencyC:Clean;ObjectMatsD:Clean;TransparencyAdv:Clean"/>
     </Target>
     </Target>
     <Target Name="Make">
     <Target Name="Make">
-        <CallTarget Targets="CubemapD:Make;CubemapC:Make;CustomQuadD:Make;CustomQuadC:Make;DynTextureD:Make;DynTextureC:Make;DynCubemapD:Make;DynCubemapC:Make;Fire2D_GR32:Make;MatScriptD:Make;MatScriptC:Make;MirrorD:Make;MirrorC:Make;MultiMaterialD:Make;MultiMaterialC:Make;MultipassD:Make;MultipassC:Make;MultiTextureD:Make;MultiTextureC:Make;ProcCloudsD:Make;ProcCloudsC:Make;TexAnimD:Make;TexAnimC:Make;TexCombineD:Make;TexFormatD:Make;TexFormatC:Make;TransparencyD:Make;TransparencyC:Make"/>
+        <CallTarget Targets="CubemapD:Make;CubemapC:Make;CustomQuadD:Make;CustomQuadC:Make;DynTextureD:Make;DynTextureC:Make;DynCubemapD:Make;DynCubemapC:Make;Fire2D_GR32:Make;MatScriptD:Make;MatScriptC:Make;MirrorD:Make;MirrorC:Make;MultiMaterialD:Make;MultiMaterialC:Make;MultipassD:Make;MultipassC:Make;MultiTextureD:Make;MultiTextureC:Make;ProcCloudsD:Make;ProcCloudsC:Make;TexAnimD:Make;TexAnimC:Make;TexCombineD:Make;TexFormatD:Make;TexFormatC:Make;TransparencyD:Make;TransparencyC:Make;ObjectMatsD:Make;TransparencyAdv:Make"/>
     </Target>
     </Target>
     <Import Project="$(BDS)\Bin\CodeGear.Group.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Group.Targets')"/>
     <Import Project="$(BDS)\Bin\CodeGear.Group.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Group.Targets')"/>
 </Project>
 </Project>

+ 0 - 2
Examples/Demos/materials/multimaterial/fMultiMaterialD.dfm

@@ -25,8 +25,6 @@ object FormMultiMat: TFormMultiMat
     Align = alClient
     Align = alClient
     OnMouseDown = GLSceneViewer1MouseDown
     OnMouseDown = GLSceneViewer1MouseDown
     TabOrder = 0
     TabOrder = 0
-    ExplicitWidth = 447
-    ExplicitHeight = 312
   end
   end
   object GLScene1: TGLScene
   object GLScene1: TGLScene
     Left = 24
     Left = 24

+ 14 - 0
Examples/Demos/materials/objectmats/ObjectMatsD.dpr

@@ -0,0 +1,14 @@
+program ObjectMatsD;
+
+uses
+  Vcl.Forms,
+  fObjectMatsD in 'fObjectMatsD.pas' {FormMO};
+
+{$R *.res}
+
+begin
+  Application.Initialize;
+  Application.MainFormOnTaskbar := True;
+  Application.CreateForm(TFormMO, FormMO);
+  Application.Run;
+end.

+ 59 - 591
Examples/Demos/rendering/bunnybump/BunnybumpC.cbproj → Examples/Demos/materials/objectmats/ObjectMatsD.dproj

@@ -1,14 +1,14 @@
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     <PropertyGroup>
     <PropertyGroup>
-        <ProjectGuid>{B9D468E4-0CEB-468D-A8B1-A8A729A37712}</ProjectGuid>
+        <ProjectGuid>{EE3A4BC6-8C20-49CF-866C-7DF15DEA3447}</ProjectGuid>
         <ProjectVersion>19.4</ProjectVersion>
         <ProjectVersion>19.4</ProjectVersion>
         <FrameworkType>VCL</FrameworkType>
         <FrameworkType>VCL</FrameworkType>
-        <AppType>Application</AppType>
-        <MainSource>BunnybumpC.cpp</MainSource>
         <Base>True</Base>
         <Base>True</Base>
         <Config Condition="'$(Config)'==''">Debug</Config>
         <Config Condition="'$(Config)'==''">Debug</Config>
         <Platform Condition="'$(Platform)'==''">Win32</Platform>
         <Platform Condition="'$(Platform)'==''">Win32</Platform>
         <TargetedPlatforms>1</TargetedPlatforms>
         <TargetedPlatforms>1</TargetedPlatforms>
+        <AppType>Application</AppType>
+        <MainSource>ObjectMatsD.dpr</MainSource>
     </PropertyGroup>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
     <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
         <Base>true</Base>
         <Base>true</Base>
@@ -34,12 +34,6 @@
         <Cfg_1>true</Cfg_1>
         <Cfg_1>true</Cfg_1>
         <Base>true</Base>
         <Base>true</Base>
     </PropertyGroup>
     </PropertyGroup>
-    <PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win64)'!=''">
-        <Cfg_1_Win64>true</Cfg_1_Win64>
-        <CfgParent>Cfg_1</CfgParent>
-        <Cfg_1>true</Cfg_1>
-        <Base>true</Base>
-    </PropertyGroup>
     <PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
     <PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
         <Cfg_2>true</Cfg_2>
         <Cfg_2>true</Cfg_2>
         <CfgParent>Base</CfgParent>
         <CfgParent>Base</CfgParent>
@@ -51,103 +45,69 @@
         <Cfg_2>true</Cfg_2>
         <Cfg_2>true</Cfg_2>
         <Base>true</Base>
         <Base>true</Base>
     </PropertyGroup>
     </PropertyGroup>
-    <PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win64)'!=''">
-        <Cfg_2_Win64>true</Cfg_2_Win64>
-        <CfgParent>Cfg_2</CfgParent>
-        <Cfg_2>true</Cfg_2>
-        <Base>true</Base>
-    </PropertyGroup>
     <PropertyGroup Condition="'$(Base)'!=''">
     <PropertyGroup Condition="'$(Base)'!=''">
-        <SanitizedProjectName>BunnybumpC</SanitizedProjectName>
+        <DCC_E>false</DCC_E>
+        <DCC_N>false</DCC_N>
+        <DCC_S>false</DCC_S>
+        <DCC_F>false</DCC_F>
+        <DCC_K>false</DCC_K>
         <DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
         <DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
-        <IncludePath>D:\GLScene\Samples\CPP\Demos\rendering\bunnybump\;$(IncludePath)</IncludePath>
-        <ILINK_LibraryPath>D:\GLScene\Samples\CPP\Demos\rendering\bunnybump\;$(ILINK_LibraryPath)</ILINK_LibraryPath>
-        <ProjectType>CppVCLApplication</ProjectType>
-        <Multithreaded>true</Multithreaded>
-        <AllPackageLibs>rtl.lib;vcl.lib;GLScene_RT.lib;fmx.lib;xmlrtl.lib;vclimg.lib</AllPackageLibs>
-        <Icon_MainIcon>$(BDS)\bin\cbuilder_PROJECTICON.ico</Icon_MainIcon>
-        <_TCHARMapping>wchar_t</_TCHARMapping>
-        <DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>
-        <DynamicRTL>true</DynamicRTL>
-        <UsePackages>true</UsePackages>
-        <IntermediateOutputDir>.\$(Platform)\$(Config)</IntermediateOutputDir>
-        <FinalOutputDir>.\$(Platform)\$(Config)</FinalOutputDir>
-        <BCC_wpar>false</BCC_wpar>
-        <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
-        <BCC_ExtendedErrorInfo>true</BCC_ExtendedErrorInfo>
+        <Icon_MainIcon>$(BDS)\bin\delphi_PROJECTICON.ico</Icon_MainIcon>
+        <UWP_DelphiLogo44>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png</UWP_DelphiLogo44>
+        <UWP_DelphiLogo150>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png</UWP_DelphiLogo150>
+        <SanitizedProjectName>ObjectMatsD</SanitizedProjectName>
     </PropertyGroup>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Base_Win32)'!=''">
     <PropertyGroup Condition="'$(Base_Win32)'!=''">
-        <AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
+        <DCC_UsePackage>vclwinx;DataSnapServer;bdertl;fmx;emshosting;vclie;DbxCommonDriver;bindengine;IndyIPCommon;VCLRESTComponents;DBXMSSQLDriver;FireDACCommonODBC;emsclient;FireDACCommonDriver;appanalytics;IndyProtocols;vclx;IndyIPClient;dbxcds;vcledge;bindcompvclwinx;FmxTeeUI;emsedge;bindcompfmx;DBXFirebirdDriver;inetdb;FireDACSqliteDriver;DbxClientDriver;FireDACASADriver;Tee;soapmidas;vclactnband;TeeUI;fmxFireDAC;dbexpress;FireDACInfxDriver;DBXMySQLDriver;VclSmp;inet;DataSnapCommon;vcltouch;fmxase;DBXOdbcDriver;dbrtl;FireDACDBXDriver;FireDACOracleDriver;fmxdae;TeeDB;FireDACMSAccDriver;CustomIPTransport;FireDACMSSQLDriver;DataSnapIndy10ServerTransport;DataSnapConnectors;vcldsnap;DBXInterBaseDriver;FireDACMongoDBDriver;IndySystem;FireDACTDataDriver;vcldb;vclFireDAC;bindcomp;FireDACCommon;DataSnapServerMidas;FireDACODBCDriver;emsserverresource;IndyCore;RESTBackendComponents;bindcompdbx;rtl;FireDACMySQLDriver;FireDACADSDriver;RESTComponents;DBXSqliteDriver;vcl;IndyIPServer;dsnapxml;dsnapcon;DataSnapClient;DataSnapProviderClient;adortl;DBXSybaseASEDriver;DBXDb2Driver;vclimg;DataSnapFireDAC;emsclientfiredac;FireDACPgDriver;FireDAC;FireDACDSDriver;inetdbxpress;xmlrtl;tethering;bindcompvcl;dsnap;CloudService;DBXSybaseASADriver;DBXOracleDriver;FireDACDb2Driver;DBXInformixDriver;fmxobj;bindcompvclsmp;DataSnapNativeClient;FMXTee;DatasnapConnectorsFreePascal;soaprtl;vcldbx;soapserver;FireDACIBDriver;$(DCC_UsePackage)</DCC_UsePackage>
         <DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
         <DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
-        <PackageImports>IndyIPClient;frx17;fs17;GLScene_Physics_RT;bindcompfmx;DBXSqliteDriver;vcldbx;GLScene_Physics_RT;fmx;rtl;dbrtl;DbxClientDriver;IndySystem;TeeDB;bindcomp;inetdb;inetdbbde;vclib;DBXInterBaseDriver;DataSnapClient;DataSnapCommon;DBXOdbcDriver;DataSnapServer;Tee;GLScene_RT;DataSnapProviderClient;xmlrtl;DBXSybaseASEDriver;ibxpress;DbxCommonDriver;vclimg;IndyProtocols;DBXMySQLDriver;dbxcds;MetropolisUILiveTile;bindengine;vclactnband;vcldb;soaprtl;bindcompdbx;vcldsnap;bindcompvcl;FMXTee;TeeUI;vclie;DBXDb2Driver;vcltouch;bcbsmp;websnap;DBXOracleDriver;CustomIPTransport;vclribbon;VclSmp;dsnap;DBXInformixDriver;IndyIPServer;fmxase;vcl;DataSnapConnectors;IndyCore;DBXMSSQLDriver;CodeSiteExpressPkg;CloudService;DBXFirebirdDriver;dsnapcon;frxDB17;inet;fsDB17;fmxobj;IndyIPCommon;FmxTeeUI;vclx;frxe17;inetdbxpress;webdsnap;DBXSybaseASADriver;fmxdae;bdertl;dbexpress;DataSnapIndy10ServerTransport;adortl;bcbie;$(PackageImports)</PackageImports>
+        <BT_BuildType>Debug</BT_BuildType>
         <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
         <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
-        <IncludePath>$(BDSINCLUDE)\windows\vcl;$(IncludePath)</IncludePath>
+        <VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
         <VerInfo_Locale>1033</VerInfo_Locale>
         <VerInfo_Locale>1033</VerInfo_Locale>
-        <VerInfo_Keys>CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)</VerInfo_Keys>
         <Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
         <Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
-        <UWP_CppLogo44>$(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png</UWP_CppLogo44>
-        <UWP_CppLogo150>$(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png</UWP_CppLogo150>
+        <AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
+        <AppDPIAwarenessMode>none</AppDPIAwarenessMode>
     </PropertyGroup>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Base_Win64)'!=''">
     <PropertyGroup Condition="'$(Base_Win64)'!=''">
-        <AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
-        <VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
-        <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
-        <VerInfo_Locale>1033</VerInfo_Locale>
-        <PackageImports>IndyIPClient;frx17;fs17;GLScene_Physics_RT;bindcompfmx;DBXSqliteDriver;vcldbx;GLScene_Physics_RT;fmx;rtl;dbrtl;DbxClientDriver;IndySystem;TeeDB;bindcomp;inetdb;inetdbbde;vclib;DBXInterBaseDriver;DataSnapClient;DataSnapCommon;DBXOdbcDriver;DataSnapServer;Tee;GLScene_RT;DataSnapProviderClient;xmlrtl;DBXSybaseASEDriver;ibxpress;DbxCommonDriver;vclimg;IndyProtocols;DBXMySQLDriver;dbxcds;MetropolisUILiveTile;bindengine;vclactnband;vcldb;soaprtl;bindcompdbx;vcldsnap;bindcompvcl;FMXTee;TeeUI;vclie;DBXDb2Driver;vcltouch;bcbsmp;websnap;DBXOracleDriver;CustomIPTransport;vclribbon;VclSmp;dsnap;DBXInformixDriver;IndyIPServer;fmxase;vcl;DataSnapConnectors;IndyCore;DBXMSSQLDriver;CodeSiteExpressPkg;CloudService;DBXFirebirdDriver;dsnapcon;frxDB17;inet;fsDB17;fmxobj;IndyIPCommon;FmxTeeUI;vclx;frxe17;inetdbxpress;webdsnap;DBXSybaseASADriver;fmxdae;bdertl;dbexpress;DataSnapIndy10ServerTransport;adortl;bcbie;$(PackageImports)</PackageImports>
-        <DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)</DCC_Namespace>
-        <Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
-        <UWP_CppLogo44>$(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png</UWP_CppLogo44>
-        <UWP_CppLogo150>$(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png</UWP_CppLogo150>
+        <DCC_UsePackage>vclwinx;DataSnapServer;fmx;emshosting;vclie;DbxCommonDriver;bindengine;IndyIPCommon;VCLRESTComponents;DBXMSSQLDriver;FireDACCommonODBC;emsclient;FireDACCommonDriver;appanalytics;IndyProtocols;vclx;IndyIPClient;dbxcds;vcledge;bindcompvclwinx;FmxTeeUI;emsedge;bindcompfmx;DBXFirebirdDriver;inetdb;FireDACSqliteDriver;DbxClientDriver;FireDACASADriver;Tee;soapmidas;vclactnband;TeeUI;fmxFireDAC;dbexpress;FireDACInfxDriver;DBXMySQLDriver;VclSmp;inet;DataSnapCommon;vcltouch;fmxase;DBXOdbcDriver;dbrtl;FireDACDBXDriver;FireDACOracleDriver;fmxdae;TeeDB;FireDACMSAccDriver;CustomIPTransport;FireDACMSSQLDriver;DataSnapIndy10ServerTransport;DataSnapConnectors;vcldsnap;DBXInterBaseDriver;FireDACMongoDBDriver;IndySystem;FireDACTDataDriver;vcldb;vclFireDAC;bindcomp;FireDACCommon;DataSnapServerMidas;FireDACODBCDriver;emsserverresource;IndyCore;RESTBackendComponents;bindcompdbx;rtl;FireDACMySQLDriver;FireDACADSDriver;RESTComponents;DBXSqliteDriver;vcl;IndyIPServer;dsnapxml;dsnapcon;DataSnapClient;DataSnapProviderClient;adortl;DBXSybaseASEDriver;DBXDb2Driver;vclimg;DataSnapFireDAC;emsclientfiredac;FireDACPgDriver;FireDAC;FireDACDSDriver;inetdbxpress;xmlrtl;tethering;bindcompvcl;dsnap;CloudService;DBXSybaseASADriver;DBXOracleDriver;FireDACDb2Driver;DBXInformixDriver;fmxobj;bindcompvclsmp;DataSnapNativeClient;FMXTee;DatasnapConnectorsFreePascal;soaprtl;soapserver;FireDACIBDriver;$(DCC_UsePackage)</DCC_UsePackage>
     </PropertyGroup>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Cfg_1)'!=''">
     <PropertyGroup Condition="'$(Cfg_1)'!=''">
-        <BCC_OptimizeForSpeed>false</BCC_OptimizeForSpeed>
-        <BCC_DisableOptimizations>true</BCC_DisableOptimizations>
+        <DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
+        <DCC_DebugDCUs>true</DCC_DebugDCUs>
         <DCC_Optimize>false</DCC_Optimize>
         <DCC_Optimize>false</DCC_Optimize>
+        <DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
         <DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
         <DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
-        <BCC_InlineFunctionExpansion>false</BCC_InlineFunctionExpansion>
-        <BCC_UseRegisterVariables>None</BCC_UseRegisterVariables>
-        <DCC_Define>DEBUG</DCC_Define>
-        <BCC_DebugLineNumbers>true</BCC_DebugLineNumbers>
-        <TASM_DisplaySourceLines>true</TASM_DisplaySourceLines>
-        <BCC_StackFrames>true</BCC_StackFrames>
-        <ILINK_FullDebugInfo>true</ILINK_FullDebugInfo>
-        <TASM_Debugging>Full</TASM_Debugging>
-        <BCC_SourceDebuggingOn>true</BCC_SourceDebuggingOn>
-        <BCC_EnableCPPExceptions>true</BCC_EnableCPPExceptions>
-        <BCC_DisableFramePtrElimOpt>true</BCC_DisableFramePtrElimOpt>
-        <BCC_DisableSpellChecking>true</BCC_DisableSpellChecking>
-        <CLANG_UnwindTables>true</CLANG_UnwindTables>
-        <ILINK_LibraryPath>$(BDSLIB)\$(PLATFORM)\debug;$(ILINK_LibraryPath)</ILINK_LibraryPath>
+        <DCC_RemoteDebug>true</DCC_RemoteDebug>
+        <DCC_IntegerOverflowCheck>true</DCC_IntegerOverflowCheck>
+        <DCC_RangeChecking>true</DCC_RangeChecking>
     </PropertyGroup>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
     <PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
-        <ILINK_LibraryPath>$(BDSCOMMONDIR)\Dcp;$(BDSLIB)\$(PLATFORM)$(CC_SUFFIX)\debug;$(ILINK_LibraryPath)</ILINK_LibraryPath>
-        <Defines>_DEBUG;$(Defines)</Defines>
-        <LinkPackageImports>rtl.bpi;vcl.bpi;GLScene_RT.bpi;fmx.bpi;xmlrtl.bpi;vclimg.bpi</LinkPackageImports>
-        <BT_BuildType>Debug</BT_BuildType>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Cfg_1_Win64)'!=''">
-        <Defines>_DEBUG;$(Defines)</Defines>
+        <DCC_RemoteDebug>false</DCC_RemoteDebug>
+        <AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
+        <AppDPIAwarenessMode>PerMonitorV2</AppDPIAwarenessMode>
+        <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
+        <VerInfo_Locale>1033</VerInfo_Locale>
     </PropertyGroup>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Cfg_2)'!=''">
     <PropertyGroup Condition="'$(Cfg_2)'!=''">
-        <TASM_Debugging>None</TASM_Debugging>
+        <DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
+        <DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
+        <DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
+        <DCC_DebugInformation>0</DCC_DebugInformation>
     </PropertyGroup>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
     <PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
-        <Defines>NDEBUG;$(Defines)</Defines>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Cfg_2_Win64)'!=''">
-        <Defines>NDEBUG;$(Defines)</Defines>
+        <AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
+        <AppDPIAwarenessMode>PerMonitorV2</AppDPIAwarenessMode>
+        <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
+        <VerInfo_Locale>1033</VerInfo_Locale>
     </PropertyGroup>
     </PropertyGroup>
     <ItemGroup>
     <ItemGroup>
-        <CppCompile Include="BunnybumpC.cpp">
-            <BuildOrder>0</BuildOrder>
-        </CppCompile>
-        <CppCompile Include="fBunnyBumpC.cpp">
-            <Form>Form1</Form>
+        <DelphiCompile Include="$(MainSource)">
+            <MainSource>MainSource</MainSource>
+        </DelphiCompile>
+        <DCCReference Include="fObjectMatsD.pas">
+            <Form>FormMO</Form>
             <FormType>dfm</FormType>
             <FormType>dfm</FormType>
-            <DependentOn>fBunnyBumpC.h</DependentOn>
-            <BuildOrder>2</BuildOrder>
-        </CppCompile>
-        <FormResources Include="fBunnyBumpC.dfm"/>
+        </DCCReference>
         <BuildConfiguration Include="Base">
         <BuildConfiguration Include="Base">
             <Key>Base</Key>
             <Key>Base</Key>
         </BuildConfiguration>
         </BuildConfiguration>
@@ -161,193 +121,24 @@
         </BuildConfiguration>
         </BuildConfiguration>
     </ItemGroup>
     </ItemGroup>
     <ProjectExtensions>
     <ProjectExtensions>
-        <Borland.Personality>CPlusPlusBuilder.Personality.12</Borland.Personality>
-        <Borland.ProjectType>CppVCLApplication</Borland.ProjectType>
+        <Borland.Personality>Delphi.Personality.12</Borland.Personality>
+        <Borland.ProjectType>Application</Borland.ProjectType>
         <BorlandProject>
         <BorlandProject>
-            <CPlusPlusBuilder.Personality>
+            <Delphi.Personality>
                 <Source>
                 <Source>
-                    <Source Name="MainSource">BunnybumpC.cpp</Source>
+                    <Source Name="MainSource">ObjectMatsD.dpr</Source>
                 </Source>
                 </Source>
-                <VersionInfo>
-                    <VersionInfo Name="IncludeVerInfo">False</VersionInfo>
-                    <VersionInfo Name="AutoIncBuild">False</VersionInfo>
-                    <VersionInfo Name="MajorVer">1</VersionInfo>
-                    <VersionInfo Name="MinorVer">0</VersionInfo>
-                    <VersionInfo Name="Release">0</VersionInfo>
-                    <VersionInfo Name="Build">0</VersionInfo>
-                    <VersionInfo Name="Debug">False</VersionInfo>
-                    <VersionInfo Name="PreRelease">False</VersionInfo>
-                    <VersionInfo Name="Special">False</VersionInfo>
-                    <VersionInfo Name="Private">False</VersionInfo>
-                    <VersionInfo Name="DLL">False</VersionInfo>
-                    <VersionInfo Name="Locale">1049</VersionInfo>
-                    <VersionInfo Name="CodePage">1251</VersionInfo>
-                </VersionInfo>
-                <VersionInfoKeys>
-                    <VersionInfoKeys Name="CompanyName"/>
-                    <VersionInfoKeys Name="FileDescription"/>
-                    <VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
-                    <VersionInfoKeys Name="InternalName"/>
-                    <VersionInfoKeys Name="LegalCopyright"/>
-                    <VersionInfoKeys Name="LegalTrademarks"/>
-                    <VersionInfoKeys Name="OriginalFilename"/>
-                    <VersionInfoKeys Name="ProductName"/>
-                    <VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
-                    <VersionInfoKeys Name="Comments"/>
-                    <VersionInfoKeys Name="CFBundleName"/>
-                    <VersionInfoKeys Name="CFBundleDisplayName"/>
-                    <VersionInfoKeys Name="CFBundleIdentifier"/>
-                    <VersionInfoKeys Name="CFBundleVersion"/>
-                    <VersionInfoKeys Name="CFBundlePackageType"/>
-                    <VersionInfoKeys Name="CFBundleSignature"/>
-                    <VersionInfoKeys Name="CFBundleAllowMixedLocalizations"/>
-                    <VersionInfoKeys Name="CFBundleExecutable"/>
-                </VersionInfoKeys>
-                <ProjectProperties>
-                    <ProjectProperties Name="AutoShowDeps">False</ProjectProperties>
-                    <ProjectProperties Name="ManagePaths">True</ProjectProperties>
-                    <ProjectProperties Name="VerifyPackages">True</ProjectProperties>
-                    <ProjectProperties Name="IndexFiles">False</ProjectProperties>
-                </ProjectProperties>
-            </CPlusPlusBuilder.Personality>
+                <Excluded_Packages>
+                    <Excluded_Packages Name="$(BDSBIN)\bcboffice2k280.bpl">Embarcadero C++Builder Office 2000 Servers Package</Excluded_Packages>
+                    <Excluded_Packages Name="$(BDSBIN)\bcbofficexp280.bpl">Embarcadero C++Builder Office XP Servers Package</Excluded_Packages>
+                    <Excluded_Packages Name="$(BDSBIN)\dcloffice2k280.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
+                    <Excluded_Packages Name="$(BDSBIN)\dclofficexp280.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
+                </Excluded_Packages>
+            </Delphi.Personality>
             <Deployment Version="3">
             <Deployment Version="3">
-                <DeployFile Condition="'$(UsingDelphiRTL)'=='true'" LocalName="$(BDS)\bin64\borlndmm.dll" Class="DependencyModule">
-                    <Platform Name="Win64">
-                        <Overwrite>true</Overwrite>
-                    </Platform>
-                </DeployFile>
-                <DeployFile Condition="'$(DynamicRTL)'=='true' And '$(Multithreaded)'!='true'" LocalName="$(BDS)\bin64\cc64230.dll" Class="DependencyModule">
-                    <Platform Name="Win64">
-                        <Overwrite>true</Overwrite>
-                    </Platform>
-                </DeployFile>
-                <DeployFile Condition="'$(DynamicRTL)'=='true' And '$(Multithreaded)'=='true'" LocalName="$(BDS)\bin64\cc64230mt.dll" Class="DependencyModule">
-                    <Platform Name="Win64">
-                        <Overwrite>true</Overwrite>
-                    </Platform>
-                </DeployFile>
-                <DeployFile Condition="'$(DynamicRTL)'=='true' And '$(Multithreaded)'!='true'" LocalName="$(BDS)\bin64\cc64240.dll" Class="DependencyModule">
-                    <Platform Name="Win64">
-                        <Overwrite>true</Overwrite>
-                    </Platform>
-                </DeployFile>
-                <DeployFile Condition="'$(DynamicRTL)'=='true' And '$(Multithreaded)'=='true'" LocalName="$(BDS)\bin64\cc64240mt.dll" Class="DependencyModule">
-                    <Platform Name="Win64">
-                        <Overwrite>true</Overwrite>
-                    </Platform>
-                </DeployFile>
-                <DeployFile Condition="'$(DynamicRTL)'=='true' And '$(Multithreaded)'!='true'" LocalName="$(BDS)\bin64\cc64260.dll" Class="DependencyModule">
-                    <Platform Name="Win64">
-                        <Overwrite>true</Overwrite>
-                    </Platform>
-                </DeployFile>
-                <DeployFile Condition="'$(DynamicRTL)'=='true' And '$(Multithreaded)'=='true'" LocalName="$(BDS)\bin64\cc64260mt.dll" Class="DependencyModule">
-                    <Platform Name="Win64">
-                        <Overwrite>true</Overwrite>
-                    </Platform>
-                </DeployFile>
-                <DeployFile Condition="'$(DynamicRTL)'=='true' And '$(Multithreaded)'!='true'" LocalName="$(BDS)\bin64\cc64280.dll" Class="DependencyModule">
-                    <Platform Name="Win64">
-                        <Overwrite>true</Overwrite>
-                    </Platform>
-                </DeployFile>
-                <DeployFile Condition="'$(DynamicRTL)'=='true' And '$(Multithreaded)'=='true'" LocalName="$(BDS)\bin64\cc64280mt.dll" Class="DependencyModule">
-                    <Platform Name="Win64">
-                        <Overwrite>true</Overwrite>
-                    </Platform>
-                </DeployFile>
-                <DeployFile Condition="'$(UsingDelphiRTL)'=='true'" LocalName="$(BDS)\bin\borlndmm.dll" Class="DependencyModule">
+                <DeployFile LocalName="Win32\Debug\ObjectMatsD.exe" Configuration="Debug" Class="ProjectOutput">
                     <Platform Name="Win32">
                     <Platform Name="Win32">
-                        <Overwrite>true</Overwrite>
-                    </Platform>
-                </DeployFile>
-                <DeployFile Condition="'$(DynamicRTL)'=='true' And '$(Multithreaded)'!='true'" LocalName="$(BDS)\bin\cc32230.dll" Class="DependencyModule">
-                    <Platform Name="Win32">
-                        <Overwrite>true</Overwrite>
-                    </Platform>
-                </DeployFile>
-                <DeployFile Condition="'$(DynamicRTL)'=='true' And '$(Multithreaded)'=='true'" LocalName="$(BDS)\bin\cc32230mt.dll" Class="DependencyModule">
-                    <Platform Name="Win32">
-                        <Overwrite>true</Overwrite>
-                    </Platform>
-                </DeployFile>
-                <DeployFile Condition="'$(DynamicRTL)'=='true' And '$(Multithreaded)'!='true'" LocalName="$(BDS)\bin\cc32240.dll" Class="DependencyModule">
-                    <Platform Name="Win32">
-                        <Overwrite>true</Overwrite>
-                    </Platform>
-                </DeployFile>
-                <DeployFile Condition="'$(DynamicRTL)'=='true' And '$(Multithreaded)'=='true'" LocalName="$(BDS)\bin\cc32240mt.dll" Class="DependencyModule">
-                    <Platform Name="Win32">
-                        <Overwrite>true</Overwrite>
-                    </Platform>
-                </DeployFile>
-                <DeployFile Condition="'$(DynamicRTL)'=='true' And '$(Multithreaded)'!='true'" LocalName="$(BDS)\bin\cc32260.dll" Class="DependencyModule">
-                    <Platform Name="Win32">
-                        <Overwrite>true</Overwrite>
-                    </Platform>
-                </DeployFile>
-                <DeployFile Condition="'$(DynamicRTL)'=='true' And '$(Multithreaded)'=='true'" LocalName="$(BDS)\bin\cc32260mt.dll" Class="DependencyModule">
-                    <Platform Name="Win32">
-                        <Overwrite>true</Overwrite>
-                    </Platform>
-                </DeployFile>
-                <DeployFile Condition="'$(DynamicRTL)'=='true' And '$(Multithreaded)'!='true'" LocalName="$(BDS)\bin\cc32280.dll" Class="DependencyModule">
-                    <Platform Name="Win32">
-                        <Overwrite>true</Overwrite>
-                    </Platform>
-                </DeployFile>
-                <DeployFile Condition="'$(DynamicRTL)'=='true' And '$(Multithreaded)'=='true'" LocalName="$(BDS)\bin\cc32280mt.dll" Class="DependencyModule">
-                    <Platform Name="Win32">
-                        <Overwrite>true</Overwrite>
-                    </Platform>
-                </DeployFile>
-                <DeployFile Condition="'$(DynamicRTL)'=='true' And '$(Multithreaded)'!='true'" LocalName="$(BDS)\bin\cc32c240.dll" Class="DependencyModule">
-                    <Platform Name="Win32">
-                        <Overwrite>true</Overwrite>
-                    </Platform>
-                </DeployFile>
-                <DeployFile Condition="'$(DynamicRTL)'=='true' And '$(Multithreaded)'=='true'" LocalName="$(BDS)\bin\cc32c240mt.dll" Class="DependencyModule">
-                    <Platform Name="Win32">
-                        <Overwrite>true</Overwrite>
-                    </Platform>
-                </DeployFile>
-                <DeployFile Condition="'$(DynamicRTL)'=='true' And '$(Multithreaded)'!='true'" LocalName="$(BDS)\bin\cc32c260.dll" Class="DependencyModule">
-                    <Platform Name="Win32">
-                        <Overwrite>true</Overwrite>
-                    </Platform>
-                </DeployFile>
-                <DeployFile Condition="'$(DynamicRTL)'=='true' And '$(Multithreaded)'=='true'" LocalName="$(BDS)\bin\cc32c260mt.dll" Class="DependencyModule">
-                    <Platform Name="Win32">
-                        <Overwrite>true</Overwrite>
-                    </Platform>
-                </DeployFile>
-                <DeployFile Condition="'$(DynamicRTL)'=='true' And '$(Multithreaded)'!='true'" LocalName="$(BDS)\bin\cc32c280.dll" Class="DependencyModule">
-                    <Platform Name="Win32">
-                        <Overwrite>true</Overwrite>
-                    </Platform>
-                </DeployFile>
-                <DeployFile Condition="'$(DynamicRTL)'=='true' And '$(Multithreaded)'=='true'" LocalName="$(BDS)\bin\cc32c280mt.dll" Class="DependencyModule">
-                    <Platform Name="Win32">
-                        <Overwrite>true</Overwrite>
-                    </Platform>
-                </DeployFile>
-                <DeployFile Condition="'$(DynamicRTL)'=='true'" LocalName="$(BDS)\Redist\osx32\libcgcrtl.dylib" Class="DependencyModule">
-                    <Platform Name="OSX32">
-                        <Overwrite>true</Overwrite>
-                    </Platform>
-                </DeployFile>
-                <DeployFile Condition="'$(DynamicRTL)'=='true'" LocalName="$(BDS)\Redist\osx32\libcgstl.dylib" Class="DependencyModule">
-                    <Platform Name="OSX32">
-                        <Overwrite>true</Overwrite>
-                    </Platform>
-                </DeployFile>
-                <DeployFile Condition="'$(DynamicRTL)'=='true'" LocalName="$(BDS)\Redist\osx64\libcgcrtl.dylib" Class="DependencyModule">
-                    <Platform Name="OSX64">
-                        <Overwrite>true</Overwrite>
-                    </Platform>
-                </DeployFile>
-                <DeployFile Condition="'$(DynamicRTL)'=='true'" LocalName="$(BDS)\Redist\osx64\libcgstl.dylib" Class="DependencyModule">
-                    <Platform Name="OSX64">
+                        <RemoteName>ObjectMatsD.exe</RemoteName>
                         <Overwrite>true</Overwrite>
                         <Overwrite>true</Overwrite>
                     </Platform>
                     </Platform>
                 </DeployFile>
                 </DeployFile>
@@ -373,12 +164,6 @@
                         <Operation>64</Operation>
                         <Operation>64</Operation>
                     </Platform>
                     </Platform>
                 </DeployClass>
                 </DeployClass>
-                <DeployClass Name="AndroidClassesDexFile">
-                    <Platform Name="Android">
-                        <RemoteDir>classes</RemoteDir>
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
                 <DeployClass Name="AndroidFileProvider">
                 <DeployClass Name="AndroidFileProvider">
                     <Platform Name="Android">
                     <Platform Name="Android">
                         <RemoteDir>res\xml</RemoteDir>
                         <RemoteDir>res\xml</RemoteDir>
@@ -421,7 +206,6 @@
                         <Operation>1</Operation>
                         <Operation>1</Operation>
                     </Platform>
                     </Platform>
                 </DeployClass>
                 </DeployClass>
-                <DeployClass Name="AndroidLibnativeX86File"/>
                 <DeployClass Name="AndroidServiceOutput">
                 <DeployClass Name="AndroidServiceOutput">
                     <Platform Name="Android">
                     <Platform Name="Android">
                         <RemoteDir>library\lib\armeabi-v7a</RemoteDir>
                         <RemoteDir>library\lib\armeabi-v7a</RemoteDir>
@@ -804,138 +588,6 @@
                         <Operation>1</Operation>
                         <Operation>1</Operation>
                     </Platform>
                     </Platform>
                 </DeployClass>
                 </DeployClass>
-                <DeployClass Name="iPad_Launch1024">
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="iPad_Launch1024x768">
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="iPad_Launch1536">
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="iPad_Launch1536x2048">
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="iPad_Launch1668">
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="iPad_Launch1668x2388">
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="iPad_Launch2048">
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="iPad_Launch2048x1536">
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="iPad_Launch2048x2732">
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="iPad_Launch2224">
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="iPad_Launch2388x1668">
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="iPad_Launch2732x2048">
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
                 <DeployClass Name="iPad_Launch2x">
                 <DeployClass Name="iPad_Launch2x">
                     <Platform Name="iOSDevice64">
                     <Platform Name="iOSDevice64">
                         <RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
                         <RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
@@ -946,28 +598,6 @@
                         <Operation>1</Operation>
                         <Operation>1</Operation>
                     </Platform>
                     </Platform>
                 </DeployClass>
                 </DeployClass>
-                <DeployClass Name="iPad_Launch768">
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="iPad_Launch768x1024">
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
                 <DeployClass Name="iPad_LaunchDark2x">
                 <DeployClass Name="iPad_LaunchDark2x">
                     <Platform Name="iOSDevice64">
                     <Platform Name="iOSDevice64">
                         <RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
                         <RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
@@ -1028,105 +658,6 @@
                         <Operation>1</Operation>
                         <Operation>1</Operation>
                     </Platform>
                     </Platform>
                 </DeployClass>
                 </DeployClass>
-                <DeployClass Name="iPhone_Launch1125">
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="iPhone_Launch1136x640">
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="iPhone_Launch1242">
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="iPhone_Launch1242x2688">
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="iPhone_Launch1334">
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="iPhone_Launch1792">
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="iPhone_Launch2208">
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="iPhone_Launch2436">
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="iPhone_Launch2688x1242">
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
                 <DeployClass Name="iPhone_Launch2x">
                 <DeployClass Name="iPhone_Launch2x">
                     <Platform Name="iOSDevice64">
                     <Platform Name="iOSDevice64">
                         <RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
                         <RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
@@ -1137,17 +668,6 @@
                         <Operation>1</Operation>
                         <Operation>1</Operation>
                     </Platform>
                     </Platform>
                 </DeployClass>
                 </DeployClass>
-                <DeployClass Name="iPhone_Launch320">
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
                 <DeployClass Name="iPhone_Launch3x">
                 <DeployClass Name="iPhone_Launch3x">
                     <Platform Name="iOSDevice64">
                     <Platform Name="iOSDevice64">
                         <RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
                         <RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
@@ -1158,50 +678,6 @@
                         <Operation>1</Operation>
                         <Operation>1</Operation>
                     </Platform>
                     </Platform>
                 </DeployClass>
                 </DeployClass>
-                <DeployClass Name="iPhone_Launch640">
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="iPhone_Launch640x1136">
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="iPhone_Launch750">
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
-                <DeployClass Name="iPhone_Launch828">
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSSimulator">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
                 <DeployClass Name="iPhone_LaunchDark2x">
                 <DeployClass Name="iPhone_LaunchDark2x">
                     <Platform Name="iOSDevice64">
                     <Platform Name="iOSDevice64">
                         <RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
                         <RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
@@ -1300,14 +776,6 @@
                         <Operation>1</Operation>
                         <Operation>1</Operation>
                     </Platform>
                     </Platform>
                 </DeployClass>
                 </DeployClass>
-                <DeployClass Name="ProjectiOSDeviceResourceRules">
-                    <Platform Name="iOSDevice32">
-                        <Operation>1</Operation>
-                    </Platform>
-                    <Platform Name="iOSDevice64">
-                        <Operation>1</Operation>
-                    </Platform>
-                </DeployClass>
                 <DeployClass Name="ProjectiOSEntitlements">
                 <DeployClass Name="ProjectiOSEntitlements">
                     <Platform Name="iOSDevice32">
                     <Platform Name="iOSDevice32">
                         <RemoteDir>..\</RemoteDir>
                         <RemoteDir>..\</RemoteDir>
@@ -1453,7 +921,7 @@
                         <Operation>1</Operation>
                         <Operation>1</Operation>
                     </Platform>
                     </Platform>
                 </DeployClass>
                 </DeployClass>
-                <DeployClass Name="UWP_CppLogo150">
+                <DeployClass Name="UWP_DelphiLogo150">
                     <Platform Name="Win32">
                     <Platform Name="Win32">
                         <RemoteDir>Assets</RemoteDir>
                         <RemoteDir>Assets</RemoteDir>
                         <Operation>1</Operation>
                         <Operation>1</Operation>
@@ -1463,7 +931,7 @@
                         <Operation>1</Operation>
                         <Operation>1</Operation>
                     </Platform>
                     </Platform>
                 </DeployClass>
                 </DeployClass>
-                <DeployClass Name="UWP_CppLogo44">
+                <DeployClass Name="UWP_DelphiLogo44">
                     <Platform Name="Win32">
                     <Platform Name="Win32">
                         <RemoteDir>Assets</RemoteDir>
                         <RemoteDir>Assets</RemoteDir>
                         <Operation>1</Operation>
                         <Operation>1</Operation>
@@ -1492,7 +960,7 @@
         </BorlandProject>
         </BorlandProject>
         <ProjectFileVersion>12</ProjectFileVersion>
         <ProjectFileVersion>12</ProjectFileVersion>
     </ProjectExtensions>
     </ProjectExtensions>
-    <Import Project="$(BDS)\Bin\CodeGear.Cpp.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Cpp.Targets')"/>
+    <Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
     <Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
     <Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
     <Import Project="$(MSBuildProjectName).deployproj" Condition="Exists('$(MSBuildProjectName).deployproj')"/>
     <Import Project="$(MSBuildProjectName).deployproj" Condition="Exists('$(MSBuildProjectName).deployproj')"/>
 </Project>
 </Project>

+ 230 - 0
Examples/Demos/materials/objectmats/fObjectMatsD.dfm

@@ -0,0 +1,230 @@
+object FormMO: TFormMO
+  Left = 0
+  Top = 0
+  Caption = 'Object Materials'
+  ClientHeight = 614
+  ClientWidth = 906
+  Color = clBtnFace
+  Font.Charset = DEFAULT_CHARSET
+  Font.Color = clWindowText
+  Font.Height = -12
+  Font.Name = 'Segoe UI'
+  Font.Style = []
+  Position = poScreenCenter
+  OnCreate = FormCreate
+  TextHeight = 15
+  object GLSceneViewer1: TGLSceneViewer
+    Left = 0
+    Top = 0
+    Width = 724
+    Height = 614
+    Camera = GLCamera1
+    Buffer.BackgroundColor = clTeal
+    FieldOfView = 154.310821533203100000
+    PenAsTouch = False
+    Align = alClient
+    TabOrder = 0
+    ExplicitWidth = 577
+  end
+  object Panel1: TPanel
+    Left = 724
+    Top = 0
+    Width = 182
+    Height = 614
+    Align = alRight
+    TabOrder = 1
+    ExplicitLeft = 730
+    ExplicitTop = -8
+    object RadioGroup1: TRadioGroup
+      Left = 24
+      Top = 120
+      Width = 145
+      Height = 121
+      ItemIndex = 0
+      Items.Strings = (
+        'GLCube'
+        'GLHexahedra'
+        'GLPlanes'
+        'DirectOpenGLCube')
+      TabOrder = 0
+      OnClick = RadioGroup1Click
+    end
+    object chbRotate: TCheckBox
+      Left = 32
+      Top = 111
+      Width = 97
+      Height = 17
+      Caption = 'Rotate'
+      TabOrder = 1
+    end
+  end
+  object GLScene1: TGLScene
+    Left = 174
+    Top = 95
+    object GLCamera1: TGLCamera
+      DepthOfView = 10000000000.000000000000000000
+      FocalLength = 70.000000000000000000
+      TargetObject = dcCubes
+      Position.Coordinates = {0000404000004040000040400000803F}
+      object GLLightSource1: TGLLightSource
+        ConstAttenuation = 1.000000000000000000
+        SpotCutOff = 180.000000000000000000
+      end
+    end
+    object GLDummyCube1: TGLDummyCube
+      CubeSize = 1.000000000000000000
+      object GLPolygon1: TGLPolygon
+        Nodes = <>
+      end
+      object GLActor1: TGLActor
+        Interval = 100
+      end
+    end
+    object dcCubes: TGLDummyCube
+      CubeSize = 1.000000000000000000
+      object GLCube1: TGLCube
+        Material.MaterialLibrary = GLMatLibCube
+        Material.LibMaterialName = 'mtRed'
+      end
+      object GLHexahedron1: TGLHexahedron
+        Material.MaterialLibrary = GLMatLibCube
+        Material.LibMaterialName = 'mtOrange'
+        Position.Coordinates = {0000000000000040000000000000803F}
+        Scale.Coordinates = {0000003F0000003F0000003F00000000}
+      end
+      object dcPlaneCube: TGLDummyCube
+        Position.Coordinates = {00000000000000C0000000000000803F}
+        OnProgress = dcPlaneCubeProgress
+        CubeSize = 1.000000000000000000
+        object GLPlaneFront: TGLPlane
+          Material.MaterialLibrary = GLMatLibCube
+          Material.LibMaterialName = 'mtRed'
+          Position.Coordinates = {00000000000000000000003F0000803F}
+          Height = 1.000000000000000000
+          Width = 1.000000000000000000
+        end
+        object GLPlaneBack: TGLPlane
+          Material.MaterialLibrary = GLMatLibCube
+          Material.LibMaterialName = 'mtGreen'
+          Direction.Coordinates = {0000000000000000000080BF00000000}
+          Position.Coordinates = {0000000000000000000000BF0000803F}
+          Height = 1.000000000000000000
+          Width = 1.000000000000000000
+        end
+        object GLPlaneBottom: TGLPlane
+          Material.MaterialLibrary = GLMatLibCube
+          Material.LibMaterialName = 'mtBlue'
+          Direction.Coordinates = {00000000000080BF0000000000000000}
+          Position.Coordinates = {00000000000000BF000000000000803F}
+          Up.Coordinates = {00000000000000000000803F00000000}
+          Height = 1.000000000000000000
+          Width = 1.000000000000000000
+        end
+        object GLPlaneTop: TGLPlane
+          Material.MaterialLibrary = GLMatLibCube
+          Material.LibMaterialName = 'mtYellow'
+          Direction.Coordinates = {000000000000803F0000000000000000}
+          Position.Coordinates = {000000000000003F000000000000803F}
+          Up.Coordinates = {0000000000000000000080BF00000000}
+          Height = 1.000000000000000000
+          Width = 1.000000000000000000
+        end
+        object GLPlaneRight: TGLPlane
+          Material.MaterialLibrary = GLMatLibCube
+          Material.LibMaterialName = 'mtOrange'
+          Direction.Coordinates = {0000803F000000000000000000000000}
+          Position.Coordinates = {0000003F00000000000000000000803F}
+          Height = 1.000000000000000000
+          Width = 1.000000000000000000
+        end
+        object GLPlaneLeft: TGLPlane
+          Material.MaterialLibrary = GLMatLibCube
+          Material.LibMaterialName = 'mtViolet'
+          Direction.Coordinates = {000080BF000000000000000000000000}
+          Position.Coordinates = {000000BF00000000000000000000803F}
+          Height = 1.000000000000000000
+          Width = 1.000000000000000000
+        end
+      end
+    end
+    object dcSpheres: TGLDummyCube
+      Position.Coordinates = {0000000000000000000000400000803F}
+      CubeSize = 1.000000000000000000
+      object Sphere1: TGLSphere
+        Radius = 0.500000000000000000
+      end
+      object ffSphere: TGLFreeForm
+        Position.Coordinates = {000000000000C03F000000000000803F}
+      end
+      object GLMesh1: TGLMesh
+        Material.MaterialLibrary = GLMatLibCube
+        Material.LibMaterialName = 'mtRed'
+        Position.Coordinates = {0000000000000040000000000000803F}
+        Scale.Coordinates = {0000003F0000003F0000003F00000000}
+        Visible = False
+        Mode = mmTriangleStrip
+      end
+    end
+  end
+  object GLCadencer1: TGLCadencer
+    Scene = GLScene1
+    OnProgress = GLCadencer1Progress
+    Left = 564
+    Top = 28
+  end
+  object GLMatLibCube: TGLMaterialLibrary
+    Materials = <
+      item
+        Name = 'mtRed'
+        Tag = 0
+        Material.FrontProperties.Diffuse.Color = {0000803F00000000000000000000803F}
+      end
+      item
+        Name = 'mtGreen'
+        Tag = 0
+        Material.FrontProperties.Diffuse.Color = {000000000000003F000000000000803F}
+      end
+      item
+        Name = 'mtBlue'
+        Tag = 0
+        Material.FrontProperties.Diffuse.Color = {00000000000000000000803F0000803F}
+      end
+      item
+        Name = 'mtYellow'
+        Tag = 0
+        Material.FrontProperties.Diffuse.Color = {9A99193FCDCC4C3FACC8483E0000803F}
+      end
+      item
+        Name = 'mtOrange'
+        Tag = 0
+        Material.FrontProperties.Diffuse.Color = {0000803F0000003F000000000000803F}
+      end
+      item
+        Name = 'mtViolet'
+        Tag = 0
+        Material.FrontProperties.Diffuse.Color = {A19E9E3ECFBC3C3EA19E9E3E0000803F}
+      end>
+    Left = 210
+    Top = 208
+  end
+  object GLSimpleNavigation1: TGLSimpleNavigation
+    Form = Owner
+    GLSceneViewer = GLSceneViewer1
+    FormCaption = 'Object Materials - %FPS'
+    KeyCombinations = <
+      item
+        ShiftState = [ssLeft, ssRight]
+        Action = snaZoom
+      end
+      item
+        ShiftState = [ssLeft]
+        Action = snaMoveAroundTarget
+      end
+      item
+        ShiftState = [ssRight]
+        Action = snaMoveAroundTarget
+      end>
+    Left = 104
+    Top = 384
+  end
+end

+ 114 - 0
Examples/Demos/materials/objectmats/fObjectMatsD.pas

@@ -0,0 +1,114 @@
+unit fObjectMatsD;
+
+interface
+
+uses
+  Winapi.Windows,
+  Winapi.Messages,
+  System.SysUtils,
+  System.Variants,
+  System.Classes,
+  Vcl.Graphics,
+  Vcl.Controls,
+  Vcl.Forms,
+  Vcl.Dialogs,
+  GLS.Scene,
+  GLS.VectorFileObjects,
+  GLS.Objects,
+  GLS.Coordinates,
+  GLS.SceneViewer,
+  GLS.BaseClasses,
+  GLS.Material,
+  GLS.Cadencer,
+  GLS.GeomObjects,
+  Vcl.StdCtrls,
+  Vcl.ExtCtrls,
+  GLS.SimpleNavigation,
+  GLS.Utils, GLS.Mesh;
+
+type
+  TFormMO = class(TForm)
+    GLScene1: TGLScene;
+    GLSceneViewer1: TGLSceneViewer;
+    GLCamera1: TGLCamera;
+    GLLightSource1: TGLLightSource;
+    GLDummyCube1: TGLDummyCube;
+    GLActor1: TGLActor;
+    GLCadencer1: TGLCadencer;
+    GLMatLibCube: TGLMaterialLibrary;
+    GLPolygon1: TGLPolygon;
+    dcCubes: TGLDummyCube;
+    GLCube1: TGLCube;
+    GLHexahedron1: TGLHexahedron;
+    Panel1: TPanel;
+    RadioGroup1: TRadioGroup;
+    GLSimpleNavigation1: TGLSimpleNavigation;
+    Sphere1: TGLSphere;
+    dcSpheres: TGLDummyCube;
+    ffSphere: TGLFreeForm;
+    dcPlaneCube: TGLDummyCube;
+    GLPlaneFront: TGLPlane;
+    GLPlaneBack: TGLPlane;
+    GLPlaneBottom: TGLPlane;
+    GLPlaneTop: TGLPlane;
+    GLPlaneRight: TGLPlane;
+    GLPlaneLeft: TGLPlane;
+    GLMesh1: TGLMesh;
+    chbRotate: TCheckBox;
+    procedure FormCreate(Sender: TObject);
+    procedure RadioGroup1Click(Sender: TObject);
+    procedure dcPlaneCubeProgress(Sender: TObject; const DeltaTime, NewTime: Double);
+    procedure GLCadencer1Progress(Sender: TObject; const DeltaTime, NewTime: Double);
+  private
+
+  public
+    Path: TFileName;
+  end;
+
+var
+  FormMO: TFormMO;
+
+implementation
+
+{$R *.dfm}
+
+procedure TFormMO.FormCreate(Sender: TObject);
+begin
+  Path := GetCurrentAssetPath();
+  SetCurrentDir(Path + '\map');
+  Sphere1.Material.Texture.Disabled := False;
+  Sphere1.Material.Texture.Image.LoadFromFile('earth.jpg');
+end;
+
+procedure TFormMO.GLCadencer1Progress(Sender: TObject; const DeltaTime, NewTime: Double);
+begin
+  GLSceneViewer1.Invalidate;
+  if chbRotate.Checked then
+  begin
+    GLHexahedron1.Turn(-0.1);
+    GLCube1.Turn(0.1);
+    dcPlaneCube.Turnangle := 90 * newTime;
+    dcPlaneCube.PitchAngle := 90 * newTime;
+    dcPlaneCube.RollAngle := -90 * newTime;
+    Sphere1.Turnangle := 90 * newTime;
+  end;
+end;
+
+procedure TFormMO.dcPlaneCubeProgress(Sender: TObject; const DeltaTime, NewTime: Double);
+begin
+ // more movement
+ // dcPlaneCube.MoveObjectAround(GLCamera1.TargetObject, sin(NewTime) * DeltaTime * 10, DeltaTime * 20);
+end;
+
+
+procedure TFormMO.RadioGroup1Click(Sender: TObject);
+begin
+ case RadioGroup1.ItemIndex of
+   0: ;
+   1:;
+   2:;
+   3:;
+ end;
+end;
+
+end.

+ 0 - 44
Examples/Demos/rendering/bunnybump/BunnyBumpD.dpr

@@ -1,44 +0,0 @@
-{: Using the GLBumpShader for object space bump mapping.
-
-   The bump shader runs an ambient light pass and a pass for
-   each light shining in the scene. There are currently 2
-   bump methods: a dot3 texture combiner and a basic ARB
-   fragment program.
-
-   The dot3 texture combiner only supports diffuse lighting
-   but is fast and works on lower end graphics adapters.
-
-   The basic ARBFP method supports diffuse and specular
-   lighting
-
-   Both methods pick up the light and material options
-   through the OpenGL state.
-
-   The normal map is expected as the primary texture.
-
-   Diffuse textures are supported through the secondary
-   texture and can be enabled using the boDiffuseTexture2
-   bump option.
-
-   Specular textures are supported through the tertiary
-   texture and can be enabled using the boSpecularTexture3
-   bump option and setting the SpecularMode to smBlinn or
-   smPhong (smOff will disable specular in the shader).
-
-   With the boLightAttenutation flag set the shader will
-   use the OpenGL light attenuation coefficients when
-   calculating light intensity.
-}
-program BunnyBumpD;
-
-uses
-  Forms,
-  fBunnyBumpD in 'fBunnyBumpD.pas' {Form1};
-
-{$R *.res}
-
-begin
-  Application.Initialize;
-  Application.CreateForm(TForm1, Form1);
-  Application.Run;
-end.

+ 0 - 144
Examples/Demos/rendering/bunnybump/BunnyBumpD.dproj

@@ -1,144 +0,0 @@
-<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-    <PropertyGroup>
-        <ProjectGuid>{B80A67D8-511B-4309-81A9-56ABA17E29BD}</ProjectGuid>
-        <MainSource>BunnyBumpD.dpr</MainSource>
-        <Base>True</Base>
-        <Config Condition="'$(Config)'==''">Debug</Config>
-        <TargetedPlatforms>1</TargetedPlatforms>
-        <AppType>Application</AppType>
-        <FrameworkType>VCL</FrameworkType>
-        <ProjectVersion>19.4</ProjectVersion>
-        <Platform Condition="'$(Platform)'==''">Win32</Platform>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
-        <Base>true</Base>
-    </PropertyGroup>
-    <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
-        <Base_Win32>true</Base_Win32>
-        <CfgParent>Base</CfgParent>
-        <Base>true</Base>
-    </PropertyGroup>
-    <PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
-        <Base_Win64>true</Base_Win64>
-        <CfgParent>Base</CfgParent>
-        <Base>true</Base>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
-        <Cfg_1>true</Cfg_1>
-        <CfgParent>Base</CfgParent>
-        <Base>true</Base>
-    </PropertyGroup>
-    <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
-        <Cfg_1_Win32>true</Cfg_1_Win32>
-        <CfgParent>Cfg_1</CfgParent>
-        <Cfg_1>true</Cfg_1>
-        <Base>true</Base>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
-        <Cfg_2>true</Cfg_2>
-        <CfgParent>Base</CfgParent>
-        <Base>true</Base>
-    </PropertyGroup>
-    <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win32)'!=''">
-        <Cfg_2_Win32>true</Cfg_2_Win32>
-        <CfgParent>Cfg_2</CfgParent>
-        <Cfg_2>true</Cfg_2>
-        <Base>true</Base>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Base)'!=''">
-        <DCC_E>false</DCC_E>
-        <DCC_F>false</DCC_F>
-        <DCC_K>false</DCC_K>
-        <DCC_N>false</DCC_N>
-        <DCC_S>false</DCC_S>
-        <DCC_ImageBase>00400000</DCC_ImageBase>
-        <SanitizedProjectName>BunnyBumpD</SanitizedProjectName>
-        <DCC_Namespace>Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
-        <VerInfo_Locale>1049</VerInfo_Locale>
-        <VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;CFBundleName=</VerInfo_Keys>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Base_Win32)'!=''">
-        <DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
-        <BT_BuildType>Debug</BT_BuildType>
-        <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
-        <VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName)</VerInfo_Keys>
-        <VerInfo_Locale>1033</VerInfo_Locale>
-        <Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
-        <AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
-        <UWP_DelphiLogo44>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png</UWP_DelphiLogo44>
-        <UWP_DelphiLogo150>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png</UWP_DelphiLogo150>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Base_Win64)'!=''">
-        <UWP_DelphiLogo44>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png</UWP_DelphiLogo44>
-        <UWP_DelphiLogo150>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png</UWP_DelphiLogo150>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Cfg_1)'!=''">
-        <DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
-        <DCC_DebugInformation>0</DCC_DebugInformation>
-        <DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
-        <DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
-        <AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
-        <AppDPIAwarenessMode>PerMonitorV2</AppDPIAwarenessMode>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Cfg_2)'!=''">
-        <DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
-        <DCC_Optimize>false</DCC_Optimize>
-        <DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
-        <DCC_RangeChecking>true</DCC_RangeChecking>
-        <DCC_IntegerOverflowCheck>true</DCC_IntegerOverflowCheck>
-    </PropertyGroup>
-    <PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
-        <AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
-        <AppDPIAwarenessMode>PerMonitorV2</AppDPIAwarenessMode>
-        <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
-        <VerInfo_Locale>1033</VerInfo_Locale>
-        <VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName)</VerInfo_Keys>
-        <Icon_MainIcon>$(BDS)\bin\delphi_PROJECTICON.ico</Icon_MainIcon>
-    </PropertyGroup>
-    <ItemGroup>
-        <DelphiCompile Include="$(MainSource)">
-            <MainSource>MainSource</MainSource>
-        </DelphiCompile>
-        <DCCReference Include="fBunnyBumpD.pas">
-            <Form>Form1</Form>
-        </DCCReference>
-        <BuildConfiguration Include="Base">
-            <Key>Base</Key>
-        </BuildConfiguration>
-        <BuildConfiguration Include="Release">
-            <Key>Cfg_1</Key>
-            <CfgParent>Base</CfgParent>
-        </BuildConfiguration>
-        <BuildConfiguration Include="Debug">
-            <Key>Cfg_2</Key>
-            <CfgParent>Base</CfgParent>
-        </BuildConfiguration>
-    </ItemGroup>
-    <ProjectExtensions>
-        <Borland.Personality>Delphi.Personality.12</Borland.Personality>
-        <Borland.ProjectType/>
-        <BorlandProject>
-            <Delphi.Personality>
-                <Source>
-                    <Source Name="MainSource">BunnyBumpD.dpr</Source>
-                </Source>
-                <Excluded_Packages>
-                    <Excluded_Packages Name="C:\Users\Public\Documents\Embarcadero\Studio\22.0\Bpl\GLScene_SDL_DT.bpl">File C:\Users\Public\Documents\Embarcadero\Studio\22.0\Bpl\GLScene_SDL_DT.bpl not found</Excluded_Packages>
-                    <Excluded_Packages Name="$(BDSBIN)\bcboffice2k280.bpl">Embarcadero C++Builder Office 2000 Servers Package</Excluded_Packages>
-                    <Excluded_Packages Name="$(BDSBIN)\bcbofficexp280.bpl">Embarcadero C++Builder Office XP Servers Package</Excluded_Packages>
-                    <Excluded_Packages Name="$(BDSBIN)\dcloffice2k280.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
-                    <Excluded_Packages Name="$(BDSBIN)\dclofficexp280.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
-                </Excluded_Packages>
-            </Delphi.Personality>
-            <Platforms>
-                <Platform value="Win32">True</Platform>
-                <Platform value="Win64">False</Platform>
-            </Platforms>
-        </BorlandProject>
-        <ProjectFileVersion>12</ProjectFileVersion>
-    </ProjectExtensions>
-    <Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
-    <Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
-</Project>

+ 0 - 35
Examples/Demos/rendering/bunnybump/BunnybumpC.cpp

@@ -1,35 +0,0 @@
-//---------------------------------------------------------------------------
-
-#include <vcl.h>
-#pragma hdrstop
-#include <tchar.h>
-//---------------------------------------------------------------------------
-USEFORM("fBunnyBumpC.cpp", Form1);
-//---------------------------------------------------------------------------
-int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int)
-{
-	try
-	{
-		Application->Initialize();
-		Application->MainFormOnTaskBar = true;
-		Application->CreateForm(__classid(TForm1), &Form1);
-		Application->Run();
-	}
-	catch (Exception &exception)
-	{
-		Application->ShowException(&exception);
-	}
-	catch (...)
-	{
-		try
-		{
-			throw Exception("");
-		}
-		catch (Exception &exception)
-		{
-			Application->ShowException(&exception);
-		}
-	}
-	return 0;
-}
-//---------------------------------------------------------------------------

+ 0 - 225
Examples/Demos/rendering/bunnybump/fBunnyBumpC.cpp

@@ -1,225 +0,0 @@
-//---------------------------------------------------------------------------
-
-#include <vcl.h>
-#pragma hdrstop
-
-#include "fBunnyBumpC.h"
-//---------------------------------------------------------------------------
-#pragma package(smart_init)
-#pragma link "GLS.AsyncTimer"
-#pragma link "GLS.BaseClasses"
-#pragma link "GLSL.BumpShaders"
-#pragma link "GLS.Cadencer"
-#pragma link "GLS.Coordinates"
-
-#pragma link "GLS.Material"
-#pragma link "GLS.Objects"
-#pragma link "GLS.Scene"
-#pragma link "GLS.VectorFileObjects"
-#pragma link "GLS.SceneViewer"
-#pragma link "GLS.FileOBJ"
-
-#pragma resource "*.dfm"
-TForm1 *Form1;
-//---------------------------------------------------------------------------
-__fastcall TForm1::TForm1(TComponent* Owner)
-	: TForm(Owner)
-{
-}
-//---------------------------------------------------------------------------
-void __fastcall TForm1::FormCreate(TObject *Sender)
-{
-  TFileName Path = GetCurrentAssetPath();
-  // Load the bunny mesh and scale for viewing
-  Bunny->LoadFromFile("Models\\bunny.obj");
-  Bunny->Scale->Scale((float)(2/Bunny->BoundingSphereRadius()));
-  Bunny->PitchAngle = 90;
-  Bunny->RollAngle = 90;
-
-  // Load the normal map
-  GLMaterialLibrary1->Materials->Items[0]->Material->Texture->Image->LoadFromFile("bunnynormals.jpg");
-
-  // Link the lights to their toggles
-  CheckBox1->Tag = Integer(WhiteLight);
-  CheckBox2->Tag = Integer(RedLight);
-  CheckBox3->Tag = Integer(BlueLight);
-  Shape1->Tag = Integer(WhiteLight);
-  Shape2->Tag = Integer(RedLight);
-  Shape3->Tag = Integer(BlueLight);
-
-  ComboBox1->ItemIndex = 0;
-  ComboBox1Change(NULL);
-  StartHeight = Height;
-  CheckBox3Click(this);
-
-}
-//---------------------------------------------------------------------------
-void __fastcall TForm1::GLCadencer1Progress(TObject *Sender, const double deltaTime,
-		  const double newTime)
-{
-  // Orbit the camera
-  if ((dx != 0) || (dy != 0))
-  {
-	Camera->MoveAroundTarget(dy, dx);
-	dx = 0;
-	dy = 0;
-  }
-
-  // Rotate the light sources
-  if (cbSpin->Checked)
-	DCLights->Turn(deltaTime*20);
-
-  GLSceneViewer1->Invalidate();
-
-}
-//---------------------------------------------------------------------------
-void __fastcall TForm1::CheckBox1Click(TObject *Sender)
-{
-  WhiteLight->Shining = CheckBox1->Checked;
-  CheckBox1->Tag = CheckBox1->Checked;
-}
-
-//---------------------------------------------------------------------------
-void __fastcall TForm1::CheckBox2Click(TObject *Sender)
-{
-  RedLight->Shining = CheckBox2->Checked;
-  CheckBox2->Tag = CheckBox2->Checked;
-}
-
-//---------------------------------------------------------------------------
-
-void __fastcall TForm1::CheckBox3Click(TObject *Sender)
-{
-  BlueLight->Shining = CheckBox3->Checked;
-  CheckBox3->Tag = CheckBox3->Checked;
-}
-
-//---------------------------------------------------------------------------
-void __fastcall TForm1::Shape1MouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift,
-		  int X, int Y)
-{
-  // WhiteLight Color Dialog
-  ColorDialog1->Color = Shape1->Brush->Color;
-  if (ColorDialog1->Execute())
-  {
-	Shape1->Brush->Color = ColorDialog1->Color;
-	WhiteLight->Diffuse->AsWinColor = ColorDialog1->Color;
-  }
-}
-//---------------------------------------------------------------------------
-
-void __fastcall TForm1::Shape2MouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift,
-		  int X, int Y)
-{
-  // RedLight Color Dialog
-  ColorDialog1->Color = Shape2->Brush->Color;
-  if (ColorDialog1->Execute())
-  {
-	Shape2->Brush->Color = ColorDialog1->Color;
-	RedLight->Diffuse->AsWinColor = ColorDialog1->Color;
- }
-}
-
-//---------------------------------------------------------------------------
-void __fastcall TForm1::Shape3MouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift,
-		  int X, int Y)
-{
-  // BlueLight Color Dialog
-  ColorDialog1->Color = Shape3->Brush->Color;
-  if (ColorDialog1->Execute())
-  {
-	Shape3->Brush->Color = ColorDialog1->Color;
-	BlueLight->Diffuse->AsWinColor = ColorDialog1->Color;
-   }
-}
-
-//---------------------------------------------------------------------------
-void __fastcall TForm1::ComboBox1Change(TObject *Sender)
-{
-  if (ComboBox1->Text == "Per-Vertex")
-	Bunny->Material->LibMaterialName = " ";
-  else
-  if (ComboBox1->Text == "Dot3 Texture Combiner")
-  {
-	Bunny->Material->LibMaterialName = "Bump";
-	GLBumpShader1->BumpMethod = bmDot3TexCombiner;
-  }
-  else
-  if (ComboBox1->Text == "Basic Fragment Program")
-  {
-	Bunny->Material->LibMaterialName = "Bump";
-	GLBumpShader1->BumpMethod = bmBasicARBFP;
-  }
-}
-//---------------------------------------------------------------------------
-
-void __fastcall TForm1::GLSceneViewer1MouseDown(TObject *Sender, TMouseButton Button,
-		  TShiftState Shift, int X, int Y)
-{
-  mx = X;
-  my = Y;
-  dx = 0;
-  dy = 0;
-}
-//---------------------------------------------------------------------------
-
-void __fastcall TForm1::GLSceneViewer1MouseMove(TObject *Sender, TShiftState Shift,
-          int X, int Y)
-{
-  if (Shift.Contains(ssLeft))
-  {
-	dx += (mx-X);
-	dy += (my-Y);
-  }
-  else
-  {
-	dx = 0;
-	dy = 0;
-  }
-  mx = X;
-  my = Y;
-}
-//---------------------------------------------------------------------------
-
-void __fastcall TForm1::AsyncTimer1Timer(TObject *Sender)
-{
-  LabelFPS->Caption  = GLSceneViewer1->FramesPerSecondText();
-  GLSceneViewer1->ResetPerformanceMonitor();
-}
-//---------------------------------------------------------------------------
-
-void __fastcall TForm1::FormResize(TObject *Sender)
-{
-  Camera->SceneScale = (float)Height/StartHeight;
-}
-//---------------------------------------------------------------------------
-
-void __fastcall TForm1::GLSceneViewer1BeforeRender(TObject *Sender)
-{
-  if (IsInitialized)
-	exit;
-
-  if  (GL_ARB_multitexture && GL_ARB_vertex_program && GL_ARB_texture_env_dot3)
-	ComboBox1->Items->Add("Dot3 Texture Combiner");
-  if  (GL_ARB_multitexture && GL_ARB_vertex_program && GL_ARB_fragment_program)
-  {
-	ComboBox1->Items->Add("Basic Fragment Program");
-	if (GLSceneViewer1->Buffer->LimitOf[limNbTextureUnits] < 3)
-	  GLBumpShader1->SpecularMode = smOff;
-  }
-  IsInitialized = true;
-}
-//---------------------------------------------------------------------------
-
-void __fastcall TForm1::ComboBox2Change(TObject *Sender)
-{
- switch (ComboBox2->ItemIndex)
- {
-  case 0 : GLBumpShader1->SpecularMode = smOff; break;
-  case 1 : GLBumpShader1->SpecularMode = smBlinn; break;
-  case 2 : GLBumpShader1->SpecularMode = smPhong; break;
- default: ;
- }
-}
-//---------------------------------------------------------------------------
-

+ 0 - 300
Examples/Demos/rendering/bunnybump/fBunnyBumpC.dfm

@@ -1,300 +0,0 @@
-object Form1: TForm1
-  Left = 0
-  Top = 0
-  Caption = 'Bunny Bump Shader'
-  ClientHeight = 678
-  ClientWidth = 826
-  Color = clBtnFace
-  Font.Charset = DEFAULT_CHARSET
-  Font.Color = clWindowText
-  Font.Height = -14
-  Font.Name = 'Tahoma'
-  Font.Style = []
-  OnCreate = FormCreate
-  OnResize = FormResize
-  PixelsPerInch = 120
-  TextHeight = 17
-  object GLSceneViewer1: TGLSceneViewer
-    Left = 0
-    Top = 71
-    Width = 826
-    Height = 607
-    Margins.Left = 4
-    Margins.Top = 4
-    Margins.Right = 4
-    Margins.Bottom = 4
-    Camera = Camera
-    BeforeRender = GLSceneViewer1BeforeRender
-    Buffer.BackgroundColor = clBackground
-    FieldOfView = 161.289718627929700000
-    PenAsTouch = False
-    Align = alClient
-    OnMouseDown = GLSceneViewer1MouseDown
-    OnMouseMove = GLSceneViewer1MouseMove
-    TabOrder = 0
-  end
-  object Panel1: TPanel
-    Left = 0
-    Top = 0
-    Width = 826
-    Height = 71
-    Margins.Left = 4
-    Margins.Top = 4
-    Margins.Right = 4
-    Margins.Bottom = 4
-    Align = alTop
-    TabOrder = 1
-    object Label1: TLabel
-      Left = 10
-      Top = 10
-      Width = 88
-      Height = 17
-      Margins.Left = 4
-      Margins.Top = 4
-      Margins.Right = 4
-      Margins.Bottom = 4
-      Caption = 'Shade Method'
-    end
-    object Label2: TLabel
-      Left = 440
-      Top = 5
-      Width = 89
-      Height = 17
-      Margins.Left = 4
-      Margins.Top = 4
-      Margins.Right = 4
-      Margins.Bottom = 4
-      Caption = 'Specular Mode'
-    end
-    object LabelFPS: TLabel
-      Left = 640
-      Top = 34
-      Width = 23
-      Height = 17
-      Margins.Left = 4
-      Margins.Top = 4
-      Margins.Right = 4
-      Margins.Bottom = 4
-      Caption = 'FPS'
-    end
-    object ComboBox1: TComboBox
-      Left = 10
-      Top = 30
-      Width = 181
-      Height = 25
-      Margins.Left = 4
-      Margins.Top = 4
-      Margins.Right = 4
-      Margins.Bottom = 4
-      Style = csDropDownList
-      ItemIndex = 0
-      TabOrder = 0
-      Text = 'Per-Vertex'
-      OnChange = ComboBox1Change
-      Items.Strings = (
-        'Per-Vertex')
-    end
-    object GroupBox1: TGroupBox
-      Left = 200
-      Top = 10
-      Width = 211
-      Height = 51
-      Margins.Left = 4
-      Margins.Top = 4
-      Margins.Right = 4
-      Margins.Bottom = 4
-      Caption = 'Lights'
-      TabOrder = 1
-      object Shape1: TShape
-        Left = 40
-        Top = 20
-        Width = 21
-        Height = 21
-        Margins.Left = 4
-        Margins.Top = 4
-        Margins.Right = 4
-        Margins.Bottom = 4
-        OnMouseDown = Shape1MouseDown
-      end
-      object Shape2: TShape
-        Left = 110
-        Top = 20
-        Width = 21
-        Height = 21
-        Margins.Left = 4
-        Margins.Top = 4
-        Margins.Right = 4
-        Margins.Bottom = 4
-        Brush.Color = clRed
-        OnMouseDown = Shape2MouseDown
-      end
-      object Shape3: TShape
-        Left = 180
-        Top = 20
-        Width = 21
-        Height = 21
-        Margins.Left = 4
-        Margins.Top = 4
-        Margins.Right = 4
-        Margins.Bottom = 4
-        Brush.Color = clBlue
-        OnMouseDown = Shape3MouseDown
-      end
-      object CheckBox1: TCheckBox
-        Left = 10
-        Top = 20
-        Width = 21
-        Height = 21
-        Margins.Left = 4
-        Margins.Top = 4
-        Margins.Right = 4
-        Margins.Bottom = 4
-        Checked = True
-        State = cbChecked
-        TabOrder = 0
-        OnClick = CheckBox1Click
-      end
-      object CheckBox2: TCheckBox
-        Left = 80
-        Top = 20
-        Width = 21
-        Height = 21
-        Margins.Left = 4
-        Margins.Top = 4
-        Margins.Right = 4
-        Margins.Bottom = 4
-        TabOrder = 1
-        OnClick = CheckBox2Click
-      end
-      object CheckBox3: TCheckBox
-        Left = 150
-        Top = 20
-        Width = 21
-        Height = 21
-        Margins.Left = 4
-        Margins.Top = 4
-        Margins.Right = 4
-        Margins.Bottom = 4
-        TabOrder = 2
-        OnClick = CheckBox3Click
-      end
-    end
-    object cbSpin: TCheckBox
-      Left = 546
-      Top = 31
-      Width = 61
-      Height = 21
-      Margins.Left = 4
-      Margins.Top = 4
-      Margins.Right = 4
-      Margins.Bottom = 4
-      Caption = 'Spin'
-      Checked = True
-      State = cbChecked
-      TabOrder = 2
-    end
-    object ComboBox2: TComboBox
-      Left = 439
-      Top = 26
-      Width = 91
-      Height = 25
-      Margins.Left = 4
-      Margins.Top = 4
-      Margins.Right = 4
-      Margins.Bottom = 4
-      Style = csDropDownList
-      ItemIndex = 0
-      TabOrder = 3
-      Text = 'smOff'
-      OnChange = ComboBox2Change
-      Items.Strings = (
-        'smOff'
-        'smBlinn'
-        'smPhong')
-    end
-  end
-  object GLScene1: TGLScene
-    Left = 40
-    Top = 72
-    object DCLights: TGLDummyCube
-      CubeSize = 1.000000000000000000
-      object WhiteLight: TGLLightSource
-        ConstAttenuation = 1.000000000000000000
-        Position.Coordinates = {0000404000000040000000000000803F}
-        LightStyle = lsOmni
-        Specular.Color = {0000803F0000803F0000803F0000803F}
-        SpotCutOff = 180.000000000000000000
-      end
-      object RedLight: TGLLightSource
-        ConstAttenuation = 1.000000000000000000
-        Diffuse.Color = {0000803F00000000000000000000803F}
-        Position.Coordinates = {0000C0BF00000040666626C00000803F}
-        LightStyle = lsOmni
-        Shining = False
-        Specular.Color = {0000803F0000003F0000003F0000803F}
-        SpotCutOff = 180.000000000000000000
-      end
-      object BlueLight: TGLLightSource
-        ConstAttenuation = 1.000000000000000000
-        Diffuse.Color = {00000000000000000000803F0000803F}
-        Position.Coordinates = {0000C0BF00000040666626400000803F}
-        LightStyle = lsOmni
-        Shining = False
-        Specular.Color = {0000003F0000003F0000803F0000803F}
-        SpotCutOff = 180.000000000000000000
-      end
-    end
-    object Bunny: TGLFreeForm
-      Material.FrontProperties.Shininess = 64
-      Material.FrontProperties.Specular.Color = {CDCC4C3ECDCC4C3ECDCC4C3E0000803F}
-      Material.MaterialLibrary = GLMaterialLibrary1
-      AutoCentering = [macCenterX, macCenterY, macCenterZ]
-    end
-    object Camera: TGLCamera
-      DepthOfView = 100.000000000000000000
-      FocalLength = 50.000000000000000000
-      TargetObject = Bunny
-      Position.Coordinates = {000080400000803F000000000000803F}
-    end
-  end
-  object GLCadencer1: TGLCadencer
-    Scene = GLScene1
-    OnProgress = GLCadencer1Progress
-    Left = 40
-    Top = 136
-  end
-  object GLMaterialLibrary1: TGLMaterialLibrary
-    Materials = <
-      item
-        Name = 'Bump'
-        Tag = 0
-        Material.FrontProperties.Shininess = 64
-        Material.FrontProperties.Specular.Color = {CDCC4C3ECDCC4C3ECDCC4C3E0000803F}
-        Material.Texture.Disabled = False
-        Shader = GLBumpShader1
-      end>
-    Left = 136
-    Top = 72
-  end
-  object GLBumpShader1: TGLBumpShader
-    BumpMethod = bmDot3TexCombiner
-    BumpSpace = bsObject
-    BumpOptions = []
-    SpecularMode = smOff
-    DesignTimeEnabled = False
-    ParallaxOffset = 0.039999999105930330
-    Left = 136
-    Top = 136
-  end
-  object ColorDialog1: TColorDialog
-    Left = 352
-    Top = 72
-  end
-  object AsyncTimer1: TGLAsyncTimer
-    Enabled = True
-    OnTimer = AsyncTimer1Timer
-    ThreadPriority = tpNormal
-    Left = 248
-    Top = 72
-  end
-end

+ 0 - 92
Examples/Demos/rendering/bunnybump/fBunnyBumpC.h

@@ -1,92 +0,0 @@
-//---------------------------------------------------------------------------
-
-#ifndef fBunnyBumpCH
-#define fBunnyBumpCH
-//---------------------------------------------------------------------------
-#include <tchar.h>
-#include <System.Classes.hpp>
-#include <Vcl.Controls.hpp>
-#include <Vcl.StdCtrls.hpp>
-#include <Vcl.Forms.hpp>
-#include <Vcl.Dialogs.hpp>
-#include <Vcl.ExtCtrls.hpp>
-
-#include "GLS.AsyncTimer.hpp"
-#include "GLS.BaseClasses.hpp"
-#include "GLSL.BumpShaders.hpp"
-#include "GLS.Cadencer.hpp"
-#include "GLS.Coordinates.hpp"
-
-#include "GLS.Material.hpp"
-#include "GLS.Objects.hpp"
-#include "GLS.Scene.hpp"
-#include "GLS.VectorFileObjects.hpp"
-#include "GLS.SceneViewer.hpp"
-#include "GLS.OpenGLAdapter.hpp"
-#include "JPeg.hpp"
-#include "GLS.FileOBJ.hpp"
-
-//---------------------------------------------------------------------------
-class TForm1 : public TForm
-{
-__published:	// IDE-managed Components
-	TGLSceneViewer *GLSceneViewer1;
-	TPanel *Panel1;
-	TLabel *Label1;
-	TLabel *Label2;
-	TLabel *LabelFPS;
-	TComboBox *ComboBox1;
-	TGroupBox *GroupBox1;
-	TShape *Shape1;
-	TShape *Shape2;
-	TShape *Shape3;
-	TCheckBox *CheckBox1;
-	TCheckBox *CheckBox2;
-	TCheckBox *CheckBox3;
-	TCheckBox *cbSpin;
-	TComboBox *ComboBox2;
-	TGLScene *GLScene1;
-	TGLDummyCube *DCLights;
-	TGLLightSource *WhiteLight;
-	TGLLightSource *RedLight;
-	TGLLightSource *BlueLight;
-	TGLFreeForm *Bunny;
-	TGLCamera *Camera;
-	TGLCadencer *GLCadencer1;
-	TGLMaterialLibrary *GLMaterialLibrary1;
-	TGLBumpShader *GLBumpShader1;
-	TColorDialog *ColorDialog1;
-	TGLAsyncTimer *AsyncTimer1;
-	void __fastcall FormCreate(TObject *Sender);
-	void __fastcall GLCadencer1Progress(TObject *Sender, const double deltaTime, const double newTime);
-	void __fastcall CheckBox1Click(TObject *Sender);
-	void __fastcall Shape1MouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift,
-          int X, int Y);
-	void __fastcall ComboBox1Change(TObject *Sender);
-	void __fastcall CheckBox2Click(TObject *Sender);
-	void __fastcall CheckBox3Click(TObject *Sender);
-	void __fastcall GLSceneViewer1MouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift,
-          int X, int Y);
-	void __fastcall GLSceneViewer1MouseMove(TObject *Sender, TShiftState Shift, int X,
-          int Y);
-	void __fastcall AsyncTimer1Timer(TObject *Sender);
-	void __fastcall FormResize(TObject *Sender);
-	void __fastcall GLSceneViewer1BeforeRender(TObject *Sender);
-	void __fastcall ComboBox2Change(TObject *Sender);
-	void __fastcall Shape2MouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift,
-          int X, int Y);
-	void __fastcall Shape3MouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift,
-          int X, int Y);
-
-
-private:	// User declarations
-	int mx, my, dx, dy;
-	bool IsInitialized;
-	int StartHeight;
-public:		// User declarations
-	__fastcall TForm1(TComponent* Owner);
-};
-//---------------------------------------------------------------------------
-extern PACKAGE TForm1 *Form1;
-//---------------------------------------------------------------------------
-#endif

+ 0 - 243
Examples/Demos/rendering/bunnybump/fBunnyBumpD.dfm

@@ -1,243 +0,0 @@
-object Form1: TForm1
-  Left = 192
-  Top = 107
-  Caption = 'Bunny Bump Shader'
-  ClientHeight = 437
-  ClientWidth = 562
-  Color = clBtnFace
-  Font.Charset = DEFAULT_CHARSET
-  Font.Color = clWindowText
-  Font.Height = -11
-  Font.Name = 'MS Sans Serif'
-  Font.Style = []
-  Position = poScreenCenter
-  OnCreate = FormCreate
-  OnResize = FormResize
-  TextHeight = 13
-  object GLSceneViewer1: TGLSceneViewer
-    Left = 0
-    Top = 57
-    Width = 562
-    Height = 380
-    Camera = Camera
-    BeforeRender = GLSceneViewer1BeforeRender
-    Buffer.BackgroundColor = clBackground
-    FieldOfView = 150.512878417968800000
-    PenAsTouch = False
-    Align = alClient
-    OnMouseDown = GLSceneViewer1MouseDown
-    OnMouseMove = GLSceneViewer1MouseMove
-    TabOrder = 0
-  end
-  object Panel1: TPanel
-    Left = 0
-    Top = 0
-    Width = 562
-    Height = 57
-    Align = alTop
-    TabOrder = 1
-    object Label1: TLabel
-      Left = 8
-      Top = 8
-      Width = 70
-      Height = 13
-      Caption = 'Shade Method'
-    end
-    object Label2: TLabel
-      Left = 368
-      Top = 8
-      Width = 72
-      Height = 13
-      Caption = 'Specular Mode'
-    end
-    object LabelFPS: TLabel
-      Left = 514
-      Top = 26
-      Width = 20
-      Height = 13
-      Caption = 'FPS'
-    end
-    object ComboBox1: TComboBox
-      Left = 8
-      Top = 24
-      Width = 145
-      Height = 21
-      Style = csDropDownList
-      ItemIndex = 0
-      TabOrder = 0
-      Text = 'Per-Vertex'
-      OnChange = ComboBox1Change
-      Items.Strings = (
-        'Per-Vertex')
-    end
-    object GroupBox1: TGroupBox
-      Left = 161
-      Top = 10
-      Width = 169
-      Height = 41
-      Caption = 'Lights'
-      TabOrder = 1
-      object ShapeWhite: TShape
-        Left = 32
-        Top = 16
-        Width = 17
-        Height = 17
-        Hint = 'White'
-        OnMouseDown = ShapeMouseDown
-      end
-      object ShapeRed: TShape
-        Left = 88
-        Top = 16
-        Width = 17
-        Height = 17
-        Hint = 'Red'
-        Brush.Color = clRed
-        OnMouseDown = ShapeMouseDown
-      end
-      object ShapeBlue: TShape
-        Left = 144
-        Top = 16
-        Width = 17
-        Height = 17
-        Hint = 'Blue'
-        Brush.Color = clBlue
-        OnMouseDown = ShapeMouseDown
-      end
-      object cbWhite: TCheckBox
-        Left = 9
-        Top = 16
-        Width = 17
-        Height = 17
-        Checked = True
-        State = cbChecked
-        TabOrder = 0
-        OnClick = CheckBoxClick
-      end
-      object cbRed: TCheckBox
-        Left = 65
-        Top = 16
-        Width = 17
-        Height = 17
-        TabOrder = 1
-        OnClick = CheckBoxClick
-      end
-      object cbBlue: TCheckBox
-        Left = 121
-        Top = 16
-        Width = 17
-        Height = 17
-        TabOrder = 2
-        OnClick = CheckBoxClick
-      end
-    end
-    object CheckBox4: TCheckBox
-      Left = 458
-      Top = 24
-      Width = 49
-      Height = 17
-      Caption = 'Spin'
-      Checked = True
-      State = cbChecked
-      TabOrder = 2
-    end
-    object ComboBox2: TComboBox
-      Left = 371
-      Top = 24
-      Width = 73
-      Height = 21
-      Style = csDropDownList
-      ItemIndex = 0
-      TabOrder = 3
-      Text = 'smOff'
-      OnChange = ComboBox2Change
-      Items.Strings = (
-        'smOff'
-        'smBlinn'
-        'smPhong')
-    end
-  end
-  object GLScene1: TGLScene
-    Left = 40
-    Top = 72
-    object DCLights: TGLDummyCube
-      CubeSize = 1.000000000000000000
-      object WhiteLight: TGLLightSource
-        ConstAttenuation = 1.000000000000000000
-        Position.Coordinates = {0000404000000040000000000000803F}
-        LightStyle = lsOmni
-        Specular.Color = {0000803F0000803F0000803F0000803F}
-        SpotCutOff = 180.000000000000000000
-      end
-      object RedLight: TGLLightSource
-        ConstAttenuation = 1.000000000000000000
-        Diffuse.Color = {0000803F00000000000000000000803F}
-        Position.Coordinates = {0000C0BF00000040666626C00000803F}
-        LightStyle = lsOmni
-        Shining = False
-        Specular.Color = {0000803F0000003F0000003F0000803F}
-        SpotCutOff = 180.000000000000000000
-      end
-      object BlueLight: TGLLightSource
-        ConstAttenuation = 1.000000000000000000
-        Diffuse.Color = {00000000000000000000803F0000803F}
-        Position.Coordinates = {0000C0BF00000040666626400000803F}
-        LightStyle = lsOmni
-        Shining = False
-        Specular.Color = {0000003F0000003F0000803F0000803F}
-        SpotCutOff = 180.000000000000000000
-      end
-    end
-    object ffBunny: TGLFreeForm
-      Material.FrontProperties.Shininess = 64
-      Material.FrontProperties.Specular.Color = {CDCC4C3ECDCC4C3ECDCC4C3E0000803F}
-      Material.MaterialLibrary = MatLib
-      AutoCentering = [macCenterX, macCenterY, macCenterZ]
-    end
-    object Camera: TGLCamera
-      DepthOfView = 100.000000000000000000
-      FocalLength = 50.000000000000000000
-      TargetObject = ffBunny
-      Position.Coordinates = {000080400000803F000000000000803F}
-    end
-  end
-  object GLCadencer1: TGLCadencer
-    Scene = GLScene1
-    OnProgress = GLCadencer1Progress
-    Left = 40
-    Top = 136
-  end
-  object MatLib: TGLMaterialLibrary
-    Materials = <
-      item
-        Name = 'Bump'
-        Tag = 0
-        Material.FrontProperties.Shininess = 64
-        Material.FrontProperties.Specular.Color = {CDCC4C3ECDCC4C3ECDCC4C3E0000803F}
-        Material.Texture.Disabled = False
-        Shader = GLBumpShader1
-      end>
-    Left = 136
-    Top = 72
-  end
-  object GLBumpShader1: TGLBumpShader
-    BumpMethod = bmDot3TexCombiner
-    BumpSpace = bsObject
-    BumpOptions = []
-    SpecularMode = smOff
-    DesignTimeEnabled = False
-    ParallaxOffset = 0.039999999105930330
-    Left = 136
-    Top = 136
-  end
-  object ColorDialog1: TColorDialog
-    Left = 352
-    Top = 72
-  end
-  object AsyncTimer1: TGLAsyncTimer
-    Enabled = True
-    OnTimer = AsyncTimer1Timer
-    ThreadPriority = tpNormal
-    Left = 248
-    Top = 72
-  end
-end

+ 0 - 246
Examples/Demos/rendering/bunnybump/fBunnyBumpD.pas

@@ -1,246 +0,0 @@
-unit fBunnyBumpD;
-
-interface
-
-uses
-  Winapi.OpenGL,
-  System.SysUtils,
-  System.Classes,
-  System.UITypes,
-  Vcl.Graphics,
-  Vcl.Controls,
-  Vcl.Forms,
-  Vcl.Dialogs,
-  Vcl.ExtCtrls,
-  Vcl.StdCtrls,
-  Vcl.Imaging.Jpeg,
-  
-  GLS.Scene,
-  GLS.VectorTypes,
-  GLS.Objects,
-  GLS.Texture,
-  GLS.VectorFileObjects,
-  GLS.Cadencer,
-  GLS.SceneViewer,
-  GLS.AsyncTimer,
- 
-  GLS.Material,
-  GLS.Coordinates,
-  GLS.BaseClasses,
-  GLS.VectorGeometry,
-  GLS.Context,
-  GLS.FileOBJ,
-  GLS.Utils,
-  GLSL.BumpShaders;
-
-type
-  TForm1 = class(TForm)
-    GLSceneViewer1: TGLSceneViewer;
-    GLScene1: TGLScene;
-    GLCadencer1: TGLCadencer;
-    MatLib: TGLMaterialLibrary;
-    Camera: TGLCamera;
-    WhiteLight: TGLLightSource;
-    RedLight: TGLLightSource;
-    BlueLight: TGLLightSource;
-    GLBumpShader1: TGLBumpShader;
-    Panel1: TPanel;
-    ComboBox1: TComboBox;
-    Label1: TLabel;
-    GroupBox1: TGroupBox;
-    cbWhite: TCheckBox;
-    cbRed: TCheckBox;
-    cbBlue: TCheckBox;
-    ShapeWhite: TShape;
-    ShapeRed: TShape;
-    ShapeBlue: TShape;
-    ColorDialog1: TColorDialog;
-    DCLights: TGLDummyCube;
-    AsyncTimer1: TGLAsyncTimer;
-    CheckBox4: TCheckBox;
-    ComboBox2: TComboBox;
-    Label2: TLabel;
-    LabelFPS: TLabel;
-    ffBunny: TGLFreeForm;
-    procedure FormCreate(Sender: TObject);
-    procedure GLSceneViewer1MouseDown(Sender: TObject; Button: TMouseButton;
-      Shift: TShiftState; X, Y: Integer);
-    procedure GLSceneViewer1MouseMove(Sender: TObject; Shift: TShiftState;
-      X, Y: Integer);
-    procedure GLCadencer1Progress(Sender: TObject;
-      const deltaTime, newTime: Double);
-    procedure ShapeMouseDown(Sender: TObject; Button: TMouseButton;
-      Shift: TShiftState; X, Y: Integer);
-    procedure CheckBoxClick(Sender: TObject);
-    procedure AsyncTimer1Timer(Sender: TObject);
-    procedure ComboBox1Change(Sender: TObject);
-    procedure FormResize(Sender: TObject);
-    procedure GLSceneViewer1BeforeRender(Sender: TObject);
-    procedure ComboBox2Change(Sender: TObject);
-  private
-     
-  public
-     
-    mx, my, dx, dy: Integer;
-    IsInitialized: Boolean;
-    StartHeight: Integer;
-  end;
-
-var
-  Form1: TForm1;
-
-implementation
-
-{$R *.dfm}
-
-procedure TForm1.FormCreate(Sender: TObject);
-begin
-  var Path: TFileName := GetCurrentAssetPath();
-  SetCurrentDir(Path  + '\model');
-  // Load the bunny mesh and scale for viewing
-  ffBunny.LoadFromFile('bunny.glsm');
-//  ffBunny.LoadFromFile('bunny.obj');
-  ffBunny.Scale.Scale(2 / ffBunny.BoundingSphereRadius);
-  ffBunny.RollAngle := 90;
-  ffBunny.TurnAngle := 90;
-
-
-  // Load the normal map
-  MatLib.Materials[0].Material.Texture.Image.LoadFromFile('bunnynormals.jpg');
-
-  // Link the lights to their toggles
-  cbWhite.Tag := Integer(WhiteLight);
-  cbRed.Tag := Integer(RedLight);
-  cbBlue.Tag := Integer(BlueLight);
-  ShapeWhite.Tag := Integer(WhiteLight);
-  ShapeRed.Tag := Integer(RedLight);
-  ShapeBlue.Tag := Integer(BlueLight);
-
-  ComboBox1.ItemIndex := 0;
-  ComboBox1Change(Self);
-
-  StartHeight := Height;
-end;
-
-procedure TForm1.GLCadencer1Progress(Sender: TObject;
-  const deltaTime, newTime: Double);
-begin
-  // Orbit the camera
-  if (dx <> 0) or (dy <> 0) then
-  begin
-    Camera.MoveAroundTarget(dy, dx);
-    dx := 0;
-    dy := 0;
-  end;
-
-  // Rotate the light sources
-  if CheckBox4.Checked then
-    DCLights.Turn(deltaTime * 20);
-
-  GLSceneViewer1.Invalidate;
-end;
-
-procedure TForm1.CheckBoxClick(Sender: TObject);
-begin
-  // Light Shining CheckBox
-  TGLLightSource(TCheckBox(Sender).Tag).Shining := TCheckBox(Sender).Checked;
-end;
-
-procedure TForm1.ShapeMouseDown(Sender: TObject; Button: TMouseButton;
-  Shift: TShiftState; X, Y: Integer);
-begin
-  // Light Color Dialog
-  ColorDialog1.Color := TShape(Sender).Brush.Color;
-  if ColorDialog1.Execute then
-  begin
-    TShape(Sender).Brush.Color := ColorDialog1.Color;
-    with TGLLightSource(TShape(Sender).Tag) do
-      Diffuse.AsWinColor := ColorDialog1.Color;
-  end;
-end;
-
-procedure TForm1.ComboBox1Change(Sender: TObject);
-begin
-  if ComboBox1.Text = 'Per-Vertex' then
-    ffBunny.Material.LibMaterialName := ''
-  else if ComboBox1.Text = 'Dot3 Texture Combiner' then
-  begin
-    ffBunny.Material.LibMaterialName := 'Bump';
-    GLBumpShader1.BumpMethod := bmDot3TexCombiner;
-  end
-  else if ComboBox1.Text = 'Basic Fragment Program' then
-  begin
-    ffBunny.Material.LibMaterialName := 'Bump';
-    GLBumpShader1.BumpMethod := bmBasicARBFP;
-  end;
-end;
-
-procedure TForm1.GLSceneViewer1MouseDown(Sender: TObject; Button: TMouseButton;
-  Shift: TShiftState; X, Y: Integer);
-begin
-  mx := X;
-  my := Y;
-  dx := 0;
-  dy := 0;
-end;
-
-procedure TForm1.GLSceneViewer1MouseMove(Sender: TObject; Shift: TShiftState;
-  X, Y: Integer);
-begin
-  if ssLeft in Shift then
-  begin
-    dx := dx + (mx - X);
-    dy := dy + (my - Y);
-  end
-  else
-  begin
-    dx := 0;
-    dy := 0;
-  end;
-  mx := X;
-  my := Y;
-end;
-
-procedure TForm1.AsyncTimer1Timer(Sender: TObject);
-begin
-  LabelFPS.Caption := GLSceneViewer1.FramesPerSecondText;
-  GLSceneViewer1.ResetPerformanceMonitor;
-end;
-
-procedure TForm1.FormResize(Sender: TObject);
-begin
-  Camera.SceneScale := Height / StartHeight;
-end;
-
-procedure TForm1.GLSceneViewer1BeforeRender(Sender: TObject);
-begin
-  if IsInitialized then
-    exit;
-
-  if GL.ARB_multitexture and GL.ARB_vertex_program and GL.ARB_texture_env_dot3
-  then
-    ComboBox1.Items.Add('Dot3 Texture Combiner');
-  if GL.ARB_multitexture and GL.ARB_vertex_program and GL.ARB_fragment_program
-  then
-  begin
-    ComboBox1.Items.Add('Basic Fragment Program');
-    if GLSceneViewer1.Buffer.LimitOf[limNbTextureUnits] < 3 then
-      GLBumpShader1.SpecularMode := smOff;
-  end;
-
-  IsInitialized := True;
-end;
-
-procedure TForm1.ComboBox2Change(Sender: TObject);
-begin
-  case ComboBox2.ItemIndex of
-    0:
-      GLBumpShader1.SpecularMode := smOff;
-    1:
-      GLBumpShader1.SpecularMode := smBlinn;
-    2:
-      GLBumpShader1.SpecularMode := smPhong;
-  end;
-end;
-
-end.

+ 0 - 3
Examples/Demos/specialsFX/Atmosphere/fAtmosphereD.dfm

@@ -25,8 +25,6 @@ object FormAtmosphere: TFormAtmosphere
     PenAsTouch = False
     PenAsTouch = False
     Align = alClient
     Align = alClient
     TabOrder = 0
     TabOrder = 0
-    ExplicitWidth = 495
-    ExplicitHeight = 485
   end
   end
   object Panel1: TPanel
   object Panel1: TPanel
     Left = 0
     Left = 0
@@ -35,7 +33,6 @@ object FormAtmosphere: TFormAtmosphere
     Height = 475
     Height = 475
     Align = alLeft
     Align = alLeft
     TabOrder = 1
     TabOrder = 1
-    ExplicitHeight = 485
     object Label1: TLabel
     object Label1: TLabel
       Left = 13
       Left = 13
       Top = 368
       Top = 368

+ 2 - 1
Examples/Demos/specialsFX/PFXCursor/PfxCursor.dpr

@@ -7,12 +7,13 @@ program PfxCursor;
 
 
 uses
 uses
   Forms,
   Forms,
-  fPfxCursor in 'fPfxCursor.pas';
+  fPfxCursor in 'fPfxCursor.pas' {Form1};
 
 
 {$R *.res}
 {$R *.res}
 
 
 begin
 begin
   Application.Initialize;
   Application.Initialize;
   Application.CreateForm(TForm1, Form1);
   Application.CreateForm(TForm1, Form1);
+  Application.CreateForm(TForm1, Form1);
   Application.Run;
   Application.Run;
 end.
 end.

+ 4 - 1
Examples/Demos/specialsFX/PFXCursor/PfxCursor.dproj

@@ -90,7 +90,10 @@
         <DelphiCompile Include="$(MainSource)">
         <DelphiCompile Include="$(MainSource)">
             <MainSource>MainSource</MainSource>
             <MainSource>MainSource</MainSource>
         </DelphiCompile>
         </DelphiCompile>
-        <DCCReference Include="fPfxCursor.pas"/>
+        <DCCReference Include="fPfxCursor.pas">
+            <Form>Form1</Form>
+            <FormType>dfm</FormType>
+        </DCCReference>
         <BuildConfiguration Include="Base">
         <BuildConfiguration Include="Base">
             <Key>Base</Key>
             <Key>Base</Key>
         </BuildConfiguration>
         </BuildConfiguration>

+ 15 - 3
Examples/Demos/specialsFX/SpecialFX.groupproj

@@ -57,6 +57,9 @@
         <Projects Include="ParticleMasking\ParticleMaskingC.cbproj">
         <Projects Include="ParticleMasking\ParticleMaskingC.cbproj">
             <Dependencies/>
             <Dependencies/>
         </Projects>
         </Projects>
+        <Projects Include="PFXCursor\PfxCursor.dproj">
+            <Dependencies/>
+        </Projects>
         <Projects Include="PFXGallery\PFXGalleryD.dproj">
         <Projects Include="PFXGallery\PFXGalleryD.dproj">
             <Dependencies/>
             <Dependencies/>
         </Projects>
         </Projects>
@@ -296,6 +299,15 @@
     <Target Name="ParticleMaskingC:Make">
     <Target Name="ParticleMaskingC:Make">
         <MSBuild Projects="ParticleMasking\ParticleMaskingC.cbproj" Targets="Make"/>
         <MSBuild Projects="ParticleMasking\ParticleMaskingC.cbproj" Targets="Make"/>
     </Target>
     </Target>
+    <Target Name="PfxCursor">
+        <MSBuild Projects="PFXCursor\PfxCursor.dproj"/>
+    </Target>
+    <Target Name="PfxCursor:Clean">
+        <MSBuild Projects="PFXCursor\PfxCursor.dproj" Targets="Clean"/>
+    </Target>
+    <Target Name="PfxCursor:Make">
+        <MSBuild Projects="PFXCursor\PfxCursor.dproj" Targets="Make"/>
+    </Target>
     <Target Name="PFXGalleryD">
     <Target Name="PFXGalleryD">
         <MSBuild Projects="PFXGallery\PFXGalleryD.dproj"/>
         <MSBuild Projects="PFXGallery\PFXGalleryD.dproj"/>
     </Target>
     </Target>
@@ -504,13 +516,13 @@
         <MSBuild Projects="waterplane\WaterPlaneC.cbproj" Targets="Make"/>
         <MSBuild Projects="waterplane\WaterPlaneC.cbproj" Targets="Make"/>
     </Target>
     </Target>
     <Target Name="Build">
     <Target Name="Build">
-        <CallTarget Targets="AtmosphereD;AtmosphereC;BeerD;BeerC;BoomD;BoomC;CandlesD;CandlesC;FireD;FireC;MeshExplosionD;MeshExplosionC;MotionBlurD;MotionBlurC;MotionBlur2D;MotionBlur2C;ParticleMaskingD;ParticleMaskingC;PFXGalleryD;PFXGalleryC;PostEffectD;PostEffectC;ProjTexturesD;ProjTexturesC;ShadowFBOD;ShadowFBOC;ShadowPlaneD;ShadowPlaneC;ShadowsD;ShadowsC;ShadowVolumesD;ShadowVolumesC;SpiralD;SpiralC;ThorD;ThorC;TrailsD;WarpingD;WarpingC;WaterPlaneD;WaterPlaneC"/>
+        <CallTarget Targets="AtmosphereD;AtmosphereC;BeerD;BeerC;BoomD;BoomC;CandlesD;CandlesC;FireD;FireC;MeshExplosionD;MeshExplosionC;MotionBlurD;MotionBlurC;MotionBlur2D;MotionBlur2C;ParticleMaskingD;ParticleMaskingC;PfxCursor;PFXGalleryD;PFXGalleryC;PostEffectD;PostEffectC;ProjTexturesD;ProjTexturesC;ShadowFBOD;ShadowFBOC;ShadowPlaneD;ShadowPlaneC;ShadowsD;ShadowsC;ShadowVolumesD;ShadowVolumesC;SpiralD;SpiralC;ThorD;ThorC;TrailsD;WarpingD;WarpingC;WaterPlaneD;WaterPlaneC"/>
     </Target>
     </Target>
     <Target Name="Clean">
     <Target Name="Clean">
-        <CallTarget Targets="AtmosphereD:Clean;AtmosphereC:Clean;BeerD:Clean;BeerC:Clean;BoomD:Clean;BoomC:Clean;CandlesD:Clean;CandlesC:Clean;FireD:Clean;FireC:Clean;MeshExplosionD:Clean;MeshExplosionC:Clean;MotionBlurD:Clean;MotionBlurC:Clean;MotionBlur2D:Clean;MotionBlur2C:Clean;ParticleMaskingD:Clean;ParticleMaskingC:Clean;PFXGalleryD:Clean;PFXGalleryC:Clean;PostEffectD:Clean;PostEffectC:Clean;ProjTexturesD:Clean;ProjTexturesC:Clean;ShadowFBOD:Clean;ShadowFBOC:Clean;ShadowPlaneD:Clean;ShadowPlaneC:Clean;ShadowsD:Clean;ShadowsC:Clean;ShadowVolumesD:Clean;ShadowVolumesC:Clean;SpiralD:Clean;SpiralC:Clean;ThorD:Clean;ThorC:Clean;TrailsD:Clean;WarpingD:Clean;WarpingC:Clean;WaterPlaneD:Clean;WaterPlaneC:Clean"/>
+        <CallTarget Targets="AtmosphereD:Clean;AtmosphereC:Clean;BeerD:Clean;BeerC:Clean;BoomD:Clean;BoomC:Clean;CandlesD:Clean;CandlesC:Clean;FireD:Clean;FireC:Clean;MeshExplosionD:Clean;MeshExplosionC:Clean;MotionBlurD:Clean;MotionBlurC:Clean;MotionBlur2D:Clean;MotionBlur2C:Clean;ParticleMaskingD:Clean;ParticleMaskingC:Clean;PfxCursor:Clean;PFXGalleryD:Clean;PFXGalleryC:Clean;PostEffectD:Clean;PostEffectC:Clean;ProjTexturesD:Clean;ProjTexturesC:Clean;ShadowFBOD:Clean;ShadowFBOC:Clean;ShadowPlaneD:Clean;ShadowPlaneC:Clean;ShadowsD:Clean;ShadowsC:Clean;ShadowVolumesD:Clean;ShadowVolumesC:Clean;SpiralD:Clean;SpiralC:Clean;ThorD:Clean;ThorC:Clean;TrailsD:Clean;WarpingD:Clean;WarpingC:Clean;WaterPlaneD:Clean;WaterPlaneC:Clean"/>
     </Target>
     </Target>
     <Target Name="Make">
     <Target Name="Make">
-        <CallTarget Targets="AtmosphereD:Make;AtmosphereC:Make;BeerD:Make;BeerC:Make;BoomD:Make;BoomC:Make;CandlesD:Make;CandlesC:Make;FireD:Make;FireC:Make;MeshExplosionD:Make;MeshExplosionC:Make;MotionBlurD:Make;MotionBlurC:Make;MotionBlur2D:Make;MotionBlur2C:Make;ParticleMaskingD:Make;ParticleMaskingC:Make;PFXGalleryD:Make;PFXGalleryC:Make;PostEffectD:Make;PostEffectC:Make;ProjTexturesD:Make;ProjTexturesC:Make;ShadowFBOD:Make;ShadowFBOC:Make;ShadowPlaneD:Make;ShadowPlaneC:Make;ShadowsD:Make;ShadowsC:Make;ShadowVolumesD:Make;ShadowVolumesC:Make;SpiralD:Make;SpiralC:Make;ThorD:Make;ThorC:Make;TrailsD:Make;WarpingD:Make;WarpingC:Make;WaterPlaneD:Make;WaterPlaneC:Make"/>
+        <CallTarget Targets="AtmosphereD:Make;AtmosphereC:Make;BeerD:Make;BeerC:Make;BoomD:Make;BoomC:Make;CandlesD:Make;CandlesC:Make;FireD:Make;FireC:Make;MeshExplosionD:Make;MeshExplosionC:Make;MotionBlurD:Make;MotionBlurC:Make;MotionBlur2D:Make;MotionBlur2C:Make;ParticleMaskingD:Make;ParticleMaskingC:Make;PfxCursor:Make;PFXGalleryD:Make;PFXGalleryC:Make;PostEffectD:Make;PostEffectC:Make;ProjTexturesD:Make;ProjTexturesC:Make;ShadowFBOD:Make;ShadowFBOC:Make;ShadowPlaneD:Make;ShadowPlaneC:Make;ShadowsD:Make;ShadowsC:Make;ShadowVolumesD:Make;ShadowVolumesC:Make;SpiralD:Make;SpiralC:Make;ThorD:Make;ThorC:Make;TrailsD:Make;WarpingD:Make;WarpingC:Make;WaterPlaneD:Make;WaterPlaneC:Make"/>
     </Target>
     </Target>
     <Import Project="$(BDS)\Bin\CodeGear.Group.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Group.Targets')"/>
     <Import Project="$(BDS)\Bin\CodeGear.Group.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Group.Targets')"/>
 </Project>
 </Project>

+ 25 - 25
Packages/GLScene.groupproj

@@ -15,16 +15,16 @@
         <Projects Include="GLScene_Sounds_DT.dproj">
         <Projects Include="GLScene_Sounds_DT.dproj">
             <Dependencies/>
             <Dependencies/>
         </Projects>
         </Projects>
-        <Projects Include="GLScene_Physics_RT.dproj">
+        <Projects Include="GLScene_Cg_RT.dproj">
             <Dependencies/>
             <Dependencies/>
         </Projects>
         </Projects>
-        <Projects Include="GLScene_Physics_DT.dproj">
+        <Projects Include="GLScene_Cg_DT.dproj">
             <Dependencies/>
             <Dependencies/>
         </Projects>
         </Projects>
-        <Projects Include="GLScene_Cg_RT.dproj">
+        <Projects Include="GLScene_Physics_RT.dproj">
             <Dependencies/>
             <Dependencies/>
         </Projects>
         </Projects>
-        <Projects Include="GLScene_Cg_DT.dproj">
+        <Projects Include="GLScene_Physics_DT.dproj">
             <Dependencies/>
             <Dependencies/>
         </Projects>
         </Projects>
         <Projects Include="GLScene_GPU_RT.dproj">
         <Projects Include="GLScene_GPU_RT.dproj">
@@ -77,24 +77,6 @@
     <Target Name="GLScene_Sounds_DT:Make">
     <Target Name="GLScene_Sounds_DT:Make">
         <MSBuild Projects="GLScene_Sounds_DT.dproj" Targets="Make"/>
         <MSBuild Projects="GLScene_Sounds_DT.dproj" Targets="Make"/>
     </Target>
     </Target>
-    <Target Name="GLScene_Physics_RT">
-        <MSBuild Projects="GLScene_Physics_RT.dproj"/>
-    </Target>
-    <Target Name="GLScene_Physics_RT:Clean">
-        <MSBuild Projects="GLScene_Physics_RT.dproj" Targets="Clean"/>
-    </Target>
-    <Target Name="GLScene_Physics_RT:Make">
-        <MSBuild Projects="GLScene_Physics_RT.dproj" Targets="Make"/>
-    </Target>
-    <Target Name="GLScene_Physics_DT">
-        <MSBuild Projects="GLScene_Physics_DT.dproj"/>
-    </Target>
-    <Target Name="GLScene_Physics_DT:Clean">
-        <MSBuild Projects="GLScene_Physics_DT.dproj" Targets="Clean"/>
-    </Target>
-    <Target Name="GLScene_Physics_DT:Make">
-        <MSBuild Projects="GLScene_Physics_DT.dproj" Targets="Make"/>
-    </Target>
     <Target Name="GLScene_Cg_RT">
     <Target Name="GLScene_Cg_RT">
         <MSBuild Projects="GLScene_Cg_RT.dproj"/>
         <MSBuild Projects="GLScene_Cg_RT.dproj"/>
     </Target>
     </Target>
@@ -113,6 +95,24 @@
     <Target Name="GLScene_Cg_DT:Make">
     <Target Name="GLScene_Cg_DT:Make">
         <MSBuild Projects="GLScene_Cg_DT.dproj" Targets="Make"/>
         <MSBuild Projects="GLScene_Cg_DT.dproj" Targets="Make"/>
     </Target>
     </Target>
+    <Target Name="GLScene_Physics_RT">
+        <MSBuild Projects="GLScene_Physics_RT.dproj"/>
+    </Target>
+    <Target Name="GLScene_Physics_RT:Clean">
+        <MSBuild Projects="GLScene_Physics_RT.dproj" Targets="Clean"/>
+    </Target>
+    <Target Name="GLScene_Physics_RT:Make">
+        <MSBuild Projects="GLScene_Physics_RT.dproj" Targets="Make"/>
+    </Target>
+    <Target Name="GLScene_Physics_DT">
+        <MSBuild Projects="GLScene_Physics_DT.dproj"/>
+    </Target>
+    <Target Name="GLScene_Physics_DT:Clean">
+        <MSBuild Projects="GLScene_Physics_DT.dproj" Targets="Clean"/>
+    </Target>
+    <Target Name="GLScene_Physics_DT:Make">
+        <MSBuild Projects="GLScene_Physics_DT.dproj" Targets="Make"/>
+    </Target>
     <Target Name="GLScene_GPU_RT">
     <Target Name="GLScene_GPU_RT">
         <MSBuild Projects="GLScene_GPU_RT.dproj"/>
         <MSBuild Projects="GLScene_GPU_RT.dproj"/>
     </Target>
     </Target>
@@ -132,13 +132,13 @@
         <MSBuild Projects="GLScene_GPU_DT.dproj" Targets="Make"/>
         <MSBuild Projects="GLScene_GPU_DT.dproj" Targets="Make"/>
     </Target>
     </Target>
     <Target Name="Build">
     <Target Name="Build">
-        <CallTarget Targets="GLScene_RT;GLScene_DT;GLScene_Sounds_RT;GLScene_Sounds_DT;GLScene_Physics_RT;GLScene_Physics_DT;GLScene_Cg_RT;GLScene_Cg_DT;GLScene_GPU_RT;GLScene_GPU_DT"/>
+        <CallTarget Targets="GLScene_RT;GLScene_DT;GLScene_Sounds_RT;GLScene_Sounds_DT;GLScene_Cg_RT;GLScene_Cg_DT;GLScene_Physics_RT;GLScene_Physics_DT;GLScene_GPU_RT;GLScene_GPU_DT"/>
     </Target>
     </Target>
     <Target Name="Clean">
     <Target Name="Clean">
-        <CallTarget Targets="GLScene_RT:Clean;GLScene_DT:Clean;GLScene_Sounds_RT:Clean;GLScene_Sounds_DT:Clean;GLScene_Physics_RT:Clean;GLScene_Physics_DT:Clean;GLScene_Cg_RT:Clean;GLScene_Cg_DT:Clean;GLScene_GPU_RT:Clean;GLScene_GPU_DT:Clean"/>
+        <CallTarget Targets="GLScene_RT:Clean;GLScene_DT:Clean;GLScene_Sounds_RT:Clean;GLScene_Sounds_DT:Clean;GLScene_Cg_RT:Clean;GLScene_Cg_DT:Clean;GLScene_Physics_RT:Clean;GLScene_Physics_DT:Clean;GLScene_GPU_RT:Clean;GLScene_GPU_DT:Clean"/>
     </Target>
     </Target>
     <Target Name="Make">
     <Target Name="Make">
-        <CallTarget Targets="GLScene_RT:Make;GLScene_DT:Make;GLScene_Sounds_RT:Make;GLScene_Sounds_DT:Make;GLScene_Physics_RT:Make;GLScene_Physics_DT:Make;GLScene_Cg_RT:Make;GLScene_Cg_DT:Make;GLScene_GPU_RT:Make;GLScene_GPU_DT:Make"/>
+        <CallTarget Targets="GLScene_RT:Make;GLScene_DT:Make;GLScene_Sounds_RT:Make;GLScene_Sounds_DT:Make;GLScene_Cg_RT:Make;GLScene_Cg_DT:Make;GLScene_Physics_RT:Make;GLScene_Physics_DT:Make;GLScene_GPU_RT:Make;GLScene_GPU_DT:Make"/>
     </Target>
     </Target>
     <Import Project="$(BDS)\Bin\CodeGear.Group.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Group.Targets')"/>
     <Import Project="$(BDS)\Bin\CodeGear.Group.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Group.Targets')"/>
 </Project>
 </Project>

+ 2 - 2
Packages/GLScene_Cg_DT.dpk

@@ -34,8 +34,8 @@ requires
   rtl,
   rtl,
   designide,
   designide,
   VclSmp,
   VclSmp,
-  GLScene_DT,
-  GLScene_Cg_RT;
+  GLScene_Cg_RT,
+  GLScene_DT;
 
 
 contains
 contains
   Cg.Register in '..\Source\Cg.Register.pas';
   Cg.Register in '..\Source\Cg.Register.pas';

+ 3 - 3
Packages/GLScene_Cg_DT.dproj

@@ -71,7 +71,7 @@
     </PropertyGroup>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Base_Win32)'!=''">
     <PropertyGroup Condition="'$(Base_Win32)'!=''">
         <DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
         <DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
-        <DCC_UsePackage>rtl;fmx;VclSmp;GLScene_Cg_RT;$(DCC_UsePackage)</DCC_UsePackage>
+        <DCC_UsePackage>rtl;fmx;VclSmp;GLScene_Cg_RT;GLScene_RT;$(DCC_UsePackage)</DCC_UsePackage>
         <DCC_BpiOutput>..\lib\$(Platform)</DCC_BpiOutput>
         <DCC_BpiOutput>..\lib\$(Platform)</DCC_BpiOutput>
         <DCC_ObjOutput>..\lib\$(Platform)</DCC_ObjOutput>
         <DCC_ObjOutput>..\lib\$(Platform)</DCC_ObjOutput>
         <DCC_HppOutput>..\include\$(Platform)</DCC_HppOutput>
         <DCC_HppOutput>..\include\$(Platform)</DCC_HppOutput>
@@ -79,7 +79,7 @@
     <PropertyGroup Condition="'$(Base_Win64)'!=''">
     <PropertyGroup Condition="'$(Base_Win64)'!=''">
         <DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)</DCC_Namespace>
         <DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)</DCC_Namespace>
         <VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
         <VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
-        <DCC_UsePackage>rtl;fmx;VclSmp;$(DCC_UsePackage)</DCC_UsePackage>
+        <DCC_UsePackage>rtl;fmx;VclSmp;GLScene_RT;$(DCC_UsePackage)</DCC_UsePackage>
     </PropertyGroup>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Cfg_1)'!=''">
     <PropertyGroup Condition="'$(Cfg_1)'!=''">
         <DCC_DebugInformation>0</DCC_DebugInformation>
         <DCC_DebugInformation>0</DCC_DebugInformation>
@@ -111,8 +111,8 @@
         <DCCReference Include="rtl.dcp"/>
         <DCCReference Include="rtl.dcp"/>
         <DCCReference Include="designide.dcp"/>
         <DCCReference Include="designide.dcp"/>
         <DCCReference Include="VclSmp.dcp"/>
         <DCCReference Include="VclSmp.dcp"/>
-        <DCCReference Include="GLScene_DT.dcp"/>
         <DCCReference Include="GLScene_Cg_RT.dcp"/>
         <DCCReference Include="GLScene_Cg_RT.dcp"/>
+        <DCCReference Include="GLScene_DT.dcp"/>
         <DCCReference Include="..\Source\Cg.Register.pas"/>
         <DCCReference Include="..\Source\Cg.Register.pas"/>
         <RcCompile Include="..\Resources\GLSceneShaders.rc">
         <RcCompile Include="..\Resources\GLSceneShaders.rc">
             <Form>GLSceneShaders.res</Form>
             <Form>GLSceneShaders.res</Form>

+ 1 - 7
Packages/GLScene_DT.dproj

@@ -73,7 +73,7 @@
         <VerInfo_Locale>1033</VerInfo_Locale>
         <VerInfo_Locale>1033</VerInfo_Locale>
     </PropertyGroup>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Base_Win64)'!=''">
     <PropertyGroup Condition="'$(Base_Win64)'!=''">
-        <DCC_UsePackage>rtl;vcl;vclimg;VclSmp;$(DCC_UsePackage)</DCC_UsePackage>
+        <DCC_UsePackage>rtl;vcl;vclimg;VclSmp;GLScene_RT;$(DCC_UsePackage)</DCC_UsePackage>
     </PropertyGroup>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Cfg_1)'!=''">
     <PropertyGroup Condition="'$(Cfg_1)'!=''">
         <DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
         <DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
@@ -205,12 +205,6 @@
                     <Source Name="MainSource">GLScene_DT.dpk</Source>
                     <Source Name="MainSource">GLScene_DT.dpk</Source>
                 </Source>
                 </Source>
                 <Excluded_Packages>
                 <Excluded_Packages>
-                    <Excluded_Packages Name="C:\Users\Public\Documents\Embarcadero\Studio\22.0\Bpl\GLScene_Physics_DT.bpl">GLScene Physics Managers</Excluded_Packages>
-                    <Excluded_Packages Name="C:\Users\Public\Documents\Embarcadero\Studio\22.0\Bpl\GBComps.bpl">Geoblock - Components</Excluded_Packages>
-                    <Excluded_Packages Name="C:\Users\Public\Documents\Embarcadero\Studio\22.0\Bpl\GEdgeIO.bpl">File C:\Users\Public\Documents\Embarcadero\Studio\22.0\Bpl\GEdgeIO.bpl not found</Excluded_Packages>
-                    <Excluded_Packages Name="C:\Users\Public\Documents\Embarcadero\Studio\22.0\Bpl\GEdgeIODB.bpl">File C:\Users\Public\Documents\Embarcadero\Studio\22.0\Bpl\GEdgeIODB.bpl not found</Excluded_Packages>
-                    <Excluded_Packages Name="C:\Users\Public\Documents\Embarcadero\Studio\22.0\Bpl\VirtualTreesD22.bpl">File C:\Users\Public\Documents\Embarcadero\Studio\22.0\Bpl\VirtualTreesD22.bpl not found</Excluded_Packages>
-                    <Excluded_Packages Name="C:\Users\Public\Documents\Embarcadero\Studio\22.0\Bpl\GLScene_Newton_DT.bpl">File C:\Users\Public\Documents\Embarcadero\Studio\22.0\Bpl\GLScene_Newton_DT.bpl not found</Excluded_Packages>
                     <Excluded_Packages Name="$(BDSBIN)\bcboffice2k280.bpl">Embarcadero C++Builder Office 2000 Servers Package</Excluded_Packages>
                     <Excluded_Packages Name="$(BDSBIN)\bcboffice2k280.bpl">Embarcadero C++Builder Office 2000 Servers Package</Excluded_Packages>
                     <Excluded_Packages Name="$(BDSBIN)\bcbofficexp280.bpl">Embarcadero C++Builder Office XP Servers Package</Excluded_Packages>
                     <Excluded_Packages Name="$(BDSBIN)\bcbofficexp280.bpl">Embarcadero C++Builder Office XP Servers Package</Excluded_Packages>
                     <Excluded_Packages Name="$(BDSBIN)\dcloffice2k280.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
                     <Excluded_Packages Name="$(BDSBIN)\dcloffice2k280.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>

+ 10 - 8
Packages/GLScene_Physics_RT.dpk

@@ -35,19 +35,21 @@ requires
   GLScene_RT;
   GLScene_RT;
 
 
 contains
 contains
+  Physics.NewtonImport in '..\Source\Physics.NewtonImport.pas',
+  Physics.NGDManager in '..\Source\Physics.NGDManager.pas',
+  Physics.NGDRagdoll in '..\Source\Physics.NGDRagdoll.pas',
+  Physics.NGDImport in '..\Source\Physics.NGDImport.pas',
   Physics.ODEImport in '..\Source\Physics.ODEImport.pas',
   Physics.ODEImport in '..\Source\Physics.ODEImport.pas',
   Physics.ODEManager in '..\Source\Physics.ODEManager.pas',
   Physics.ODEManager in '..\Source\Physics.ODEManager.pas',
   Physics.ODERagdoll in '..\Source\Physics.ODERagdoll.pas',
   Physics.ODERagdoll in '..\Source\Physics.ODERagdoll.pas',
   Physics.ODESkeletonColliders in '..\Source\Physics.ODESkeletonColliders.pas',
   Physics.ODESkeletonColliders in '..\Source\Physics.ODESkeletonColliders.pas',
   Physics.ODEUtils in '..\Source\Physics.ODEUtils.pas',
   Physics.ODEUtils in '..\Source\Physics.ODEUtils.pas',
-  Physics.GLxInertias in '..\Source\Physics.GLxInertias.pas',
-  Physics.GLxJoints in '..\Source\Physics.GLxJoints.pas',
-  Physics.GLxManager in '..\Source\Physics.GLxManager.pas',
-  Physics.PhysXImport in '..\Source\Physics.PhysXImport.pas',
-  Physics.NGDImport in '..\Source\Physics.NGDImport.pas',
-  Physics.NGDManager in '..\Source\Physics.NGDManager.pas',
-  Physics.NewtonImport in '..\Source\Physics.NewtonImport.pas',
-  Physics.NGDRagdoll in '..\Source\Physics.NGDRagdoll.pas';
+  Physics.SPIFields in '..\Source\Physics.SPIFields.pas',
+  Physics.SPIForces in '..\Source\Physics.SPIForces.pas',
+  Physics.SPIInertias in '..\Source\Physics.SPIInertias.pas',
+  Physics.SPIJoints in '..\Source\Physics.SPIJoints.pas',
+  Physics.SPIManager in '..\Source\Physics.SPIManager.pas',
+  Physics.PhysXImport in '..\Source\Physics.PhysXImport.pas';
 
 
 end.
 end.
 
 

+ 9 - 7
Packages/GLScene_Physics_RT.dproj

@@ -145,19 +145,21 @@
         <DCCReference Include="rtl.dcp"/>
         <DCCReference Include="rtl.dcp"/>
         <DCCReference Include="vcl.dcp"/>
         <DCCReference Include="vcl.dcp"/>
         <DCCReference Include="GLScene_RT.dcp"/>
         <DCCReference Include="GLScene_RT.dcp"/>
+        <DCCReference Include="..\Source\Physics.NewtonImport.pas"/>
+        <DCCReference Include="..\Source\Physics.NGDManager.pas"/>
+        <DCCReference Include="..\Source\Physics.NGDRagdoll.pas"/>
+        <DCCReference Include="..\Source\Physics.NGDImport.pas"/>
         <DCCReference Include="..\Source\Physics.ODEImport.pas"/>
         <DCCReference Include="..\Source\Physics.ODEImport.pas"/>
         <DCCReference Include="..\Source\Physics.ODEManager.pas"/>
         <DCCReference Include="..\Source\Physics.ODEManager.pas"/>
         <DCCReference Include="..\Source\Physics.ODERagdoll.pas"/>
         <DCCReference Include="..\Source\Physics.ODERagdoll.pas"/>
         <DCCReference Include="..\Source\Physics.ODESkeletonColliders.pas"/>
         <DCCReference Include="..\Source\Physics.ODESkeletonColliders.pas"/>
         <DCCReference Include="..\Source\Physics.ODEUtils.pas"/>
         <DCCReference Include="..\Source\Physics.ODEUtils.pas"/>
-        <DCCReference Include="..\Source\Physics.GLxInertias.pas"/>
-        <DCCReference Include="..\Source\Physics.GLxJoints.pas"/>
-        <DCCReference Include="..\Source\Physics.GLxManager.pas"/>
+        <DCCReference Include="..\Source\Physics.SPIFields.pas"/>
+        <DCCReference Include="..\Source\Physics.SPIForces.pas"/>
+        <DCCReference Include="..\Source\Physics.SPIInertias.pas"/>
+        <DCCReference Include="..\Source\Physics.SPIJoints.pas"/>
+        <DCCReference Include="..\Source\Physics.SPIManager.pas"/>
         <DCCReference Include="..\Source\Physics.PhysXImport.pas"/>
         <DCCReference Include="..\Source\Physics.PhysXImport.pas"/>
-        <DCCReference Include="..\Source\Physics.NGDImport.pas"/>
-        <DCCReference Include="..\Source\Physics.NGDManager.pas"/>
-        <DCCReference Include="..\Source\Physics.NewtonImport.pas"/>
-        <DCCReference Include="..\Source\Physics.NGDRagdoll.pas"/>
         <BuildConfiguration Include="Base">
         <BuildConfiguration Include="Base">
             <Key>Base</Key>
             <Key>Base</Key>
         </BuildConfiguration>
         </BuildConfiguration>

+ 0 - 1583
Source/Physics.GLxManager.pas

@@ -1,1583 +0,0 @@
-//
-// The graphics platform GLScene https://github.com/glscene
-//
-unit Physics.GLxManager;
-
-(* The GLxManager for GLScene Physics *)
-
-interface
-
-uses
-  System.Classes,
-  System.SysUtils,
-  Vcl.Dialogs,
-
-  GLS.VectorTypesExt,
-  GLS.VectorGeometry,
-  GLS.Scene,
-  GLS.Coordinates,
-  GLS.XCollection,
-
-  GLS.Behaviours;
-
-type
-  TGLxForce = class;
-  TGLxForceType = (ftHookes, ftGravitation, ftCustom);
-
-  TGLxOnCustomForce = procedure() of object;
-
-  TGLxForces = class;
-  TGLxBaseForceFieldEmitter = class;
-
-  // only ssEuler is usable at the moment
-  TGLxSolverType = (ssEuler, ssRungeKutta4, ssVerlet);
-  // TGLxSolver = procedure((*RigidBody:TGLRigidBody;*)DeltaTime:Real) of object;
-  TGLxManager = class;
-
-  (*
-    ***Euler***, EulerImproved, EulerModified, MidPoint
-    RungeKutta2, ***RungeKutta4***, RungKutta4Adaptive
-    State Variables:  Position,  Velocity
-
-    Verlet
-    State Variables:  Position, Old Position
-  *)
-
-  // need to have state array(s) seperate from inertias to allow for implicit & explicit methods
-  TGLxSolver = class(TObject)
-  public
-    StateSize: Integer;
-    StateArray: TDoubleArray;
-    Owner: TGLxManager;
-    function StateToArray(): TDoubleArray; virtual;
-    procedure ArrayToState(StateArray: TDoubleArray); virtual;
-    procedure Solve(DeltaTime: Real); virtual; abstract;
-    constructor Create(aOwner: TGLxManager); // override; //abstract;
-    destructor Destroy; override;
-    // procedure Assign(Source: TPersistent); override;
-  end;
-
-  // explicit   e.g. Euler, Mid-point, Runge-Kutta integration
-  TGLxSolverExplicit = class(TGLxSolver)
-  public
-    StateArrayDot: TDoubleArray; // Velocity stored
-    function CalcStateDot(): TDoubleArray; virtual;
-  end;
-
-  TGLxSolverEuler = class(TGLxSolverExplicit)
-  public
-    procedure Solve(DeltaTime: Real); override;
-  end;
-
-  TGLxSolverRungeKutta4 = class(TGLxSolverExplicit)
-  public
-    procedure Solve(DeltaTime: Real); override;
-  end;
-
-  // implicit   e.g. Verlet Integration
-  TGLxSolverImplicit = class(TGLxSolver)
-  public
-    LastStateArray: TDoubleArray; // Last state stored
-  end;
-
-  TGLxSolverVerlet = class(TGLxSolverImplicit)
-  public
-  end;
-
-  (* purpose of TGLxBaseInertia is to allow for inertias that may be constrained
-    to 1 or 2 dimensions
-    Shouldn't be used directly, instead use TGLParticleInertia (for a 3D particle)
-    TGLRigidBodyInertia (for a 3D rigid-body) or define a new sub-class
-    e.g.  TGL1DParticleInertia, this will allow for faster speed *)
-  TGLxBaseInertia = class(TGLBehaviour)
-  private
-    FDampingEnabled: Boolean;
-    FManager: TGLxManager;
-    FManagerName: String; // NOT persistent, temporarily used for persistence
-  protected
-    procedure Loaded; override;
-    procedure WriteToFiler(writer: TWriter); override;
-    procedure ReadFromFiler(reader: TReader); override;
-  public
-    StateSize: Integer; // don't re-declare this in sub-classes
-    // just initialise it in constructor
-    procedure StateToArray(var StateArray: TDoubleArray; StatePos: Integer); virtual;
-    procedure ArrayToState( { var } StateArray: TDoubleArray; StatePos: Integer); virtual;
-    procedure CalcStateDot(var StateArray: TDoubleArray; StatePos: Integer); virtual;
-    procedure RemoveForces(); virtual;
-    procedure CalculateForceFieldForce(ForceFieldEmitter: TGLxBaseForceFieldEmitter); virtual;
-    procedure CalcAuxiliary(); virtual;
-    procedure SetUpStartingState(); virtual;
-    function CalculateKE(): Real; virtual;
-    function CalculatePE(): Real; virtual;
-    constructor Create(aOwner: TXCollection); override; // abstract;
-    destructor Destroy; override;
-    procedure Assign(Source: TPersistent); override;
-    procedure SetManager(const val: TGLxManager);
-  published
-    property DampingEnabled: Boolean read FDampingEnabled write FDampingEnabled;
-    property Manager: TGLxManager read FManager write SetManager;
-  end;
-
-  (* A base for different types of force-field behaviours *)
-  TGLxBaseForceFieldEmitter = class(TGLBehaviour)
-  private
-    FManager: TGLxManager;
-    FManagerName: String; // NOT persistent, temporarily used for persistence
-  protected
-    procedure Loaded; override;
-    procedure WriteToFiler(writer: TWriter); override;
-    procedure ReadFromFiler(reader: TReader); override;
-  public
-    constructor Create(aOwner: TXCollection); override; // abstract;
-    destructor Destroy; override;
-    procedure Assign(Source: TPersistent); override;
-    procedure SetManager(const val: TGLxManager);
-    function CalculateForceField(Body: TGLBaseSceneObject): TAffineVector; virtual;
-  published
-    property Manager: TGLxManager read FManager write SetManager;
-  end;
-
-  TGLxUniformGravityEmitter = class(TGLxBaseForceFieldEmitter)
-  private
-    fGravity: TGLCoordinates;
-  protected
-    procedure SetGravity(const val: TGLCoordinates);
-  public
-    constructor Create(aOwner: TXCollection); override;
-    destructor Destroy; override;
-    procedure Assign(Source: TPersistent); override;
-    procedure WriteToFiler(writer: TWriter); override;
-    procedure ReadFromFiler(reader: TReader); override;
-    class function FriendlyName: String; override;
-    class function FriendlyDescription: String; override;
-    class function UniqueItem: Boolean; override;
-    function CalculateForceField(Body: TGLBaseSceneObject)
-      : TAffineVector; override;
-  published
-    property Gravity: TGLCoordinates read fGravity write SetGravity;
-  end;
-
-  TGLxRadialGravityEmitter = class(TGLxBaseForceFieldEmitter)
-  private
-    fMass: Real;
-    fMassOverG: Real;
-  public
-    constructor Create(aOwner: TXCollection); override;
-    destructor Destroy; override;
-    procedure Assign(Source: TPersistent); override;
-    procedure WriteToFiler(writer: TWriter); override;
-    procedure ReadFromFiler(reader: TReader); override;
-    class function FriendlyName: String; override;
-    class function FriendlyDescription: String; override;
-    class function UniqueItem: Boolean; override;
-    function CalculateForceField(Body: TGLBaseSceneObject)
-      : TAffineVector; override;
-  published
-    property Mass: Real read fMass write fMass;
-  end;
-
-  TGLxDampingFieldEmitter = class(TGLxBaseForceFieldEmitter)
-  private
-    fDamping: TGLDamping;
-  protected
-    procedure SetDamping(const val: TGLDamping);
-  public
-    constructor Create(aOwner: TXCollection); override;
-    destructor Destroy; override;
-    procedure Assign(Source: TPersistent); override;
-    procedure WriteToFiler(writer: TWriter); override;
-    procedure ReadFromFiler(reader: TReader); override;
-    class function FriendlyName: String; override;
-    class function FriendlyDescription: String; override;
-    class function UniqueItem: Boolean; override;
-    function CalculateForceField(Body: TGLBaseSceneObject)
-      : TAffineVector; override;
-  published
-    property Damping: TGLDamping read fDamping write SetDamping;
-  end;
-
-  (* The Simple Physics Interaction (SPI) manager can only deal with objects from one scene
-    More than one physics manager can be assigned to a scene *)
-  TGLxManager = class(TComponent)
-    // StateSize:Integer;
-  protected
-    fInertias: TList; // list of all inertias with manager = self
-    fForceFieldEmitters: TList; // list of all forcefield emitters
-    fForces: TGLxForces; // Collection of forces acting on/between objects
-    fDESolverType: TGLxSolverType;
-    DESolver: TGLxSolver;
-    fScene: TGLScene;
-  protected
-    procedure Loaded; override;
-    procedure DefineProperties(Filer: TFiler); override;
-    procedure WriteForces(stream: TStream);
-    procedure ReadForces(stream: TStream);
-    procedure SetForces(const val: TGLxForces);
-    function GetForces: TGLxForces;
-    procedure SetInertias(const val: TList);
-    procedure SetForceFieldEmitters(const val: TList);
-    procedure SetScene(const val: TGLScene);
-  public
-    procedure RegisterInertia(aInertia: TGLxBaseInertia);
-    procedure DeRegisterInertia(aInertia: TGLxBaseInertia);
-    procedure DeRegisterAllInertias;
-    procedure RegisterForceFieldEmitter(aForceField: TGLxBaseForceFieldEmitter);
-    procedure DeRegisterForceFieldEmitter(aForceField: TGLxBaseForceFieldEmitter);
-    procedure DeRegisterAllForceFieldEmitters;
-    procedure Notification(AComponent: TComponent; Operation: TOperation); override;
-    constructor Create(aOwner: TComponent); override;
-    destructor Destroy; override;
-    procedure Assign(Source: TPersistent); override;
-    procedure CalculateNextState(DeltaTime: Real);
-    function CalculateKE(): Real;
-    function CalculatePE(): Real;
-    procedure SetDESolver(SolverType: TGLxSolverType);
-    function FindObjectByName(Name: String): TGLBaseSceneObject;
-    function FindForceFieldEmitterByName(Name: String): TGLBaseSceneObject;
-    property Inertias: TList read fInertias write SetInertias; // stored False;
-    property ForceFieldEmitters: TList read fForceFieldEmitters write SetForceFieldEmitters;
-    // stored False;
-  published
-    property Forces: TGLxForces read GetForces write SetForces; // stored False;
-    property Solver: TGLxSolverType read fDESolverType write SetDESolver;
-    property Scene: TGLScene read fScene write SetScene;
-  end;
-
-   TGLxForce = class(TXCollectionItem)
-  private
-    fObject1: TGLBaseSceneObject;
-    fObject2: TGLBaseSceneObject;
-    fposition1: TGLCoordinates;
-    fposition2: TGLCoordinates;
-    object1Name: String;
-    object2Name: String;
-    // fOnCustomForce: TGLxOnCustomForce;
-  protected
-    procedure Loaded; override;
-    procedure SetName(const val: String); override;
-    (* Returns the TGLBaseSceneObject on which the behaviour should be applied.
-      Does NOT check for nil owners *)
-    // function OwnerBaseSceneObject : TGLBaseSceneObject;
-  public
-    (* constructor Create(Collection: TCollection);override; *)
-    // Override this function to write subclass data.
-    procedure WriteToFiler(writer: TWriter); override;
-    // Override this function to read subclass data.
-    procedure ReadFromFiler(reader: TReader); override;
-    constructor Create(aOwner: TXCollection); override;
-    destructor Destroy; override;
-    procedure Assign(Source: TPersistent); override;
-    class function FriendlyName: String; override;
-    class function FriendlyDescription: String; override;
-    class function UniqueItem: Boolean; override;
-    procedure SetObject1(const val: TGLBaseSceneObject);
-    procedure SetObject2(const val: TGLBaseSceneObject);
-    procedure SetPosition1(const val: TGLCoordinates);
-    procedure SetPosition2(const val: TGLCoordinates);
-    function CalculateForce(): TAffineVector; virtual;
-  published
-    property Object1: TGLBaseSceneObject read fObject1 write SetObject1;
-    property Object2: TGLBaseSceneObject read fObject2 write SetObject2;
-    property Position1: TGLCoordinates read fposition1 write SetPosition1;
-    property Position2: TGLCoordinates read fposition2 write SetPosition2;
-    // property OnCustomForce:TGLxOnCustomForce read fOnCustomForce write fOnCustomForce;
-  end;
-
-  TGLxHookSpring = class(TGLxForce)
-  private
-    fNaturalLength: Real;
-    fElasticity: Real;
-    fLength: Real;
-    fExtension: Real;
-    fDamping: TGLDamping;
-  public
-    procedure WriteToFiler(writer: TWriter); override;
-    procedure ReadFromFiler(reader: TReader); override;
-    constructor Create(aOwner: TXCollection); override;
-    destructor Destroy; override;
-    class function FriendlyName: String; override;
-    class function FriendlyDescription: String; override;
-    class function UniqueItem: Boolean; override;
-    procedure SetDamping(const val: TGLDamping);
-    function CalculateForce(): TAffineVector; override;
-  published
-    property NaturalLength: Real read fNaturalLength write fNaturalLength;
-    property Elasticity: Real read fElasticity write fElasticity;
-    property Damping: TGLDamping read fDamping write SetDamping;
-    // property Name;
-  end;
-
-  TGLxHookStrings = class(TGLxHookSpring)
-  protected
-    // procedure WriteToFiler(writer : TWriter); override;
-    // procedure ReadFromFiler(reader : TReader); override;
-  public
-    constructor Create(aOwner: TXCollection); override;
-    destructor Destroy; override;
-    class function FriendlyName: String; override;
-    class function FriendlyDescription: String; override;
-    class function UniqueItem: Boolean; override;
-    function CalculateForce(): TAffineVector; override;
-  end;
-
-
-
-  TGLxForces = class(TXCollection)
-  protected
-    function GetForce(index: Integer): TGLxForce;
-  public
-    constructor Create(aOwner: TPersistent); override;
-    // destructor Destroy;override;
-    class function ItemsClass: TXCollectionItemClass; override;
-    property Force[index: Integer]: TGLxForce read GetForce; default;
-    function CanAdd(aClass: TXCollectionItemClass): Boolean; override;
-  end;
-
-
-const
-  GravitationalConstant = 6.6726E-11;
-
-// ------------------------------------------------------------------
-implementation
-// ------------------------------------------------------------------
-
-uses
-  Physics.GLxInertias;
-
-
-// ------------------------------------------------------------------
-// ------------------------TGLxSolver--------------------------------
-// ------------------------------------------------------------------
-
-// Not accurate yet, because Forces should be re-calculated for each KVector.
-// Since forces will depend on distances between objects, then this will require
-// a central physics manager, that calculates KVector for all objects, then calculate forces
-// between objects for this new estimated state.
-function TGLxSolver.StateToArray(): TDoubleArray;
-var
-  i { ,j } : Integer;
-  currentpos: Integer;
-begin
-  currentpos := 0;
-  for i := 0 to Owner.fInertias.Count - 1 do
-  begin
-    TGLxBaseInertia(Owner.fInertias.Items[i]).StateToArray(StateArray, currentpos);
-    currentpos := currentpos + TGLxBaseInertia(Owner.fInertias.Items[i]).StateSize;
-  end;
-  Result := StateArray;
-end;
-
-procedure TGLxSolver.ArrayToState(StateArray: TDoubleArray);
-var
-  i: Integer;
-  currentpos: Integer;
-begin
-  currentpos := 0;
-  for i := 0 to Owner.fInertias.Count - 1 do
-  begin
-    TGLxBaseInertia(Owner.fInertias.Items[i]).ArrayToState(StateArray, currentpos);
-    currentpos := currentpos + TGLxBaseInertia(Owner.fInertias.Items[i]).StateSize;
-  end;
-end;
-
-constructor TGLxSolver.Create(aOwner: TGLxManager);
-begin
-  Self.Owner := aOwner;
-end;
-
-destructor TGLxSolver.Destroy;
-begin
-  //
-end;
-
-
-// -------------------------------------------------------------------
-// ------------------------TGLxManager--------------------------------
-// -------------------------------------------------------------------
-
-constructor TGLxManager.Create(aOwner: TComponent);
-begin
-  inherited Create(aOwner);
-  fInertias := TList.Create();
-  fForceFieldEmitters := TList.Create();
-  fForces := TGLxForces.Create(Self);
-  SetDESolver(ssEuler);
-  /// RegisterManager(Self);
-end;
-
-procedure TGLxManager.Notification(AComponent: TComponent; Operation: TOperation);
-begin
-  (*
-  if Operation=opRemove then
-  begin
-    if AComponent=FScene then FScene:=nil;
-  end;
-  *)
-end;
-
-procedure TGLxManager.DefineProperties(Filer: TFiler);
-begin
-  inherited DefineProperties(Filer);
-  Filer.DefineBinaryProperty('ForcesData', ReadForces, WriteForces,
-    (Assigned(fForces) and (fForces.Count > 0)));
-end;
-
-procedure TGLxManager.Loaded;
-begin
-  inherited Loaded;
-  if Assigned(fForces) then
-    fForces.Loaded;
-end;
-
-function TGLxManager.FindObjectByName(Name: String): TGLBaseSceneObject;
-var
-  i: Integer;
-begin
-  Result := nil;
-  for i := 0 to fInertias.Count - 1 do
-  begin
-    if (TGLxBaseInertia(fInertias.Items[i]).OwnerBaseSceneObject.GetNamePath = Name) then
-    begin
-      Result := TGLxBaseInertia(fInertias.Items[i]).OwnerBaseSceneObject;
-    end
-    else if Owner.FindComponent(Name) <> nil then
-    begin
-      Result := TGLBaseSceneObject(Owner.FindComponent(Name));
-    end;
-  end;
-end;
-
-function TGLxManager.FindForceFieldEmitterByName(Name: String): TGLBaseSceneObject;
-var
-  i: Integer;
-begin
-  Result := nil;
-  for i := 0 to fForceFieldEmitters.Count - 1 do
-  begin
-    if (TGLxBaseForceFieldEmitter(fForceFieldEmitters.Items[i])
-      .OwnerBaseSceneObject.GetNamePath = Name) then
-    begin
-      Result := TGLxBaseForceFieldEmitter(fForceFieldEmitters.Items[i]).OwnerBaseSceneObject;
-    end;
-  end;
-end;
-
-procedure TGLxManager.WriteForces(stream: TStream);
-var
-  writer: TWriter;
-begin
-  // messagedlg('Writing forces',mtInformation,[mbOk],0);
-  writer := TWriter.Create(stream, 16384);
-  try
-    Forces.WriteToFiler(writer);
-  finally
-    writer.Free;
-  end;
-end;
-
-procedure TGLxManager.ReadForces(stream: TStream);
-var
-  reader: TReader;
-begin
-  reader := TReader.Create(stream, 16384);
-  try
-    Forces.ReadFromFiler(reader);
-  finally
-    reader.Free;
-  end;
-end;
-
-procedure TGLxManager.SetForces(const val: TGLxForces);
-begin
-  Forces.Assign(val);
-end;
-
-procedure TGLxManager.SetInertias(const val: TList);
-begin
-  fInertias.Assign(val);
-end;
-
-procedure TGLxManager.SetForceFieldEmitters(const val: TList);
-begin
-  fForceFieldEmitters.Assign(val);
-end;
-
-procedure TGLxManager.SetScene(const val: TGLScene);
-begin
-  // fScene:=val;
-  if fScene <> val then
-  begin
-    if Assigned(fScene) then
-      fScene.RemoveFreeNotification(Self);
-    fScene := val;
-    if Assigned(fScene) then
-      fScene.FreeNotification(Self);
-  end;
-end;
-
-function TGLxManager.GetForces: TGLxForces;
-begin
-  if not Assigned(fForces) then
-    fForces := TGLxForces.Create(Self);
-  Result := fForces;
-end;
-
-destructor TGLxManager.Destroy;
-begin
-  // fScene:=nil;
-  DeRegisterAllInertias();
-  DeRegisterAllForceFieldEmitters();
-  /// DeRegisterManager(Self);
-  fInertias.Free();
-  fForceFieldEmitters.Free();
-  fForces.Free();
-  inherited Destroy;
-end;
-
-procedure TGLxManager.Assign(Source: TPersistent);
-begin
-  inherited Assign(Source);
-end;
-
-procedure TGLxManager.SetDESolver(SolverType: TGLxSolverType);
-var
-  tempSolver: TGLxSolver;
-begin
-  if Assigned(DESolver) then
-  begin
-    if (fDESolverType <> SolverType) then
-      case SolverType of
-        ssRungeKutta4:
-          begin
-            // DESolver:=RungeKutta4;
-          end;
-        ssEuler:
-          begin
-            // DESolver:=Euler;
-          end;
-      end;
-  end
-  else
-  begin
-    // if (fDESolverType<>SolverType) then
-    case SolverType of
-      ssRungeKutta4:
-        begin
-          DESolver := TGLxSolverRungeKutta4.Create(Self);
-        end;
-      ssEuler:
-        begin
-          DESolver := TGLxSolverEuler.Create(Self);
-        end;
-    end;
-    fDESolverType := SolverType;
-  end;
-end;
-
-procedure TGLxManager.RegisterInertia(aInertia: TGLxBaseInertia);
-begin
-  if Assigned(aInertia) then
-    if fInertias.IndexOf(aInertia) < 0 then
-    begin
-      fInertias.Add(aInertia);
-      aInertia.FManager := Self;
-      DESolver.StateSize := DESolver.StateSize + aInertia.StateSize;
-      SetLength(DESolver.StateArray, DESolver.StateSize);
-    end;
-end;
-
-procedure TGLxManager.DeRegisterInertia(aInertia: TGLxBaseInertia);
-begin
-  if Assigned(aInertia) then
-  begin
-    aInertia.FManager := nil;
-    fInertias.Remove(aInertia);
-    DESolver.StateSize := DESolver.StateSize - aInertia.StateSize;
-    SetLength(DESolver.StateArray, DESolver.StateSize);
-  end;
-end;
-
-procedure TGLxManager.DeRegisterAllInertias;
-var
-  i: Integer;
-begin
-  // Fast deregistration
-  for i := 0 to fInertias.Count - 1 do
-    TGLxBaseInertia(fInertias[i]).FManager := nil;
-  fInertias.Clear;
-  DESolver.StateSize := 0;
-  // SetLEngth(StateArray,0);
-end;
-
-procedure TGLxManager.RegisterForceFieldEmitter(aForceField: TGLxBaseForceFieldEmitter);
-begin
-  if Assigned(aForceField) then
-    if fForceFieldEmitters.IndexOf(aForceField) < 0 then
-    begin
-      fForceFieldEmitters.Add(aForceField);
-      aForceField.FManager := Self;
-    end;
-end;
-
-procedure TGLxManager.DeRegisterForceFieldEmitter(aForceField: TGLxBaseForceFieldEmitter);
-begin
-  if Assigned(aForceField) then
-  begin
-    aForceField.FManager := nil;
-    fForceFieldEmitters.Remove(aForceField);
-  end;
-end;
-
-procedure TGLxManager.DeRegisterAllForceFieldEmitters;
-var
-  i: Integer;
-begin
-  // Fast deregistration
-  for i := 0 to fForceFieldEmitters.Count - 1 do
-    TGLxBaseForceFieldEmitter(fForceFieldEmitters[i]).FManager := nil;
-  fForceFieldEmitters.Clear;
-end;
-
-function TGLxManager.CalculateKE(): Real;
-var
-  Total: Real;
-  i: Integer;
-begin
-  Total := 0;
-  for i := 0 to fInertias.Count - 1 do
-  begin
-    // calculate fInertias[i] KE
-    Total := Total + TGLxBaseInertia(fInertias.Items[i]).CalculateKE();
-  end;
-  Result := Total;
-end;
-
-function TGLxManager.CalculatePE(): Real;
-var
-  Total: Real;
-  i: Integer;
-begin
-  Total := 0;
-  for i := 0 to fInertias.Count - 1 do
-  begin
-    // calculate fobject[i] PE
-    Total := Total + TGLxBaseInertia(fInertias.Items[i]).CalculatePE();
-  end;
-  Result := Total;
-end;
-
-procedure TGLxManager.CalculateNextState(DeltaTime: Real);
-begin
-  if Assigned(DESolver) then
-    DESolver.Solve(DeltaTime);
-end;
-
-
-function TGLxSolverExplicit.CalcStateDot(): TDoubleArray;
-var
-  i { ,j } : Integer;
-  currentpos: Integer;
-  state: TDoubleArray;
-begin
-  //
-  SetLength(state, StateSize);
-  for i := 0 to StateSize - 1 do
-    state[i] := StateArray[i];
-  // state:=StateArray;
-  currentpos := 0;
-  for i := 0 to Owner.fInertias.Count - 1 do
-  begin
-    TGLxBaseInertia(Owner.fInertias.Items[i]).CalcStateDot(state, currentpos);
-    currentpos := currentpos + TGLxBaseInertia(Owner.fInertias.Items[i]).StateSize;
-  end;
-  Result := state;
-end;
-
-procedure TGLxSolverRungeKutta4.Solve(DeltaTime: Real);
-var
-  // X,X0:TDoubleArray;
-  Kvectors: array [0 .. 3] of TDoubleArray;
-  n: Integer;
-  StateArray0: TDoubleArray;
-  tempStateArray: TDoubleArray;
-  // tempState:TGLBInertia;
-begin
-  // tempState:=TGLBInertia.Create(nil);
-  // tempState.Assign(Self);
-  tempStateArray := StateToArray();
-  StateArray0 := tempStateArray;
-
-  for n := 0 to 3 do
-    SetLength(Kvectors[n], Length(StateArray0));
-
-  Kvectors[0] := CalcStateDot();
-  for n := 0 to StateSize - 1 do
-    tempStateArray[n] := tempStateArray[n] + DeltaTime / 2 * Kvectors[0][n];
-  ArrayToState(tempStateArray);
-
-  Kvectors[1] := CalcStateDot();
-  for n := 0 to StateSize - 1 do
-    tempStateArray[n] := tempStateArray[n] + DeltaTime / 2 * Kvectors[1][n];
-  ArrayToState(tempStateArray);
-
-  Kvectors[2] := CalcStateDot();
-  for n := 0 to StateSize - 1 do
-    tempStateArray[n] := tempStateArray[n] + DeltaTime / 2 * Kvectors[2][n];
-  ArrayToState(tempStateArray);
-
-  Kvectors[3] := CalcStateDot();
-
-  for n := 0 to StateSize - 1 do
-  begin
-    tempStateArray[n] := StateArray0[n] + DeltaTime / 6 *
-      (Kvectors[0][n] + 2 * Kvectors[1][n] + 2 * Kvectors[2][n] + Kvectors[3][n]);
-  end;
-  ArrayToState(tempStateArray);
-  // NormalizeQuaternion(AngularOrientation);
-  // tempState.Free();
-end;
-
-procedure TGLxSolverEuler.Solve(DeltaTime: Real);
-var
-  i, j: Integer;
-  tempState, tempStateDot: TDoubleArray;
-  // force1:TAffineVector;
-  Inertia1: TGLxBaseInertia;
-  tempForce: TAffineVector;
-  // UnDampedMomentum,DampedMomentum:Real;
-begin
-{$IFDEF DEBUG}
-  messagedlg('Euler integration', mtinformation, [mbok], 0);
-{$ENDIF}
-  for i := 0 to Owner.fInertias.Count - 1 do
-  begin
-    Inertia1 := TGLxBaseInertia(Owner.fInertias.Items[i]);
-    // TGLRigidBodyInertia(FObjects.Items[i]).SetTorque(0,0,0);
-    for j := 0 to Owner.fForceFieldEmitters.Count - 1 do
-    begin
-      Inertia1.CalculateForceFieldForce
-        (TGLxBaseForceFieldEmitter(Owner.fForceFieldEmitters.Items[j]));
-      // Inertia1.ApplyForce(TGLForceFieldEmitter(FForceFieldEmitters.Items[j]).CalculateForceField(Inertia1.OwnerBaseSceneObject));
-    end;
-  end;
-
-  for i := 0 to Owner.Forces.Count - 1 do
-  begin
-    { force1:= } Owner.Forces.Force[i].CalculateForce();
-  end;
-  tempState := StateToArray();
-  tempStateDot := CalcStateDot();
-  for i := 0 to StateSize - 1 do
-    tempState[i] := tempState[i] + DeltaTime * tempStateDot[i];
-  ArrayToState(tempState);
-  for i := 0 to Owner.fInertias.Count - 1 do
-  begin
-    // TGLInertia(FObjects.Items[i]).SetForce(0,0,0);
-    Inertia1 := TGLxBaseInertia(Owner.fInertias.Items[i]);
-    if Inertia1.DampingEnabled = true then
-    begin
-      // UnDampedMomentum:=VectorLength(Inertia1.TranslationSpeed.AsAffineVector);
-      // DampedMomentum:= Inertia1.TranslationDamping.Calculate(UnDampedMomentum,deltaTime);
-      // if  UnDampedMomentum<>0 then
-      begin
-        // ScaleVector(Inertia1.TranslationSpeed.AsAffineVector,DampedMomentum/UnDampedMomentum);
-        // ScaleVector(Inertia1.LinearMomentum,DampedMomentum/UnDampedMomentum);
-      end;
-      // Inertia1.TranslationDamping.Calculate(VectorLength(Inertia1.LinearMomentum),deltaTime);
-    end;
-    Inertia1.CalcAuxiliary();
-    Inertia1.RemoveForces();
-  end;
-  // NormalizeQuaternion(AngularOrientation);
-end;
-
-
-// -------------------------------------------------------------------
-// ------------------------TGLxForces---------------------------------
-// -------------------------------------------------------------------
-constructor TGLxForces.Create(aOwner: TPersistent);
-begin
-  // Assert(aOwner is TGLBaseSceneObject);
-  inherited Create(aOwner);
-end;
-
-class function TGLxForces.ItemsClass: TXCollectionItemClass;
-begin
-  Result := TGLxForce;
-end;
-
-function TGLxForces.GetForce(index: Integer): TGLxForce;
-begin
-  Result := TGLxForce(Items[index]);
-end;
-
-function TGLxForces.CanAdd(aClass: TXCollectionItemClass): Boolean;
-begin
-  Result := { (not aClass.InheritsFrom(TGLEffect)) and }
-    (inherited CanAdd(aClass));
-end;
-
-// -------------------------------------------------------------------
-// ------------------------TGLxBaseInertia----------------------------
-// -------------------------------------------------------------------
-procedure TGLxBaseInertia.SetManager(const val: TGLxManager);
-begin
-  if val <> FManager then
-  begin
-    if Assigned(FManager) then
-      FManager.DeRegisterInertia(Self);
-    if Assigned(val) then
-      val.RegisterInertia(Self);
-    // messagedlg(val.GetNamePath,mtinformation,[mbok],0);
-  end;
-end;
-
-procedure TGLxBaseInertia.Loaded;
-var
-  mng: TComponent;
-begin
-  inherited;
-  if FManagerName <> '' then
-  begin
-    /// ?    mng := FindManager(TGLxManager, FManagerName);
-    if Assigned(mng) then
-      Manager := TGLxManager(mng);
-    FManagerName := '';
-  end;
-end;
-
-procedure TGLxBaseInertia.WriteToFiler(writer: TWriter);
-begin
-  inherited; // Dan Bartlett
-  with writer do
-  begin
-    WriteInteger(0); // Archive Version 0
-    WriteBoolean(FDampingEnabled);
-    if Assigned(FManager) then
-      WriteString(FManager.GetNamePath)
-    else
-      WriteString('');
-  end;
-end;
-
-procedure TGLxBaseInertia.ReadFromFiler(reader: TReader);
-begin
-  inherited;
-  with reader do
-  begin
-    ReadInteger; // ignore archiveVersion
-    FDampingEnabled := ReadBoolean;
-    FManagerName := ReadString;
-    Manager := nil;
-  end;
-  // Loaded;     //DB100
-end;
-
-constructor TGLxBaseInertia.Create(aOwner: TXCollection);
-begin
-  inherited Create(aOwner);
-  FDampingEnabled := true;
-end;
-
-destructor TGLxBaseInertia.Destroy;
-begin
-  SetManager(nil);
-  inherited Destroy;
-end;
-
-procedure TGLxBaseInertia.Assign(Source: TPersistent);
-begin
-  if Source.ClassType = Self.ClassType then
-  begin
-    StateSize := TGLxBaseInertia(Source).StateSize;
-    FDampingEnabled := TGLxBaseInertia(Source).DampingEnabled;
-    Manager := TGLxBaseInertia(Source).Manager;
-  end;
-  inherited Assign(Source);
-end;
-
-procedure TGLxBaseInertia.StateToArray(var StateArray: TDoubleArray; StatePos: Integer);
-begin
-end;
-
-procedure TGLxBaseInertia.ArrayToState( { var } StateArray: TDoubleArray; StatePos: Integer);
-begin
-end;
-
-procedure TGLxBaseInertia.CalcStateDot(var StateArray: TDoubleArray; StatePos: Integer);
-begin
-end;
-
-procedure TGLxBaseInertia.RemoveForces();
-begin
-end;
-
-procedure TGLxBaseInertia.CalculateForceFieldForce(ForceFieldEmitter: TGLxBaseForceFieldEmitter);
-begin
-end;
-
-function TGLxBaseInertia.CalculateKE(): Real;
-begin
-  Result := 0;
-end;
-
-function TGLxBaseInertia.CalculatePE(): Real;
-begin
-  Result := 0;
-end;
-
-procedure TGLxBaseInertia.CalcAuxiliary();
-begin
-end;
-
-procedure TGLxBaseInertia.SetUpStartingState();
-begin
-end;
-
-// -------------------------------------------------------------------
-// ------------------------TGLxBaseForceFieldEmitter------------------
-// -------------------------------------------------------------------
-
-procedure TGLxBaseForceFieldEmitter.SetManager(const val: TGLxManager);
-begin
-  if val <> FManager then
-  begin
-    if Assigned(FManager) then
-      FManager.DeRegisterForceFieldEmitter(Self);
-    if Assigned(val) then
-      val.RegisterForceFieldEmitter(Self);
-  end;
-end;
-
-procedure TGLxBaseForceFieldEmitter.Loaded;
-var
-  mng: TComponent;
-begin
-  inherited;
-  if FManagerName <> '' then
-  begin
-    /// ?    mng := FindManager(TGLxManager, FManagerName);
-    if Assigned(mng) then
-      Manager := TGLxManager(mng);
-    FManagerName := '';
-  end;
-end;
-
-procedure TGLxBaseForceFieldEmitter.WriteToFiler(writer: TWriter);
-begin
-  inherited; // Dan Bartlett
-  with writer do
-  begin
-    WriteInteger(0); // Archive Version 0
-    if Assigned(FManager) then
-      WriteString(FManager.GetNamePath)
-    else
-      WriteString('');
-  end;
-end;
-
-procedure TGLxBaseForceFieldEmitter.ReadFromFiler(reader: TReader);
-begin
-  inherited;
-  with reader do
-  begin
-    ReadInteger; // ignore archiveVersion
-    FManagerName := ReadString;
-    Manager := nil;
-  end;
-  // Loaded;  //DB100
-end;
-
-constructor TGLxBaseForceFieldEmitter.Create(aOwner: TXCollection);
-begin
-  inherited Create(aOwner);
-end;
-
-destructor TGLxBaseForceFieldEmitter.Destroy;
-begin
-  SetManager(nil);
-  inherited Destroy;
-end;
-
-procedure TGLxBaseForceFieldEmitter.Assign(Source: TPersistent);
-begin
-  if Source.ClassType = Self.ClassType then
-  begin
-    Manager := TGLxBaseForceFieldEmitter(Source).Manager;
-  end;
-  inherited Assign(Source);
-end;
-
-// CalculateForceField
-function TGLxBaseForceFieldEmitter.CalculateForceField(Body: TGLBaseSceneObject): TAffineVector;
-begin
-  Result := nullVector;
-end;
-
-// -------------------------------------
-// ---- TGLxUniformGravityEmitter
-// -------------------------------------
-constructor TGLxUniformGravityEmitter.Create(aOwner: TXCollection);
-begin
-  inherited Create(aOwner);
-  fGravity := TGLCoordinates.CreateInitialized(Self, nullHmgVector, csVector);
-end;
-
-destructor TGLxUniformGravityEmitter.Destroy;
-begin
-  fGravity.Free;
-  inherited Destroy;
-end;
-
-procedure TGLxUniformGravityEmitter.Assign(Source: TPersistent);
-begin
-  if Source.ClassType = Self.ClassType then
-  begin
-    fGravity := TGLxUniformGravityEmitter(Source).fGravity;
-  end;
-end;
-
-class function TGLxUniformGravityEmitter.FriendlyName: String;
-begin
-  Result := 'Uniform Gravity';
-end;
-
-class function TGLxUniformGravityEmitter.FriendlyDescription: String;
-begin
-  Result := 'Uniform Gravity, appropriate near surface of planet';
-end;
-
-class function TGLxUniformGravityEmitter.UniqueItem: Boolean;
-begin
-  Result := false;
-end;
-
-procedure TGLxUniformGravityEmitter.WriteToFiler(writer: TWriter);
-begin
-  inherited;
-  with writer do
-  begin
-    fGravity.WriteToFiler(writer);
-  end;
-end;
-
-procedure TGLxUniformGravityEmitter.ReadFromFiler(reader: TReader);
-begin
-  inherited;
-  with reader do
-  begin
-    fGravity.ReadFromFiler(reader);
-  end;
-end;
-
-procedure TGLxUniformGravityEmitter.SetGravity(const val: TGLCoordinates);
-begin
-  fGravity.Assign(val);
-end;
-
-// CalculateForceField  (TODO: ParticleInertia -> BaseInertia, add BaseInertia.ApplyAcceleration)
-function TGLxUniformGravityEmitter.CalculateForceField(Body: TGLBaseSceneObject)
-  : TAffineVector;
-var
-  inertia1: TGLxParticleInertia;
-begin
-  inertia1 := TGLxParticleInertia
-    (Body.Behaviours.GetByClass(TGLxParticleInertia));
-  if Assigned(inertia1) then
-  begin
-    Result := VectorScale(fGravity.AsAffineVector, inertia1.Mass);
-    inertia1.ApplyForce(Result);
-  end
-  else
-    Result := nullVector;
-end;
-
-// ------------------------------------------------------------------------------
-// ------------------------------Radial Gravity Emitter -------------------------
-// ------------------------------------------------------------------------------
-
-constructor TGLxRadialGravityEmitter.Create(aOwner: TXCollection);
-begin
-  inherited Create(aOwner);
-end;
-
-destructor TGLxRadialGravityEmitter.Destroy;
-begin
-  inherited Destroy;
-end;
-
-procedure TGLxRadialGravityEmitter.Assign(Source: TPersistent);
-begin
-  if Source.ClassType = Self.ClassType then
-  begin
-    fMass := TGLxRadialGravityEmitter(Source).fMass;
-  end;
-end;
-
-class function TGLxRadialGravityEmitter.FriendlyName: String;
-begin
-  Result := 'Radial Gravity';
-end;
-
-class function TGLxRadialGravityEmitter.FriendlyDescription: String;
-begin
-  Result := 'Radial Gravity, can be applied anywhere (use for planets)';
-end;
-
-class function TGLxRadialGravityEmitter.UniqueItem: Boolean;
-begin
-  Result := false;
-end;
-
-procedure TGLxRadialGravityEmitter.WriteToFiler(writer: TWriter);
-begin
-  inherited;
-  with writer do
-  begin
-    WriteFloat(fMass);
-  end;
-end;
-
-procedure TGLxRadialGravityEmitter.ReadFromFiler(reader: TReader);
-begin
-  inherited;
-  with reader do
-  begin
-    fMass := ReadFloat();;
-  end;
-end;
-
-// CalculateForceField (TODO: ParticleInertia -> BaseInertia if possible)
-function TGLxRadialGravityEmitter.CalculateForceField(Body: TGLBaseSceneObject)
-  : TAffineVector;
-var
-  inertia1: TGLxParticleInertia;
-  R: TAffineVector;
-  L: Real;
-begin
-  inertia1 := TGLxParticleInertia
-    (Body.Behaviours.GetByClass(TGLxParticleInertia));
-  if Assigned(inertia1) then
-  begin
-    R := VectorSubtract(Body.Position.AsAffineVector,
-      Self.OwnerBaseSceneObject.Position.AsAffineVector);
-    L := VectorLength(R);
-    Result := VectorScale(R, -GravitationalConstant * (fMass / L));
-    inertia1.ApplyForce(Result);
-  end
-  else
-    Result := nullVector;
-end;
-
-// -----------------------------------------------------------------------------
-// ------------------------------Damping Field Emitter -------------------------
-// -----------------------------------------------------------------------------
-constructor TGLxDampingFieldEmitter.Create(aOwner: TXCollection);
-begin
-  inherited Create(aOwner);
-  fDamping := TGLDamping.Create(Self);
-end;
-
-destructor TGLxDampingFieldEmitter.Destroy;
-begin
-  fDamping.Free;
-  inherited Destroy;
-end;
-
-procedure TGLxDampingFieldEmitter.Assign(Source: TPersistent);
-begin
-  if Source.ClassType = Self.ClassType then
-  begin
-    fDamping := TGLxDampingFieldEmitter(Source).fDamping;
-  end;
-end;
-
-class function TGLxDampingFieldEmitter.FriendlyName: String;
-begin
-  Result := 'Damping Field';
-end;
-
-class function TGLxDampingFieldEmitter.FriendlyDescription: String;
-begin
-  Result := 'Damping Field, to approximate air/fluid resistance';
-end;
-
-class function TGLxDampingFieldEmitter.UniqueItem: Boolean;
-begin
-  Result := false;
-end;
-
-procedure TGLxDampingFieldEmitter.WriteToFiler(writer: TWriter);
-begin
-  inherited;
-  with writer do
-  begin
-    fDamping.WriteToFiler(writer);
-  end;
-end;
-
-procedure TGLxDampingFieldEmitter.ReadFromFiler(reader: TReader);
-begin
-  inherited;
-  with reader do
-  begin
-    fDamping.ReadFromFiler(reader);
-  end;
-end;
-
-procedure TGLxDampingFieldEmitter.SetDamping(const val: TGLDamping);
-begin
-  fDamping.Assign(val);
-end;
-
-// CalculateForceField (TODO: ParticleInertia -> BaseInertia, BaseInertia.ApplyDamping?)
-function TGLxDampingFieldEmitter.CalculateForceField(Body: TGLBaseSceneObject): TAffineVector;
-var
-  inertia1: TGLxParticleInertia;
-  // velocity:TAffineVector;
-  // v:Real;
-begin
-  inertia1 := TGLxParticleInertia
-    (Body.Behaviours.GetByClass(TGLxParticleInertia));
-  if Assigned(inertia1) then
-    inertia1.ApplyDamping(Damping);
-
-  (*
-    Inertia1 := TGLxParticleInertia(Body.Behaviours.GetByClass(TGLxParticleInertia));
-    if Assigned(inertia1) then
-    begin
-    velocity := VectorScale(inertia1.LinearMomentum, 1/Inertia1.Mass); // v = p/m
-    //apply force in opposite direction to velocity
-    v := VectorLength(velocity);
-    //  F = -Normalised(V)*( Constant + (Linear)*(V) + (Quadtratic)*(V)*(V) )
-    Result := VectorScale(VectorNormalize(velocity),
-              -(fDamping.Constant + fDamping.Linear*v + fDamping.Quadratic*v*v));
-    inertia1.ApplyForce(Result);
-    end
-    else
-    Result:=nullvector;
-  *)
-end;
-
-// -------------------------------------------------------------------
-// ------------------------------  TGLxForce -------------------------
-// -------------------------------------------------------------------
-
-constructor TGLxForce.Create(aOwner: TXCollection);
-begin
-  inherited; // Create(aOwner)
-  fposition1 := TGLCoordinates.CreateInitialized(Self, NullHmgVector, csVector);
-  fposition2 := TGLCoordinates.CreateInitialized(Self, NullHmgVector, csVector);
-  // fObject1:=TGLBaseSceneObject.Create(Self);
-  // fObject2:=TGLBaseSceneObject.Create(Self);
-end;
-
-destructor TGLxForce.Destroy;
-begin
-  fposition1.Free();
-  fposition2.Free();
-  // SetObject1(nil);
-  // SetObject2(nil);
-  // fObject1.Free();
-  // fObject2.Free();
-
-  inherited Destroy;
-end;
-
-procedure TGLxForce.Assign(Source: TPersistent);
-begin
-  // inherited Assign(Source);
-  fposition1.Assign(TGLxForce(Source).fposition1);
-  fposition2.Assign(TGLxForce(Source).fposition2);
-  Object1 := TGLxForce(Source).Object1;
-  Object2 := TGLxForce(Source).Object2;
-  inherited Assign(Source);
-end;
-
-procedure TGLxForce.SetObject1(const val: TGLBaseSceneObject);
-begin
-  // if val.Behaviours.IndexOfClass(TGLBaseInertia) >=0 then
-  fObject1 := val
-  // else
-  // Messagedlg('Object1 does not have an inertia behaviour',mtWarning,[mbOk],0);
-end;
-
-procedure TGLxForce.SetObject2(const val: TGLBaseSceneObject);
-begin
-  // if val.Behaviours.IndexOfClass(TGLBaseInertia) >=0 then
-  fObject2 := val
-  // else
-  // messagedlg('Object2 does not have an inertia behaviour',mtWarning,[mbOk],0);
-end;
-
-procedure TGLxForce.SetPosition1(const val: TGLCoordinates);
-begin
-  fposition1.Assign(val); // DB101
-end;
-
-procedure TGLxForce.SetPosition2(const val: TGLCoordinates);
-begin
-  fposition2.Assign(val);
-end;
-
-procedure TGLxForce.Loaded;
-var
-  PhysMan: TGLxManager;
-begin
-  inherited Loaded;
-  // not nice at all! ?
-  // assumes owner is TGLxForces belonging to TGLxPhysicsManager
-  PhysMan := TGLxManager(Self.Owner.Owner);
-  if (object1Name <> '') then
-  begin
-    // PhysMan:=TGLPhysicsManager(Self.Owner.Owner);
-    fObject1 := PhysMan.FindObjectByName(object1Name);
-    // fObject1 := TGLBaseSceneObject(FindComponent(Object1Name));
-    // Object1Name:='';
-  end;
-
-  if object2Name <> '' then
-  begin
-    fObject2 := PhysMan.FindObjectByName(object2Name);
-    // Object2Name:='';
-  end;
-end;
-
-class function TGLxForce.FriendlyName: String;
-begin
-  Result := 'Force';
-end;
-
-class function TGLxForce.FriendlyDescription: String;
-begin
-  Result := 'Physics Force';
-end;
-
-class function TGLxForce.UniqueItem: Boolean;
-begin
-  Result := false;
-end;
-
-procedure TGLxForce.WriteToFiler(writer: TWriter);
-begin
-  inherited WriteToFiler(writer);
-  // MessageDlg('Writing to filer'+ GetNamePath,mtInformation,[mbOk],0);
-  with writer do
-  begin
-    fposition1.WriteToFiler(writer);
-    fposition2.WriteToFiler(writer);
-    if Assigned(fObject1) then
-      WriteString(fObject1.GetNamePath)
-    else
-      WriteString('');
-    if Assigned(fObject2) then
-      WriteString(fObject2.GetNamePath)
-    else
-      WriteString('');
-    // WriteString(Object2Name);
-  end;
-end;
-
-procedure TGLxForce.ReadFromFiler(reader: TReader);
-begin
-  // MessageDlg('Reading from filer' + GetNamePath,mtInformation,[mbOk],0);
-  inherited ReadFromFiler(reader);
-  with reader do
-  begin
-    fposition1.ReadFromFiler(reader);
-    fposition2.ReadFromFiler(reader);
-    object1Name := ReadString;
-    fObject1 := nil;
-    object2Name := ReadString;
-    fObject2 := nil;
-  end;
-  // Loaded;
-end;
-
-procedure TGLxForce.SetName(const val: String);
-begin
-  inherited SetName(val);
-  // if Assigned(vGLBehaviourNameChangeEvent) then
-  // vGLBehaviourNameChangeEvent(Self);
-end;
-
-function TGLxForce.CalculateForce(): TAffineVector;
-begin
-  //
-end;
-
-constructor TGLxHookSpring.Create(aOwner: TXCollection);
-begin
-  inherited Create(aOwner);
-  fNaturalLength := 1;
-  fElasticity := 1;
-  fDamping := TGLDamping.Create(Self);
-end;
-
-destructor TGLxHookSpring.Destroy;
-begin
-  fDamping.Free;
-  inherited Destroy;
-end;
-
-procedure TGLxHookSpring.WriteToFiler(writer: TWriter);
-begin
-  inherited;
-  with writer do
-  begin
-    WriteFloat(fNaturalLength); // :Real;
-    WriteFloat(fElasticity); // :Real;
-    WriteFloat(fLength); // :Real;
-    WriteFloat(fExtension); // :Real;
-    fDamping.WriteToFiler(writer);
-  end;
-end;
-
-procedure TGLxHookSpring.ReadFromFiler(reader: TReader);
-begin
-  inherited;
-  with reader do
-  begin
-    fNaturalLength := ReadFloat(); // :Real;
-    fElasticity := ReadFloat(); // :Real;
-    fLength := ReadFloat(); // :Real;
-    fExtension := ReadFloat(); // :Real;
-    fDamping.ReadFromFiler(reader);
-  end;
-end;
-
-procedure TGLxHookSpring.SetDamping(const val: TGLDamping);
-begin
-  fDamping.Assign(val);
-end;
-
-function TGLxHookSpring.CalculateForce(): TAffineVector;
-var
-  rvector, vvector: TAffineVector;
-  Inertia1, Inertia2: TGLxParticleInertia;
-begin
-  if (fObject1 = nil) or (fObject2 = nil) then
-    Exit;
-  Inertia2 := TGLxParticleInertia
-    (Object2.Behaviours.GetByClass(TGLxParticleInertia));
-  Inertia1 := TGLxParticleInertia
-    (Object1.Behaviours.GetByClass(TGLxParticleInertia));
-
-  // rvector:=VectorSubtract({VectorAdd(Object2.Position.asAffineVector,}VectorTransform(Position2.AsAffineVector,Object2.Matrix{)}),
-  // {VectorAdd(Object1.Position.asAffineVector,}VectorTransform(Position1.AsAffineVector,Object1.Matrix){)});
-  rvector := VectorSubtract(Object2.LocalToAbsolute(Position2.AsAffineVector),
-    Object1.LocalToAbsolute(Position1.AsAffineVector));
-  (*
-    rvector:=VectorSubtract(VectorAdd(Object2.Position.asAffineVector,VectorTransform(Position2.AsAffineVector,Object2.Matrix)),
-    VectorAdd(Object1.Position.asAffineVector,VectorTransform(Position1.AsAffineVector,Object1.Matrix)));
-  *)
-  fLength := VectorLength(rvector);
-  NormalizeVector(rvector);
-  fExtension := fLength - fNaturalLength;
-
-  // fDamping.Calculate();
-
-  Result := VectorScale(rvector, fElasticity * fExtension / fNaturalLength);
-  if Assigned(Inertia2) then
-    Inertia2.ApplyForce(Position2.AsAffineVector, VectorNegate(Result));
-  if Assigned(Inertia1) then
-    Inertia1.ApplyForce(Position1.AsAffineVector, Result);
-  // TGLInertia(Object1.Behaviours.GetByClass(TGLInertia)).ApplyForce(Position1.AsAffineVector,Result);
-end;
-
-class function TGLxHookSpring.FriendlyName: String;
-begin
-  Result := 'Hookes Spring';
-end;
-
-class function TGLxHookSpring.FriendlyDescription: String;
-begin
-  Result := 'A spring obeying Hookes Law';
-end;
-
-class function TGLxHookSpring.UniqueItem: Boolean;
-begin
-  Result := false;
-end;
-
-constructor TGLxHookStrings.Create(aOwner: TXCollection);
-begin
-  inherited Create(aOwner);
-end;
-
-destructor TGLxHookStrings.Destroy;
-begin
-  inherited Destroy;
-end;
-
-class function TGLxHookStrings.FriendlyName: String;
-begin
-  Result := 'Hookes String';
-end;
-
-class function TGLxHookStrings.FriendlyDescription: String;
-begin
-  Result := 'A string (that can go slack) obeying Hookes Law';
-end;
-
-class function TGLxHookStrings.UniqueItem: Boolean;
-begin
-  Result := false;
-end;
-
-function TGLxHookStrings.CalculateForce(): TAffineVector;
-var
-  rvector: TAffineVector;
-  Inertia1, Inertia2: TGLxParticleInertia;
-begin
-  if (Object1 = nil) or (Object2 = nil) then
-    Exit;
-  rvector := VectorSubtract(Object2.LocalToAbsolute(Position2.AsAffineVector),
-    Object1.LocalToAbsolute(Position1.AsAffineVector));
-  // VectorAdd(Object2.Position.asAffineVector,VectorTransform(Object2.Position2.AsAffineVector,Object2.Matrix)),
-  // VectorAdd(Object1.Position.asAffineVector,VectorTransform(Position1.AsAffineVector,Object1.Matrix)));
-  fLength := VectorLength(rvector);
-  if (fLength < fNaturalLength) then
-    Result := NullVector
-  else
-  begin
-    NormalizeVector(rvector);
-    fExtension := fLength - fNaturalLength;
-    Result := VectorScale(rvector, fElasticity * fExtension / fNaturalLength);
-    // TGLInertia(Object2.Behaviours.GetByClass(TGLInertia)).ApplyForce(Position2.AsAffineVector,VectorNegate(Result));
-    // TGLInertia(Object1.Behaviours.GetByClass(TGLInertia)).ApplyForce(Position1.AsAffineVector,Result);
-    Inertia2 := TGLxParticleInertia
-      (Object2.Behaviours.GetByClass(TGLxParticleInertia));
-    Inertia1 := TGLxParticleInertia
-      (Object1.Behaviours.GetByClass(TGLxParticleInertia));
-    if Assigned(Inertia2) then
-      Inertia2.ApplyForce(Position2.AsAffineVector, VectorNegate(Result));
-    if Assigned(Inertia1) then
-      Inertia1.ApplyForce(Position1.AsAffineVector, Result);
-  end;
-  // Result:= inherited CalculateForce();
-  // if (fLength < fNaturalLength) then Result:=NullVector;
-end;
-
-
-
-// ------------------------------------------------------------------
-initialization
-
-// ------------------------------------------------------------------
-
-RegisterXCollectionItemClass(TGLxHookSpring);
-RegisterXCollectionItemClass(TGLxHookStrings);
-
-RegisterXCollectionItemClass(TGLxUniformGravityEmitter);
-RegisterXCollectionItemClass(TGLxRadialGravityEmitter);
-RegisterXCollectionItemClass(TGLxDampingFieldEmitter);
-
-
-RegisterClasses([TGLxForces]);
-RegisterClasses([TGLxManager, TGLxBaseInertia, TGLxBaseForceFieldEmitter]);
-RegisterXCollectionItemClass(TGLxBaseInertia);
-RegisterXCollectionItemClass(TGLxBaseForceFieldEmitter);
-
-end.

+ 4 - 4
Source/Physics.Register.pas

@@ -11,7 +11,7 @@ uses
   System.Classes,
   System.Classes,
   Physics.ODEManager,
   Physics.ODEManager,
   Physics.NGDManager,
   Physics.NGDManager,
-  Physics.GLxManager;
+  Physics.SPIManager;
 
 
 procedure Register;
 procedure Register;
 
 
@@ -22,9 +22,9 @@ implementation
 procedure Register;
 procedure Register;
 begin
 begin
   RegisterClasses([TGLODEManager, TGLODEJointList, TGLODEJoints, TGLODEElements,
   RegisterClasses([TGLODEManager, TGLODEJointList, TGLODEJoints, TGLODEElements,
-    TGLNGDManager, TGLNGDDynamic, TGLNGDStatic, TGLxManager]);
-  RegisterComponents('GLScene Physics Managers', [TGLODEManager, TGLODEJointList, TGLNGDManager,
-  TGLxManager]);
+    TGLNGDManager, TGLNGDDynamic, TGLNGDStatic, TGLSPIManager]);
+  RegisterComponents('GLScene Physics Managers', [TGLODEManager, TGLODEJointList, 
+                    TGLNGDManager, TGLSPIManager]);
 end;
 end;
 
 
 end.
 end.

+ 342 - 0
Source/Physics.SPIFields.pas

@@ -0,0 +1,342 @@
+//
+// The graphics rendering engine GLScene http://glscene.org
+//
+
+unit Physics.SPIFields;
+
+interface
+
+uses
+  System.Classes,
+  GLS.VectorGeometry,
+  GLS.XCollection,
+  GLS.Scene,
+  GLS.Coordinates,
+  GLS.Behaviours,
+  (* GLS.RigidBodyInertia *)
+  Physics.SPIInertias,
+  Physics.SPIManager;
+
+type
+
+  TGLUniformGravityEmitter = class(TGLBaseForceFieldEmitter)
+  private
+    fGravity: TGLCoordinates;
+  protected
+    procedure SetGravity(const val: TGLCoordinates);
+  public
+    constructor Create(aOwner: TXCollection); override;
+    destructor Destroy; override;
+    procedure Assign(Source: TPersistent); override;
+    procedure WriteToFiler(writer: TWriter); override;
+    procedure ReadFromFiler(reader: TReader); override;
+    class function FriendlyName: String; override;
+    class function FriendlyDescription: String; override;
+    class function UniqueItem: Boolean; override;
+    function CalculateForceField(Body: TGLBaseSceneObject)
+      : TAffineVector; override;
+  published
+    property Gravity: TGLCoordinates read fGravity write SetGravity;
+  end;
+
+  TGLRadialGravityEmitter = class(TGLBaseForceFieldEmitter)
+  private
+    fMass: Real;
+    fMassOverG: Real;
+  public
+    constructor Create(aOwner: TXCollection); override;
+    destructor Destroy; override;
+    procedure Assign(Source: TPersistent); override;
+    procedure WriteToFiler(writer: TWriter); override;
+    procedure ReadFromFiler(reader: TReader); override;
+    class function FriendlyName: String; override;
+    class function FriendlyDescription: String; override;
+    class function UniqueItem: Boolean; override;
+    function CalculateForceField(Body: TGLBaseSceneObject)
+      : TAffineVector; override;
+  published
+    property Mass: Real read fMass write fMass;
+  end;
+
+  TGLDampingFieldEmitter = class(TGLBaseForceFieldEmitter)
+  private
+    fDamping: TGLDamping;
+  protected
+    procedure SetDamping(const val: TGLDamping);
+  public
+    constructor Create(aOwner: TXCollection); override;
+    destructor Destroy; override;
+    procedure Assign(Source: TPersistent); override;
+    procedure WriteToFiler(writer: TWriter); override;
+    procedure ReadFromFiler(reader: TReader); override;
+    class function FriendlyName: String; override;
+    class function FriendlyDescription: String; override;
+    class function UniqueItem: Boolean; override;
+    function CalculateForceField(Body: TGLBaseSceneObject)
+      : TAffineVector; override;
+  published
+    property Damping: TGLDamping read fDamping write SetDamping;
+  end;
+
+const
+  GravitationalConstant = 6.6726E-11;
+
+// ==================================================================
+implementation
+// ==================================================================
+
+// -------------------------------------
+// ---- TGLUniformGravityEmitter
+// -------------------------------------
+constructor TGLUniformGravityEmitter.Create(aOwner: TXCollection);
+begin
+  inherited Create(aOwner);
+  fGravity := TGLCoordinates.CreateInitialized(Self, nullHmgVector, csVector);
+end;
+
+destructor TGLUniformGravityEmitter.Destroy;
+begin
+  fGravity.Free;
+  inherited Destroy;
+end;
+
+procedure TGLUniformGravityEmitter.Assign(Source: TPersistent);
+begin
+  if Source.ClassType = Self.ClassType then
+  begin
+    fGravity := TGLUniformGravityEmitter(Source).fGravity;
+  end;
+end;
+
+class function TGLUniformGravityEmitter.FriendlyName: String;
+begin
+  Result := 'Uniform Gravity';
+end;
+
+class function TGLUniformGravityEmitter.FriendlyDescription: String;
+begin
+  Result := 'Uniform Gravity, appropriate near surface of planet';
+end;
+
+class function TGLUniformGravityEmitter.UniqueItem: Boolean;
+begin
+  Result := false;
+end;
+
+procedure TGLUniformGravityEmitter.WriteToFiler(writer: TWriter);
+begin
+  inherited;
+  with writer do
+  begin
+    fGravity.WriteToFiler(writer);
+  end;
+end;
+
+procedure TGLUniformGravityEmitter.ReadFromFiler(reader: TReader);
+begin
+  inherited;
+  with reader do
+  begin
+    fGravity.ReadFromFiler(reader);
+  end;
+end;
+
+procedure TGLUniformGravityEmitter.SetGravity(const val: TGLCoordinates);
+begin
+  fGravity.Assign(val);
+end;
+
+// CalculateForceField  (TODO: ParticleInertia -> BaseInertia, add BaseInertia.ApplyAcceleration)
+function TGLUniformGravityEmitter.CalculateForceField(Body: TGLBaseSceneObject)
+  : TAffineVector;
+var
+  inertia1: TGLParticleInertia;
+begin
+  inertia1 := TGLParticleInertia
+    (Body.Behaviours.GetByClass(TGLParticleInertia));
+  if Assigned(inertia1) then
+  begin
+    Result := VectorScale(fGravity.AsAffineVector, inertia1.Mass);
+    inertia1.ApplyForce(Result);
+  end
+  else
+    Result := nullVector;
+end;
+
+// ------------------------------------------------------------------------------
+// ------------------------------Radial Gravity Emitter -------------------------
+// ------------------------------------------------------------------------------
+
+constructor TGLRadialGravityEmitter.Create(aOwner: TXCollection);
+begin
+  inherited Create(aOwner);
+end;
+
+destructor TGLRadialGravityEmitter.Destroy;
+begin
+  inherited Destroy;
+end;
+
+procedure TGLRadialGravityEmitter.Assign(Source: TPersistent);
+begin
+  if Source.ClassType = Self.ClassType then
+  begin
+    fMass := TGLRadialGravityEmitter(Source).fMass;
+  end;
+end;
+
+class function TGLRadialGravityEmitter.FriendlyName: String;
+begin
+  Result := 'Radial Gravity';
+end;
+
+class function TGLRadialGravityEmitter.FriendlyDescription: String;
+begin
+  Result := 'Radial Gravity, can be applied anywhere (use for planets)';
+end;
+
+class function TGLRadialGravityEmitter.UniqueItem: Boolean;
+begin
+  Result := false;
+end;
+
+procedure TGLRadialGravityEmitter.WriteToFiler(writer: TWriter);
+begin
+  inherited;
+  with writer do
+  begin
+    WriteFloat(fMass);
+  end;
+end;
+
+procedure TGLRadialGravityEmitter.ReadFromFiler(reader: TReader);
+begin
+  inherited;
+  with reader do
+  begin
+    fMass := ReadFloat();;
+  end;
+end;
+
+// CalculateForceField (TODO: ParticleInertia -> BaseInertia if possible)
+function TGLRadialGravityEmitter.CalculateForceField(Body: TGLBaseSceneObject)
+  : TAffineVector;
+var
+  inertia1: TGLParticleInertia;
+  R: TAffineVector;
+  L: Real;
+begin
+  inertia1 := TGLParticleInertia
+    (Body.Behaviours.GetByClass(TGLParticleInertia));
+  if Assigned(inertia1) then
+  begin
+    R := VectorSubtract(Body.Position.AsAffineVector,
+      Self.OwnerBaseSceneObject.Position.AsAffineVector);
+    L := VectorLength(R);
+    Result := VectorScale(R, -GravitationalConstant * (fMass / L));
+    inertia1.ApplyForce(Result);
+  end
+  else
+    Result := nullVector;
+end;
+
+// -----------------------------------------------------------------------------
+// ------------------------------Damping Field Emitter -------------------------
+// -----------------------------------------------------------------------------
+
+constructor TGLDampingFieldEmitter.Create(aOwner: TXCollection);
+begin
+  inherited Create(aOwner);
+  fDamping := TGLDamping.Create(Self);
+end;
+
+destructor TGLDampingFieldEmitter.Destroy;
+begin
+  fDamping.Free;
+  inherited Destroy;
+end;
+
+procedure TGLDampingFieldEmitter.Assign(Source: TPersistent);
+begin
+  if Source.ClassType = Self.ClassType then
+  begin
+    fDamping := TGLDampingFieldEmitter(Source).fDamping;
+  end;
+end;
+
+class function TGLDampingFieldEmitter.FriendlyName: String;
+begin
+  Result := 'Damping Field';
+end;
+
+class function TGLDampingFieldEmitter.FriendlyDescription: String;
+begin
+  Result := 'Damping Field, to approximate air/fluid resistance';
+end;
+
+class function TGLDampingFieldEmitter.UniqueItem: Boolean;
+begin
+  Result := false;
+end;
+
+procedure TGLDampingFieldEmitter.WriteToFiler(writer: TWriter);
+begin
+  inherited;
+  with writer do
+  begin
+    fDamping.WriteToFiler(writer);
+  end;
+end;
+
+procedure TGLDampingFieldEmitter.ReadFromFiler(reader: TReader);
+begin
+  inherited;
+  with reader do
+  begin
+    fDamping.ReadFromFiler(reader);
+  end;
+end;
+
+procedure TGLDampingFieldEmitter.SetDamping(const val: TGLDamping);
+begin
+  fDamping.Assign(val);
+end;
+
+// CalculateForceField (TODO: ParticleInertia -> BaseInertia, BaseInertia.ApplyDamping?)
+function TGLDampingFieldEmitter.CalculateForceField(Body: TGLBaseSceneObject)
+  : TAffineVector;
+var
+  inertia1: TGLParticleInertia;
+  // velocity:TAffineVector;
+  // v:Real;
+begin
+  inertia1 := TGLParticleInertia
+    (Body.Behaviours.GetByClass(TGLParticleInertia));
+  if Assigned(inertia1) then
+    inertia1.ApplyDamping(Damping);
+
+  { Inertia1:=TGLParticleInertia(Body.Behaviours.GetByClass(TGLParticleInertia));
+    if Assigned(inertia1) then
+    begin
+    velocity:=VectorScale(inertia1.LinearMomentum, 1/Inertia1.Mass); // v = p/m
+    //apply force in opposite direction to velocity
+    v:=VectorLength(velocity);
+    //  F = -Normalised(V)*( Constant + (Linear)*(V) + (Quadtratic)*(V)*(V) )
+    Result:=VectorScale(VectorNormalize(velocity),-(fDamping.Constant+fDamping.Linear*v+fDamping.Quadratic*v*v));
+    inertia1.ApplyForce(Result);
+    end
+    else
+    Result:=nullvector;
+  }
+end;
+
+// -------------------------------------------------------------------------
+initialization
+
+// -------------------------------------------------------------------------
+
+RegisterXCollectionItemClass(TGLUniformGravityEmitter);
+RegisterXCollectionItemClass(TGLRadialGravityEmitter);
+RegisterXCollectionItemClass(TGLDampingFieldEmitter);
+
+end.

+ 414 - 0
Source/Physics.SPIForces.pas

@@ -0,0 +1,414 @@
+//
+// The graphics rendering engine GLScene http://glscene.org
+//
+unit Physics.SPIForces;
+
+interface
+
+uses
+  System.Classes,
+  Vcl.Dialogs,
+
+  GLS.VectorTypes,
+  GLS.XCollection,
+  GLS.Scene,
+  GLS.VectorGeometry,
+  GLS.Behaviours,
+  GLS.Coordinates,
+  GLS.Strings;
+
+type
+  TGLForce = class;
+  TGLForceType = (ftHookes, ftGravitation, ftCustom);
+
+  TOnCustomForce = procedure() of object;
+
+  TGLForce = class(TXCollectionItem)
+  private
+    fObject1: TGLBaseSceneObject;
+    fObject2: TGLBaseSceneObject;
+    fposition1: TGLCoordinates;
+    fposition2: TGLCoordinates;
+    object1Name: String;
+    object2Name: String;
+    // fOnCustomForce: TOnCustomForce;
+  protected
+    procedure Loaded; override;
+    procedure SetName(const val: String); override;
+    (* Returns the TGLBaseSceneObject on which the behaviour should be applied.
+      Does NOT check for nil owners *)
+    // function OwnerBaseSceneObject : TGLBaseSceneObject;
+  public
+    (* constructor Create(Collection: TCollection);override; *)
+    // Override this function to write subclass data.
+    procedure WriteToFiler(writer: TWriter); override;
+    // Override this function to read subclass data.
+    procedure ReadFromFiler(reader: TReader); override;
+    constructor Create(aOwner: TXCollection); override;
+    destructor Destroy; override;
+    procedure Assign(Source: TPersistent); override;
+    class function FriendlyName: String; override;
+    class function FriendlyDescription: String; override;
+    class function UniqueItem: Boolean; override;
+    procedure SetObject1(const val: TGLBaseSceneObject);
+    procedure SetObject2(const val: TGLBaseSceneObject);
+    procedure SetPosition1(const val: TGLCoordinates);
+    procedure SetPosition2(const val: TGLCoordinates);
+    function CalculateForce(): TAffineVector; virtual;
+  published
+    property Object1: TGLBaseSceneObject read fObject1 write SetObject1;
+    property Object2: TGLBaseSceneObject read fObject2 write SetObject2;
+    property Position1: TGLCoordinates read fposition1 write SetPosition1;
+    property Position2: TGLCoordinates read fposition2 write SetPosition2;
+    // property OnCustomForce:TOnCustomForce read fOnCustomForce write fOnCustomForce;
+  end;
+
+  TGLHookesSpring = class(TGLForce)
+  private
+    fNaturalLength: Real;
+    fElasticity: Real;
+    fLength: Real;
+    fExtension: Real;
+    fDamping: TGLDamping;
+  public
+    procedure WriteToFiler(writer: TWriter); override;
+    procedure ReadFromFiler(reader: TReader); override;
+    constructor Create(aOwner: TXCollection); override;
+    destructor Destroy; override;
+    class function FriendlyName: String; override;
+    class function FriendlyDescription: String; override;
+    class function UniqueItem: Boolean; override;
+    procedure SetDamping(const val: TGLDamping);
+    function CalculateForce(): TAffineVector; override;
+  published
+    property NaturalLength: Real read fNaturalLength write fNaturalLength;
+    property Elasticity: Real read fElasticity write fElasticity;
+    property Damping: TGLDamping read fDamping write SetDamping;
+    // property Name;
+  end;
+
+  TGLHookesString = class(TGLHookesSpring)
+  protected
+    // procedure WriteToFiler(writer : TWriter); override;
+    // procedure ReadFromFiler(reader : TReader); override;
+  public
+    constructor Create(aOwner: TXCollection); override;
+    destructor Destroy; override;
+    class function FriendlyName: String; override;
+    class function FriendlyDescription: String; override;
+    class function UniqueItem: Boolean; override;
+    function CalculateForce(): TAffineVector; override;
+  end;
+
+// --------------------------------------------------------------
+implementation
+// --------------------------------------------------------------
+
+uses
+  Physics.SPIInertias,
+  Physics.SPIManager;
+
+constructor TGLForce.Create(aOwner: TXCollection);
+begin
+  inherited; // Create(aOwner)
+  fposition1 := TGLCoordinates.CreateInitialized(Self, NullHmgVector, csVector);
+  fposition2 := TGLCoordinates.CreateInitialized(Self, NullHmgVector, csVector);
+  // fObject1:=TGLBaseSceneObject.Create(Self);
+  // fObject2:=TGLBaseSceneObject.Create(Self);
+end;
+
+destructor TGLForce.Destroy;
+begin
+  fposition1.Free();
+  fposition2.Free();
+  // SetObject1(nil);
+  // SetObject2(nil);
+  // fObject1.Free();
+  // fObject2.Free();
+
+  inherited Destroy;
+end;
+
+procedure TGLForce.Assign(Source: TPersistent);
+begin
+  // inherited Assign(Source);
+  fposition1.Assign(TGLForce(Source).fposition1);
+  fposition2.Assign(TGLForce(Source).fposition2);
+  Object1 := TGLForce(Source).Object1;
+  Object2 := TGLForce(Source).Object2;
+  inherited Assign(Source);
+end;
+
+procedure TGLForce.SetObject1(const val: TGLBaseSceneObject);
+begin
+  // if val.Behaviours.IndexOfClass(TGLBaseInertia) >=0 then
+  fObject1 := val
+  // else
+  // messagedlg('Object1 does not have an inertia behaviour',mtWarning,[mbOk],0);
+end;
+
+procedure TGLForce.SetObject2(const val: TGLBaseSceneObject);
+begin
+  // if val.Behaviours.IndexOfClass(TGLBaseInertia) >=0 then
+  fObject2 := val
+  // else
+  // messagedlg('Object2 does not have an inertia behaviour',mtWarning,[mbOk],0);
+end;
+
+procedure TGLForce.SetPosition1(const val: TGLCoordinates);
+begin
+  fposition1.Assign(val); // DB101
+end;
+
+procedure TGLForce.SetPosition2(const val: TGLCoordinates);
+begin
+  fposition2.Assign(val);
+end;
+
+procedure TGLForce.Loaded;
+var
+  PhysMan: TGLSPIManager;
+begin
+  inherited Loaded;
+  // not nice, not nice at all!!!!!!
+  // assumes owner is TGLForces belonging to TGLPhysicsManager
+  PhysMan := TGLSPIManager(Self.Owner.Owner);
+  if (object1Name <> '') then
+  begin
+    // PhysMan:=TGLPhysicsManager(Self.Owner.Owner);
+    fObject1 := PhysMan.FindObjectByName(object1Name);
+    // fObject1:=TGLBaseSceneObject(FindComponent(Object1Name));
+    // Object1Name:='';
+  end;
+
+  if object2Name <> '' then
+  begin
+    fObject2 := PhysMan.FindObjectByName(object2Name);
+    // Object2Name:='';
+  end;
+end;
+
+class function TGLForce.FriendlyName: String;
+begin
+  Result := 'Force';
+end;
+
+class function TGLForce.FriendlyDescription: String;
+begin
+  Result := 'Physics Force';
+end;
+
+class function TGLForce.UniqueItem: Boolean;
+begin
+  Result := false;
+end;
+
+procedure TGLForce.WriteToFiler(writer: TWriter);
+begin
+  inherited WriteToFiler(writer);
+  // messagedlg('Writing to filer'+GetNamePath,mtInformation,[mbOk],0);
+  with writer do
+  begin
+    fposition1.WriteToFiler(writer);
+    fposition2.WriteToFiler(writer);
+    if Assigned(fObject1) then
+      WriteString(fObject1.GetNamePath)
+    else
+      WriteString('');
+    if Assigned(fObject2) then
+      WriteString(fObject2.GetNamePath)
+    else
+      WriteString('');
+    // WriteString(Object2Name);
+  end;
+end;
+
+procedure TGLForce.ReadFromFiler(reader: TReader);
+begin
+  // messagedlg('Reading from filer'+GetNamePath,mtInformation,[mbOk],0);
+  inherited ReadFromFiler(reader);
+  with reader do
+  begin
+    fposition1.ReadFromFiler(reader);
+    fposition2.ReadFromFiler(reader);
+    object1Name := ReadString;
+    fObject1 := nil;
+    object2Name := ReadString;
+    fObject2 := nil;
+  end;
+  // Loaded;
+end;
+
+procedure TGLForce.SetName(const val: String);
+begin
+  inherited SetName(val);
+  // if Assigned(vGLBehaviourNameChangeEvent) then
+  // vGLBehaviourNameChangeEvent(Self);
+end;
+
+function TGLForce.CalculateForce(): TAffineVector;
+begin
+  //
+end;
+
+constructor TGLHookesSpring.Create(aOwner: TXCollection);
+begin
+  inherited Create(aOwner);
+  fNaturalLength := 1;
+  fElasticity := 1;
+  fDamping := TGLDamping.Create(Self);
+end;
+
+destructor TGLHookesSpring.Destroy;
+begin
+  fDamping.Free;
+  inherited Destroy;
+end;
+
+procedure TGLHookesSpring.WriteToFiler(writer: TWriter);
+begin
+  inherited;
+  with writer do
+  begin
+    WriteFloat(fNaturalLength); // :Real;
+    WriteFloat(fElasticity); // :Real;
+    WriteFloat(fLength); // :Real;
+    WriteFloat(fExtension); // :Real;
+    fDamping.WriteToFiler(writer);
+  end;
+end;
+
+procedure TGLHookesSpring.ReadFromFiler(reader: TReader);
+begin
+  inherited;
+  with reader do
+  begin
+    fNaturalLength := ReadFloat(); // :Real;
+    fElasticity := ReadFloat(); // :Real;
+    fLength := ReadFloat(); // :Real;
+    fExtension := ReadFloat(); // :Real;
+    fDamping.ReadFromFiler(reader);
+  end;
+end;
+
+procedure TGLHookesSpring.SetDamping(const val: TGLDamping);
+begin
+  fDamping.Assign(val);
+end;
+
+function TGLHookesSpring.CalculateForce(): TAffineVector;
+var
+  rvector, vvector: TAffineVector;
+  Inertia1, Inertia2: TGLParticleInertia;
+begin
+  if (fObject1 = nil) or (fObject2 = nil) then
+    Exit;
+  Inertia2 := TGLParticleInertia
+    (Object2.Behaviours.GetByClass(TGLParticleInertia));
+  Inertia1 := TGLParticleInertia
+    (Object1.Behaviours.GetByClass(TGLParticleInertia));
+
+  // rvector:=VectorSubtract({VectorAdd(Object2.Position.asAffineVector,}VectorTransform(Position2.AsAffineVector,Object2.Matrix{)}),
+  // {VectorAdd(Object1.Position.asAffineVector,}VectorTransform(Position1.AsAffineVector,Object1.Matrix){)});
+  rvector := VectorSubtract(Object2.LocalToAbsolute(Position2.AsAffineVector),
+    Object1.LocalToAbsolute(Position1.AsAffineVector));
+  (*
+    rvector:=VectorSubtract(VectorAdd(Object2.Position.asAffineVector,VectorTransform(Position2.AsAffineVector,Object2.Matrix)),
+    VectorAdd(Object1.Position.asAffineVector,VectorTransform(Position1.AsAffineVector,Object1.Matrix)));
+  *)
+  fLength := VectorLength(rvector);
+  NormalizeVector(rvector);
+  fExtension := fLength - fNaturalLength;
+
+  // fDamping.Calculate();
+
+  Result := VectorScale(rvector, fElasticity * fExtension / fNaturalLength);
+  if Assigned(Inertia2) then
+    Inertia2.ApplyForce(Position2.AsAffineVector, VectorNegate(Result));
+  if Assigned(Inertia1) then
+    Inertia1.ApplyForce(Position1.AsAffineVector, Result);
+  // TGLInertia(Object1.Behaviours.GetByClass(TGLInertia)).ApplyForce(Position1.AsAffineVector,Result);
+end;
+
+class function TGLHookesSpring.FriendlyName: String;
+begin
+  Result := 'Hookes Spring';
+end;
+
+class function TGLHookesSpring.FriendlyDescription: String;
+begin
+  Result := 'A spring obeying Hookes Law';
+end;
+
+class function TGLHookesSpring.UniqueItem: Boolean;
+begin
+  Result := false;
+end;
+
+constructor TGLHookesString.Create(aOwner: TXCollection);
+begin
+  inherited Create(aOwner);
+end;
+
+destructor TGLHookesString.Destroy;
+begin
+  inherited Destroy;
+end;
+
+class function TGLHookesString.FriendlyName: String;
+begin
+  Result := 'Hookes String';
+end;
+
+class function TGLHookesString.FriendlyDescription: String;
+begin
+  Result := 'A string (that can go slack) obeying Hookes Law';
+end;
+
+class function TGLHookesString.UniqueItem: Boolean;
+begin
+  Result := false;
+end;
+
+function TGLHookesString.CalculateForce(): TAffineVector;
+var
+  rvector: TAffineVector;
+  Inertia1, Inertia2: TGLParticleInertia;
+begin
+  if (Object1 = nil) or (Object2 = nil) then
+    Exit;
+  rvector := VectorSubtract(Object2.LocalToAbsolute(Position2.AsAffineVector),
+    Object1.LocalToAbsolute(Position1.AsAffineVector));
+  // VectorAdd(Object2.Position.asAffineVector,VectorTransform(Object2.Position2.AsAffineVector,Object2.Matrix)),
+  // VectorAdd(Object1.Position.asAffineVector,VectorTransform(Position1.AsAffineVector,Object1.Matrix)));
+  fLength := VectorLength(rvector);
+  if (fLength < fNaturalLength) then
+    Result := NullVector
+  else
+  begin
+    NormalizeVector(rvector);
+    fExtension := fLength - fNaturalLength;
+    Result := VectorScale(rvector, fElasticity * fExtension / fNaturalLength);
+    // TGLInertia(Object2.Behaviours.GetByClass(TGLInertia)).ApplyForce(Position2.AsAffineVector,VectorNegate(Result));
+    // TGLInertia(Object1.Behaviours.GetByClass(TGLInertia)).ApplyForce(Position1.AsAffineVector,Result);
+    Inertia2 := TGLParticleInertia
+      (Object2.Behaviours.GetByClass(TGLParticleInertia));
+    Inertia1 := TGLParticleInertia
+      (Object1.Behaviours.GetByClass(TGLParticleInertia));
+    if Assigned(Inertia2) then
+      Inertia2.ApplyForce(Position2.AsAffineVector, VectorNegate(Result));
+    if Assigned(Inertia1) then
+      Inertia1.ApplyForce(Position1.AsAffineVector, Result);
+  end;
+  // Result:= inherited CalculateForce();
+  // if (fLength < fNaturalLength) then Result:=NullVector;
+end;
+
+// =================================================================
+initialization
+// =================================================================
+
+RegisterXCollectionItemClass(TGLHookesSpring);
+RegisterXCollectionItemClass(TGLHookesString);
+
+end.

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 279 - 251
Source/Physics.SPIInertias.pas


+ 28 - 28
Source/Physics.GLxJoints.pas → Source/Physics.SPIJoints.pas

@@ -1,7 +1,7 @@
 //
 //
-// The graphics platform GLScene https://github.com/glscene
+// The graphics rendering engine GLScene http://glscene.org
 //
 //
-unit Physics.GLxJoints;
+unit Physics.SPIJoints;
 
 
 (*
 (*
   This unit isn't used at all at the moment, just putting down some ideas
   This unit isn't used at all at the moment, just putting down some ideas
@@ -35,15 +35,15 @@ type
     //     X(n) = Common normal between joint axis Z(n-1) & Z(n)
     //     X(n) = Common normal between joint axis Z(n-1) & Z(n)
   *)
   *)
 
 
-  TGLxBaseJoint = class(TObject)
+  TGLBaseJoint = class(TObject)
   end;
   end;
 
 
-  TGLxBaseLink = class(TObject)
+  TGLBaseLink = class(TObject)
   end;
   end;
 
 
-  TGLxJoint = class(TGLxBaseJoint)
-    Link1: TGLxBaseLink; // if Link1 is nil, assumed to be base
-    Link2: TGLxBaseLink; // if Link2 is nil, assumed to be wrist
+  TGLJoint = class(TGLBaseJoint)
+    Link1: TGLBaseLink; // if Link1 is nil, assumed to be base
+    Link2: TGLBaseLink; // if Link2 is nil, assumed to be wrist
     // Object1:TGLBaseSceneObject;
     // Object1:TGLBaseSceneObject;
     // Object2:TGLBaseSceneObject;
     // Object2:TGLBaseSceneObject;
   end;
   end;
@@ -51,7 +51,7 @@ type
   // Links are mainly for used for Serial-Link manipulators
   // Links are mainly for used for Serial-Link manipulators
 
 
   // Direct & Inverse Kinematics algorithms are planned
   // Direct & Inverse Kinematics algorithms are planned
-  TGLxLink = class(TGLxBaseLink)
+  TGLLink = class(TGLBaseLink)
     // Link Parameters
     // Link Parameters
     fLinkLength: Real; // Length of common normal which is orthogonal to both
     fLinkLength: Real; // Length of common normal which is orthogonal to both
     // joint axes Z[n-1] and Z[n] (a.k.a.  L)
     // joint axes Z[n-1] and Z[n] (a.k.a.  L)
@@ -91,7 +91,7 @@ type
   // \_/
   // \_/
   //
   //
 *)
 *)
-  TGLxType1Link = class(TGLxLink)
+  TGLType1Link = class(TGLLink)
     Length: Real; // fixed
     Length: Real; // fixed
     Angle: Real; // variable
     Angle: Real; // variable
 (*
 (*
@@ -120,7 +120,7 @@ type
   // |___.___|
   // |___.___|
   //
   //
 *)
 *)
-  TGLxType2Link = class(TGLxLink)
+  TGLType2Link = class(TGLLink)
     Length: Real; // fixed
     Length: Real; // fixed
     Angle: Real; // variable
     Angle: Real; // variable
     constructor Create(Length, Angle: Real);
     constructor Create(Length, Angle: Real);
@@ -139,7 +139,7 @@ type
   // _|_|_
   // _|_|_
   // |__.__|
   // |__.__|
 *)
 *)
-  TGLxType3Link = class(TGLxLink)
+  TGLType3Link = class(TGLLink)
     Length: Real; // fixed
     Length: Real; // fixed
     Angle: Real; // variable
     Angle: Real; // variable
 (*
 (*
@@ -153,7 +153,7 @@ type
     constructor Create(Length, Angle: Real);
     constructor Create(Length, Angle: Real);
   end;
   end;
 
 
-  TGLxType4Link = class(TGLxLink)
+  TGLType4Link = class(TGLLink)
     Length: Real; // fixed
     Length: Real; // fixed
     Angle: Real; // variable
     Angle: Real; // variable
     constructor Create(Length, Angle: Real);
     constructor Create(Length, Angle: Real);
@@ -176,42 +176,42 @@ type
   // V
   // V
   //
   //
 *)
 *)
-  TGLxType5Link = class(TGLxLink)
+  TGLType5Link = class(TGLLink)
     Length: Real; // variable
     Length: Real; // variable
     constructor Create(Length, Angle: Real);
     constructor Create(Length, Angle: Real);
   end;
   end;
 
 
-  TGLxType6Link = class(TGLxLink)
+  TGLType6Link = class(TGLLink)
     Length: Real; // fixed
     Length: Real; // fixed
     Angle: Real; // variable
     Angle: Real; // variable
     constructor Create(Length, Angle: Real);
     constructor Create(Length, Angle: Real);
   end;
   end;
 
 
-  TGLxType7Link = class(TGLxLink)
+  TGLType7Link = class(TGLLink)
     Length: Real; // fixed
     Length: Real; // fixed
     Angle: Real; // variable
     Angle: Real; // variable
     constructor Create(Length, Angle: Real);
     constructor Create(Length, Angle: Real);
   end;
   end;
 
 
-  TGLxType8Link = class(TGLxLink)
+  TGLType8Link = class(TGLLink)
     Length: Real; // variable
     Length: Real; // variable
     constructor Create(Length, Angle: Real);
     constructor Create(Length, Angle: Real);
   end;
   end;
 
 
-  TGLxPrismaticJoint = class(TGLxJoint)
+  TGLPrismaticJoint = class(TGLJoint)
   end;
   end;
 
 
-  TGLxRevoluteJoint = class(TGLxJoint)
+  TGLRevoluteJoint = class(TGLJoint)
   end;
   end;
 
 
-  TGLxBallAndSocketJoint = class(TGLxJoint)
+  TGLBallAndSocketJoint = class(TGLJoint)
   end;
   end;
 
 
 //======================================================================
 //======================================================================
 implementation
 implementation
 //======================================================================
 //======================================================================
 
 
-constructor TGLxLink.Create(LinkLength, TwistAngle, LinkAngle,
+constructor TGLLink.Create(LinkLength, TwistAngle, LinkAngle,
   LinkDistance: Real);
   LinkDistance: Real);
 begin
 begin
   fLinkLength := LinkLength;
   fLinkLength := LinkLength;
@@ -220,42 +220,42 @@ begin
   fLinkDistance := LinkDistance;
   fLinkDistance := LinkDistance;
 end;
 end;
 
 
-constructor TGLxType1Link.Create(Length, Angle: Real);
+constructor TGLType1Link.Create(Length, Angle: Real);
 begin
 begin
   inherited Create(Length, 0, Angle, 0);
   inherited Create(Length, 0, Angle, 0);
 end;
 end;
 
 
-constructor TGLxType2Link.Create(Length, Angle: Real);
+constructor TGLType2Link.Create(Length, Angle: Real);
 begin
 begin
   inherited Create(Length, 0, Angle, 0);
   inherited Create(Length, 0, Angle, 0);
 end;
 end;
 
 
-constructor TGLxType3Link.Create(Length, Angle: Real);
+constructor TGLType3Link.Create(Length, Angle: Real);
 begin
 begin
   inherited Create(Length, 0, Angle, 0);
   inherited Create(Length, 0, Angle, 0);
 end;
 end;
 
 
-constructor TGLxType4Link.Create(Length, Angle: Real);
+constructor TGLType4Link.Create(Length, Angle: Real);
 begin
 begin
   inherited Create(Length, 0, Angle, 0);
   inherited Create(Length, 0, Angle, 0);
 end;
 end;
 
 
-constructor TGLxType5Link.Create(Length, Angle: Real);
+constructor TGLType5Link.Create(Length, Angle: Real);
 begin
 begin
   inherited Create(Length, 0, Angle, 0);
   inherited Create(Length, 0, Angle, 0);
 end;
 end;
 
 
-constructor TGLxType6Link.Create(Length, Angle: Real);
+constructor TGLType6Link.Create(Length, Angle: Real);
 begin
 begin
   inherited Create(Length, 0, Angle, 0);
   inherited Create(Length, 0, Angle, 0);
 end;
 end;
 
 
-constructor TGLxType7Link.Create(Length, Angle: Real);
+constructor TGLType7Link.Create(Length, Angle: Real);
 begin
 begin
   inherited Create(Length, 0, Angle, 0);
   inherited Create(Length, 0, Angle, 0);
 end;
 end;
 
 
-constructor TGLxType8Link.Create(Length, Angle: Real);
+constructor TGLType8Link.Create(Length, Angle: Real);
 begin
 begin
   inherited Create(Length, 0, Angle, 0);
   inherited Create(Length, 0, Angle, 0);
 end;
 end;

+ 898 - 0
Source/Physics.SPIManager.pas

@@ -0,0 +1,898 @@
+//
+// The graphics rendering engine GLScene http://glscene.org
+//
+
+unit Physics.SPIManager;
+
+(* The Manager for Scene Physics Interactions (SPI) *)
+
+interface
+
+uses
+  System.Classes,
+  System.SysUtils,
+  Vcl.Dialogs,
+
+  GLS.XCollection,
+  GLS.VectorGeometry,
+  GLS.Scene,
+  Physics.SPIForces,
+  GLS.Behaviours;
+
+type
+
+  // only ssEuler is usable at the moment
+  TDESolverType = (ssEuler, ssRungeKutta4, ssVerlet);
+  // TDESolver = procedure((*RigidBody:TGLRigidBody;*)DeltaTime:Real) of object;
+  TStateArray = Array of Real;
+  TGLSPIManager = class;
+
+  (*
+    ***Euler***, EulerImproved, EulerModified, MidPoint
+    RungeKutta2, ***RungeKutta4***, RungKutta4Adaptive
+    State Variables:  Position,  Velocity
+
+    Verlet 
+    State Variables:  Position, Old Position
+  *)
+
+  // need to have state array(s) seperate from inertias to allow for implicit & explicit methods
+  TDESolver = class(TObject)
+  public
+    StateSize: Integer;
+    StateArray: TStateArray;
+    Owner: TGLSPIManager;
+    function StateToArray(): TStateArray; virtual;
+    procedure ArrayToState(StateArray: TStateArray); virtual;
+    procedure Solve(DeltaTime: Real); virtual; abstract;
+    constructor Create(aOwner: TGLSPIManager); // override; //abstract;
+    destructor Destroy; override;
+    // procedure Assign(Source: TPersistent); override;
+  end;
+
+  // explicit   e.g. Euler, Mid-point, Runge-Kutta integration
+  TDESolverExplicit = class(TDESolver)
+  public
+    StateArrayDot: TStateArray; // Velocity stored
+    function CalcStateDot(): TStateArray; virtual;
+  end;
+
+  TDESolverEuler = class(TDESolverExplicit)
+  public
+    procedure Solve(DeltaTime: Real); override;
+  end;
+
+  TDESolverRungeKutta4 = class(TDESolverExplicit)
+  public
+    procedure Solve(DeltaTime: Real); override;
+  end;
+
+  // implicit   e.g. Verlet Integration
+  TDESolverImplicit = class(TDESolver)
+  public
+    LastStateArray: TStateArray; // Last state stored
+  end;
+
+  TDESolverVerlet = class(TDESolverImplicit)
+  public
+  end;
+
+  TGLForces = class;
+  TGLBaseForceFieldEmitter = class;
+  // TGLSPIManager = class;
+
+  (* purpose of TGLBaseInertia is to allow for inertias that may be constrained
+   to 1 or 2 dimensions
+   Shouldn't be used directly, instead use TGLParticleInertia (for a 3D particle)
+   TGLRigidBodyInertia (for a 3D rigid-body) or define a new sub-class
+   e.g.  TGL1DParticleInertia, this will allow for faster speed *)
+  TGLBaseInertia = class(TGLBehaviour)
+  private
+    FDampingEnabled: Boolean;
+    FManager: TGLSPIManager;
+    FManagerName: String; // NOT persistent, temporarily used for persistence
+  protected
+    procedure Loaded; override;
+    procedure WriteToFiler(writer: TWriter); override;
+    procedure ReadFromFiler(reader: TReader); override;
+  public
+    StateSize: Integer; // don't re-declare this in sub-classes
+    // just initialise it in constructor
+    procedure StateToArray(var StateArray: TStateArray;
+      StatePos: Integer); virtual;
+    procedure ArrayToState( { var } StateArray: TStateArray;
+      StatePos: Integer); virtual;
+    procedure CalcStateDot(var StateArray: TStateArray;
+      StatePos: Integer); virtual;
+    procedure RemoveForces(); virtual;
+    procedure CalculateForceFieldForce(ForceFieldEmitter
+      : TGLBaseForceFieldEmitter); virtual;
+    procedure CalcAuxiliary(); virtual;
+    procedure SetUpStartingState(); virtual;
+    function CalculateKE(): Real; virtual;
+    function CalculatePE(): Real; virtual;
+    constructor Create(aOwner: TXCollection); override; // abstract;
+    destructor Destroy; override;
+    procedure Assign(Source: TPersistent); override;
+    procedure SetManager(const val: TGLSPIManager);
+  published
+    property DampingEnabled: Boolean read FDampingEnabled write FDampingEnabled;
+    property Manager: TGLSPIManager read FManager write SetManager;
+  end;
+
+  (* A base for different types of force-field behaviours *)
+  TGLBaseForceFieldEmitter = class(TGLBehaviour)
+  private
+    FManager: TGLSPIManager;
+    FManagerName: String; // NOT persistent, temporarily used for persistence
+  protected
+    procedure Loaded; override;
+    procedure WriteToFiler(writer: TWriter); override;
+    procedure ReadFromFiler(reader: TReader); override;
+  public
+    constructor Create(aOwner: TXCollection); override; // abstract;
+    destructor Destroy; override;
+    procedure Assign(Source: TPersistent); override;
+    procedure SetManager(const val: TGLSPIManager);
+    function CalculateForceField(Body: TGLBaseSceneObject): TAffineVector; virtual;
+  published
+    property Manager: TGLSPIManager read FManager write SetManager;
+  end;
+
+  (* The Simple Physics Interaction (SPI) manager can only deal with objects from one scene
+    More than one physics manager can be assigned to a scene *)
+  TGLSPIManager = class(TComponent)
+    // StateSize:Integer;
+  protected
+    fInertias: TList; // list of all inertias with manager = self
+    fForceFieldEmitters: TList; // list of all forcefield emitters
+    fForces: TGLForces; // Collection of forces acting on/between objects
+    fDESolverType: TDESolverType;
+    DESolver: TDESolver;
+    fScene: TGLScene;
+  protected
+    procedure Loaded; override;
+    procedure DefineProperties(Filer: TFiler); override;
+    procedure WriteForces(stream: TStream);
+    procedure ReadForces(stream: TStream);
+    procedure SetForces(const val: TGLForces);
+    function GetForces: TGLForces;
+    procedure SetInertias(const val: TList);
+    procedure SetForceFieldEmitters(const val: TList);
+    procedure SetScene(const val: TGLScene);
+  public
+    procedure RegisterInertia(aInertia: TGLBaseInertia);
+    procedure DeRegisterInertia(aInertia: TGLBaseInertia);
+    procedure DeRegisterAllInertias;
+    procedure RegisterForceFieldEmitter(aForceField: TGLBaseForceFieldEmitter);
+    procedure DeRegisterForceFieldEmitter(aForceField: TGLBaseForceFieldEmitter);
+    procedure DeRegisterAllForceFieldEmitters;
+    procedure Notification(AComponent: TComponent;
+      Operation: TOperation); override;
+    constructor Create(aOwner: TComponent); override;
+    destructor Destroy; override;
+    procedure Assign(Source: TPersistent); override;
+    procedure CalculateNextState(DeltaTime: Real);
+    function CalculateKE(): Real;
+    function CalculatePE(): Real;
+    procedure SetDESolver(SolverType: TDESolverType);
+    function FindObjectByName(Name: String): TGLBaseSceneObject;
+    function FindForceFieldEmitterByName(Name: String): TGLBaseSceneObject;
+    property Inertias: TList read fInertias write SetInertias; // stored False;
+    property ForceFieldEmitters: TList read fForceFieldEmitters
+      write SetForceFieldEmitters; // stored False;
+  published
+    property Forces: TGLForces read GetForces write SetForces; // stored False;
+    property Solver: TDESolverType read fDESolverType write SetDESolver;
+    property Scene: TGLScene read fScene write SetScene;
+  end;
+
+  TGLForces = class(TXCollection)
+  protected
+    function GetForce(index: Integer): TGLForce;
+  public
+    constructor Create(aOwner: TPersistent); override;
+    // destructor Destroy;override;
+    class function ItemsClass: TXCollectionItemClass; override;
+    property Force[index: Integer]: TGLForce read GetForce; default;
+    function CanAdd(aClass: TXCollectionItemClass): Boolean; override;
+  end;
+
+// ------------------------------------------------------------------
+implementation
+// ------------------------------------------------------------------
+
+procedure TGLSPIManager.Notification(AComponent: TComponent;
+  Operation: TOperation);
+begin
+  (* if Operation=opRemove then
+    begin
+    if AComponent=FScene then FScene:=nil;
+    end;
+  *)
+end;
+
+procedure TGLSPIManager.DefineProperties(Filer: TFiler);
+begin
+  inherited DefineProperties(Filer);
+  Filer.DefineBinaryProperty('ForcesData', ReadForces, WriteForces,
+    (Assigned(fForces) and (fForces.Count > 0)));
+end;
+
+procedure TGLSPIManager.Loaded;
+begin
+  inherited Loaded;
+  if Assigned(fForces) then
+    fForces.Loaded;
+end;
+
+function TGLSPIManager.FindObjectByName(Name: String): TGLBaseSceneObject;
+var
+  i: Integer;
+begin
+  Result := nil;
+  for i := 0 to fInertias.Count - 1 do
+  begin
+    if (TGLBaseInertia(fInertias.Items[i]).OwnerBaseSceneObject.GetNamePath =
+      Name) then
+    begin
+      Result := TGLBaseInertia(fInertias.Items[i]).OwnerBaseSceneObject;
+    end
+    else if Owner.FindComponent(Name) <> nil then
+    begin
+      Result := TGLBaseSceneObject(Owner.FindComponent(Name));
+    end;
+  end;
+end;
+
+function TGLSPIManager.FindForceFieldEmitterByName(Name: String)
+  : TGLBaseSceneObject;
+var
+  i: Integer;
+begin
+  Result := nil;
+  for i := 0 to fForceFieldEmitters.Count - 1 do
+  begin
+    if (TGLBaseForceFieldEmitter(fForceFieldEmitters.Items[i])
+      .OwnerBaseSceneObject.GetNamePath = Name) then
+    begin
+      Result := TGLBaseForceFieldEmitter(fForceFieldEmitters.Items[i])
+        .OwnerBaseSceneObject;
+    end;
+  end;
+end;
+
+procedure TGLSPIManager.WriteForces(stream: TStream);
+var
+  writer: TWriter;
+begin
+  // messagedlg('Writing forces',mtInformation,[mbOk],0);
+  writer := TWriter.Create(stream, 16384);
+  try
+    Forces.WriteToFiler(writer);
+  finally
+    writer.Free;
+  end;
+end;
+
+procedure TGLSPIManager.ReadForces(stream: TStream);
+var
+  reader: TReader;
+begin
+  reader := TReader.Create(stream, 16384);
+  try
+    Forces.ReadFromFiler(reader);
+  finally
+    reader.Free;
+  end;
+end;
+
+procedure TGLSPIManager.SetForces(const val: TGLForces);
+begin
+  Forces.Assign(val);
+end;
+
+procedure TGLSPIManager.SetInertias(const val: TList);
+begin
+  fInertias.Assign(val);
+end;
+
+procedure TGLSPIManager.SetForceFieldEmitters(const val: TList);
+begin
+  fForceFieldEmitters.Assign(val);
+end;
+
+procedure TGLSPIManager.SetScene(const val: TGLScene);
+begin
+  // fScene:=val;
+  if fScene <> val then
+  begin
+    if Assigned(fScene) then
+      fScene.RemoveFreeNotification(Self);
+    fScene := val;
+    if Assigned(fScene) then
+      fScene.FreeNotification(Self);
+  end;
+end;
+
+function TGLSPIManager.GetForces: TGLForces;
+begin
+  if not Assigned(fForces) then
+    fForces := TGLForces.Create(Self);
+  Result := fForces;
+end;
+
+// Not accurate yet, because Forces should be re-calculated for each KVector.
+// Since forces will depend on distances between objects, then this will require
+// a central physics manager, that calculates KVector for all objects, then calculate forces
+// between objects for this new estimated state.
+//
+
+function TDESolver.StateToArray(): TStateArray;
+var
+  i { ,j } : Integer;
+  currentpos: Integer;
+  // state:TStateArray;
+begin
+  currentpos := 0;
+  for i := 0 to Owner.fInertias.Count - 1 do
+  begin
+    TGLBaseInertia(Owner.fInertias.Items[i]).StateToArray(StateArray,
+      currentpos);
+    currentpos := currentpos + TGLBaseInertia(Owner.fInertias.Items[i])
+      .StateSize;
+  end;
+  Result := StateArray;
+end;
+
+procedure TDESolver.ArrayToState(StateArray: TStateArray);
+var
+  i: Integer;
+  currentpos: Integer;
+begin
+  currentpos := 0;
+  for i := 0 to Owner.fInertias.Count - 1 do
+  begin
+    TGLBaseInertia(Owner.fInertias.Items[i]).ArrayToState(StateArray,
+      currentpos);
+    currentpos := currentpos + TGLBaseInertia(Owner.fInertias.Items[i])
+      .StateSize;
+  end;
+end;
+
+constructor TDESolver.Create(aOwner: TGLSPIManager);
+begin
+  Self.Owner := aOwner;
+end;
+
+destructor TDESolver.Destroy;
+begin
+  //
+end;
+
+function TDESolverExplicit.CalcStateDot(): TStateArray;
+var
+  i { ,j } : Integer;
+  currentpos: Integer;
+  state: TStateArray;
+begin
+  //
+  SetLength(state, StateSize);
+  for i := 0 to StateSize - 1 do
+    state[i] := StateArray[i];
+  // state:=StateArray;
+  currentpos := 0;
+  for i := 0 to Owner.fInertias.Count - 1 do
+  begin
+    TGLBaseInertia(Owner.fInertias.Items[i]).CalcStateDot(state, currentpos);
+    currentpos := currentpos + TGLBaseInertia(Owner.fInertias.Items[i])
+      .StateSize;
+  end;
+  Result := state;
+end;
+
+procedure TDESolverRungeKutta4.Solve(DeltaTime: Real);
+var
+  // X,X0:TStateArray;
+  Kvectors: array [0 .. 3] of TStateArray;
+  n: Integer;
+  StateArray0: TStateArray;
+  tempStateArray: TStateArray;
+  // tempState:TGLBInertia;
+begin
+  // tempState:=TGLBInertia.Create(nil);
+  // tempState.Assign(Self);
+  tempStateArray := StateToArray();
+  StateArray0 := tempStateArray;
+
+  for n := 0 to 3 do
+    SetLength(Kvectors[n], Length(StateArray0));
+
+  Kvectors[0] := CalcStateDot();
+  for n := 0 to StateSize - 1 do
+    tempStateArray[n] := tempStateArray[n] + DeltaTime / 2 * Kvectors[0][n];
+  ArrayToState(tempStateArray);
+
+  Kvectors[1] := CalcStateDot();
+  for n := 0 to StateSize - 1 do
+    tempStateArray[n] := tempStateArray[n] + DeltaTime / 2 * Kvectors[1][n];
+  ArrayToState(tempStateArray);
+
+  Kvectors[2] := CalcStateDot();
+  for n := 0 to StateSize - 1 do
+    tempStateArray[n] := tempStateArray[n] + DeltaTime / 2 * Kvectors[2][n];
+  ArrayToState(tempStateArray);
+
+  Kvectors[3] := CalcStateDot();
+
+  for n := 0 to StateSize - 1 do
+  begin
+    tempStateArray[n] := StateArray0[n] + DeltaTime / 6 *
+      (Kvectors[0][n] + 2 * Kvectors[1][n] + 2 * Kvectors[2][n] +
+      Kvectors[3][n]);
+  end;
+
+  ArrayToState(tempStateArray);
+
+  // NormalizeQuaternion(AngularOrientation);
+  // tempState.Free();
+end;
+
+procedure TDESolverEuler.Solve(DeltaTime: Real);
+var
+  i, j: Integer;
+  tempState, tempStateDot: TStateArray;
+  // force1:TAffineVector;
+  Inertia1: TGLBaseInertia;
+  tempForce: TAffineVector;
+  // UnDampedMomentum,DampedMomentum:Real;
+begin
+{$IFDEF DEBUG}
+  messagedlg('Euler integration', mtinformation, [mbok], 0);
+{$ENDIF}
+  for i := 0 to Owner.fInertias.Count - 1 do
+  begin
+    Inertia1 := TGLBaseInertia(Owner.fInertias.Items[i]);
+    // TGLRigidBodyInertia(FObjects.Items[i]).SetTorque(0,0,0);
+    for j := 0 to Owner.fForceFieldEmitters.Count - 1 do
+    begin
+      Inertia1.CalculateForceFieldForce
+        (TGLBaseForceFieldEmitter(Owner.fForceFieldEmitters.Items[j]));
+      // Inertia1.ApplyForce(TGLForceFieldEmitter(FForceFieldEmitters.Items[j]).CalculateForceField(Inertia1.OwnerBaseSceneObject));
+    end;
+  end;
+
+  for i := 0 to Owner.Forces.Count - 1 do
+  begin
+    { force1:= } Owner.Forces.Force[i].CalculateForce();
+  end;
+
+  tempState := StateToArray();
+  tempStateDot := CalcStateDot();
+  for i := 0 to StateSize - 1 do
+    tempState[i] := tempState[i] + DeltaTime * tempStateDot[i];
+
+  ArrayToState(tempState);
+
+  for i := 0 to Owner.fInertias.Count - 1 do
+  begin
+    // TGLInertia(FObjects.Items[i]).SetForce(0,0,0);
+    Inertia1 := TGLBaseInertia(Owner.fInertias.Items[i]);
+    if Inertia1.DampingEnabled = true then
+    begin
+      // UnDampedMomentum:=VectorLength(Inertia1.TranslationSpeed.AsAffineVector);
+      // DampedMomentum:= Inertia1.TranslationDamping.Calculate(UnDampedMomentum,deltaTime);
+      // if  UnDampedMomentum<>0 then
+      begin
+        // ScaleVector(Inertia1.TranslationSpeed.AsAffineVector,DampedMomentum/UnDampedMomentum);
+        // ScaleVector(Inertia1.LinearMomentum,DampedMomentum/UnDampedMomentum);
+      end;
+      // Inertia1.TranslationDamping.Calculate(VectorLength(Inertia1.LinearMomentum),deltaTime);
+    end;
+    Inertia1.CalcAuxiliary();
+    Inertia1.RemoveForces();
+  end;
+  // NormalizeQuaternion(AngularOrientation);
+end;
+
+constructor TGLSPIManager.Create(aOwner: TComponent);
+begin
+  inherited Create(aOwner);
+  fInertias := TList.Create();
+  fForceFieldEmitters := TList.Create();
+  fForces := TGLForces.Create(Self);
+  SetDESolver(ssEuler);
+  ///RegisterManager(Self);
+end;
+
+destructor TGLSPIManager.Destroy;
+begin
+  // fScene:=nil;
+  DeRegisterAllInertias();
+  DeRegisterAllForceFieldEmitters();
+///  DeRegisterManager(Self);
+  fInertias.Free();
+  fForceFieldEmitters.Free();
+  fForces.Free();
+  inherited Destroy;
+end;
+
+procedure TGLSPIManager.Assign(Source: TPersistent);
+begin
+  inherited Assign(Source);
+end;
+
+procedure TGLSPIManager.SetDESolver(SolverType: TDESolverType);
+var
+  tempSolver: TDESolver;
+begin
+  if Assigned(DESolver) then
+  begin
+    if (fDESolverType <> SolverType) then
+      case SolverType of
+        ssRungeKutta4:
+          begin
+            // DESolver:=RungeKutta4;
+          end;
+        ssEuler:
+          begin
+            // DESolver:=Euler;
+          end;
+      end;
+  end
+  else
+  begin
+    // if (fDESolverType<>SolverType) then
+    case SolverType of
+      ssRungeKutta4:
+        begin
+          DESolver := TDESolverRungeKutta4.Create(Self);
+        end;
+      ssEuler:
+        begin
+          DESolver := TDESolverEuler.Create(Self);
+        end;
+    end;
+    fDESolverType := SolverType;
+  end;
+end;
+
+procedure TGLSPIManager.RegisterInertia(aInertia: TGLBaseInertia);
+begin
+  if Assigned(aInertia) then
+    if fInertias.IndexOf(aInertia) < 0 then
+    begin
+      fInertias.Add(aInertia);
+      aInertia.FManager := Self;
+      DESolver.StateSize := DESolver.StateSize + aInertia.StateSize;
+      SetLength(DESolver.StateArray, DESolver.StateSize);
+    end;
+end;
+
+procedure TGLSPIManager.DeRegisterInertia(aInertia: TGLBaseInertia);
+begin
+  if Assigned(aInertia) then
+  begin
+    aInertia.FManager := nil;
+    fInertias.Remove(aInertia);
+    DESolver.StateSize := DESolver.StateSize - aInertia.StateSize;
+    SetLength(DESolver.StateArray, DESolver.StateSize);
+  end;
+
+end;
+
+procedure TGLSPIManager.DeRegisterAllInertias;
+var
+  i: Integer;
+begin
+  // Fast deregistration
+  for i := 0 to fInertias.Count - 1 do
+    TGLBaseInertia(fInertias[i]).FManager := nil;
+  fInertias.Clear;
+  DESolver.StateSize := 0;
+  // SetLEngth(StateArray,0);
+end;
+
+procedure TGLSPIManager.RegisterForceFieldEmitter
+  (aForceField: TGLBaseForceFieldEmitter);
+begin
+  if Assigned(aForceField) then
+    if fForceFieldEmitters.IndexOf(aForceField) < 0 then
+    begin
+      fForceFieldEmitters.Add(aForceField);
+      aForceField.FManager := Self;
+    end;
+end;
+
+procedure TGLSPIManager.DeRegisterForceFieldEmitter
+  (aForceField: TGLBaseForceFieldEmitter);
+begin
+  if Assigned(aForceField) then
+  begin
+    aForceField.FManager := nil;
+    fForceFieldEmitters.Remove(aForceField);
+  end;
+end;
+
+procedure TGLSPIManager.DeRegisterAllForceFieldEmitters;
+var
+  i: Integer;
+begin
+  // Fast deregistration
+  for i := 0 to fForceFieldEmitters.Count - 1 do
+    TGLBaseForceFieldEmitter(fForceFieldEmitters[i]).FManager := nil;
+  fForceFieldEmitters.Clear;
+end;
+
+function TGLSPIManager.CalculateKE(): Real;
+var
+  Total: Real;
+  i: Integer;
+begin
+  Total := 0;
+  for i := 0 to fInertias.Count - 1 do
+  begin
+    // calculate fInertias[i] KE
+    Total := Total + TGLBaseInertia(fInertias.Items[i]).CalculateKE();
+  end;
+  Result := Total;
+end;
+
+function TGLSPIManager.CalculatePE(): Real;
+var
+  Total: Real;
+  i: Integer;
+begin
+  Total := 0;
+  for i := 0 to fInertias.Count - 1 do
+  begin
+    // calculate fobject[i] PE
+    Total := Total + TGLBaseInertia(fInertias.Items[i]).CalculatePE();
+  end;
+  Result := Total;
+end;
+
+procedure TGLSPIManager.CalculateNextState(DeltaTime: Real);
+begin
+  if Assigned(DESolver) then
+    DESolver.Solve(DeltaTime);
+end;
+
+constructor TGLForces.Create(aOwner: TPersistent);
+begin
+  // Assert(aOwner is TGLBaseSceneObject);
+  inherited Create(aOwner);
+end;
+
+{ destructor TGLForces.Destroy;
+  begin
+  inherited Destroy;
+  end;
+}
+
+class function TGLForces.ItemsClass: TXCollectionItemClass;
+begin
+  Result := TGLForce;
+end;
+
+function TGLForces.GetForce(index: Integer): TGLForce;
+begin
+  Result := TGLForce(Items[index]);
+end;
+
+function TGLForces.CanAdd(aClass: TXCollectionItemClass): Boolean;
+begin
+  Result := { (not aClass.InheritsFrom(TGLEffect)) and }
+    (inherited CanAdd(aClass));
+end;
+
+// -----------------------------------------------------------------------------
+
+procedure TGLBaseInertia.SetManager(const val: TGLSPIManager);
+begin
+  if val <> FManager then
+  begin
+    if Assigned(FManager) then
+      FManager.DeRegisterInertia(Self);
+    if Assigned(val) then
+      val.RegisterInertia(Self);
+    // messagedlg(val.GetNamePath,mtinformation,[mbok],0);
+  end;
+end;
+
+procedure TGLBaseInertia.Loaded;
+var
+  mng: TComponent;
+begin
+  inherited;
+  if FManagerName <> '' then
+  begin
+///?    mng := FindManager(TGLSPIManager, FManagerName);
+    if Assigned(mng) then
+      Manager := TGLSPIManager(mng);
+    FManagerName := '';
+  end;
+end;
+
+procedure TGLBaseInertia.WriteToFiler(writer: TWriter);
+begin
+  inherited; // Dan Bartlett
+  with writer do
+  begin
+    WriteInteger(0); // Archive Version 0
+    WriteBoolean(FDampingEnabled);
+    if Assigned(FManager) then
+      WriteString(FManager.GetNamePath)
+    else
+      WriteString('');
+  end;
+end;
+
+procedure TGLBaseInertia.ReadFromFiler(reader: TReader);
+begin
+  inherited;
+  with reader do
+  begin
+    ReadInteger; // ignore archiveVersion
+    FDampingEnabled := ReadBoolean;
+    FManagerName := ReadString;
+    Manager := nil;
+  end;
+  // Loaded;     //DB100
+end;
+
+constructor TGLBaseInertia.Create(aOwner: TXCollection);
+begin
+  inherited Create(aOwner);
+  FDampingEnabled := true;
+end;
+
+destructor TGLBaseInertia.Destroy;
+begin
+  SetManager(nil);
+  inherited Destroy;
+end;
+
+procedure TGLBaseInertia.Assign(Source: TPersistent);
+begin
+  if Source.ClassType = Self.ClassType then
+  begin
+    StateSize := TGLBaseInertia(Source).StateSize;
+    FDampingEnabled := TGLBaseInertia(Source).DampingEnabled;
+    Manager := TGLBaseInertia(Source).Manager;
+  end;
+  inherited Assign(Source);
+end;
+
+procedure TGLBaseInertia.StateToArray(var StateArray: TStateArray;
+  StatePos: Integer);
+begin
+end;
+
+procedure TGLBaseInertia.ArrayToState( { var } StateArray: TStateArray;
+  StatePos: Integer);
+begin
+end;
+
+procedure TGLBaseInertia.CalcStateDot(var StateArray: TStateArray;
+  StatePos: Integer);
+begin
+end;
+
+procedure TGLBaseInertia.RemoveForces();
+begin
+end;
+
+procedure TGLBaseInertia.CalculateForceFieldForce(ForceFieldEmitter
+  : TGLBaseForceFieldEmitter);
+begin
+end;
+
+function TGLBaseInertia.CalculateKE(): Real;
+begin
+  Result := 0;
+end;
+
+function TGLBaseInertia.CalculatePE(): Real;
+begin
+  Result := 0;
+end;
+
+procedure TGLBaseInertia.CalcAuxiliary();
+begin
+end;
+
+procedure TGLBaseInertia.SetUpStartingState();
+begin
+end;
+
+// -----------------------------------------------------------------------------
+
+procedure TGLBaseForceFieldEmitter.SetManager(const val: TGLSPIManager);
+begin
+  if val <> FManager then
+  begin
+    if Assigned(FManager) then
+      FManager.DeRegisterForceFieldEmitter(Self);
+    if Assigned(val) then
+      val.RegisterForceFieldEmitter(Self);
+  end;
+end;
+
+procedure TGLBaseForceFieldEmitter.Loaded;
+var
+  mng: TComponent;
+begin
+  inherited;
+  if FManagerName <> '' then
+  begin
+///?    mng := FindManager(TGLSPIManager, FManagerName);
+    if Assigned(mng) then
+      Manager := TGLSPIManager(mng);
+    FManagerName := '';
+  end;
+end;
+
+procedure TGLBaseForceFieldEmitter.WriteToFiler(writer: TWriter);
+begin
+  inherited; // Dan Bartlett
+  with writer do
+  begin
+    WriteInteger(0); // Archive Version 0
+    if Assigned(FManager) then
+      WriteString(FManager.GetNamePath)
+    else
+      WriteString('');
+  end;
+end;
+
+procedure TGLBaseForceFieldEmitter.ReadFromFiler(reader: TReader);
+begin
+  inherited;
+  with reader do
+  begin
+    ReadInteger; // ignore archiveVersion
+    FManagerName := ReadString;
+    Manager := nil;
+  end;
+  // Loaded;  //DB100
+end;
+
+constructor TGLBaseForceFieldEmitter.Create(aOwner: TXCollection);
+begin
+  inherited Create(aOwner);
+end;
+
+destructor TGLBaseForceFieldEmitter.Destroy;
+begin
+  SetManager(nil);
+  inherited Destroy;
+end;
+
+procedure TGLBaseForceFieldEmitter.Assign(Source: TPersistent);
+begin
+  if Source.ClassType = Self.ClassType then
+  begin
+    Manager := TGLBaseForceFieldEmitter(Source).Manager;
+  end;
+  inherited Assign(Source);
+end;
+
+// CalculateForceField
+function TGLBaseForceFieldEmitter.CalculateForceField(Body: TGLBaseSceneObject)
+  : TAffineVector;
+begin
+  Result := nullVector;
+end;
+
+// ------------------------------------------------------------------
+initialization
+// ------------------------------------------------------------------
+
+// RegisterClasses([TGLForces]);
+// RegisterClasses([TGLSPIManager, TGLBaseInertia, TGLBaseForceFieldEmitter]);
+// RegisterXCollectionItemClass(TGLBaseInertia);
+// RegisterXCollectionItemClass(TGLBaseForceFieldEmitter);
+// RegisterXCollectionItemClass(TGLPhysicsForce);
+
+end.

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно