Browse Source

Merged VerletCollision and VerletTypes units

GLScene 4 years ago
parent
commit
159076e257
32 changed files with 1503 additions and 1137 deletions
  1. 2 2
      AdvDemos/Delphi/GLSViewer/GLSViewer.dproj
  2. 1 0
      Demos/CPP/glslshaders/BumpShader/Unit1.dfm
  3. 98 11
      Demos/CPP/glslshaders/PostShader/Unit1.cpp
  4. 511 30
      Demos/CPP/glslshaders/PostShader/Unit1.dfm
  5. 10 8
      Demos/CPP/glslshaders/PostShader/Unit1.h
  6. 1 0
      Demos/CPP/glslshaders/SimpleGLSL/SimpleGLSLUnit.cpp
  7. 2 0
      Demos/CPP/glslshaders/SimpleGLSL/SimpleGLSLUnit.dfm
  8. 9 9
      Demos/CPP/physics/OdeFurball/Unit1.cpp
  9. 3 4
      Demos/CPP/physics/OdeFurball/Unit1.h
  10. 13 10
      Demos/Delphi/glslshaders/PostShaderFm.dfm
  11. 133 75
      Demos/Delphi/glslshaders/PostShaderFm.pas
  12. BIN
      Demos/Delphi/physics/ClothActor.jpg
  13. 7 8
      Demos/Delphi/physics/ClothActorFm.pas
  14. BIN
      Demos/Delphi/physics/NewtonJoints.jpg
  15. BIN
      Demos/Delphi/physics/NewtonMaterial.jpg
  16. BIN
      Demos/Delphi/physics/NewtonMousePick.jpg
  17. BIN
      Demos/Delphi/physics/NewtonSimple.jpg
  18. BIN
      Demos/Delphi/physics/OdeClothify.jpg
  19. 254 221
      Demos/Delphi/physics/OdeClothifyFm.pas
  20. BIN
      Demos/Delphi/physics/OdeFurBall.jpg
  21. 11 12
      Demos/Delphi/physics/OdeFurballFm.pas
  22. BIN
      Demos/Delphi/physics/OdeMachine.jpg
  23. BIN
      Demos/Delphi/physics/OdeRagdoll.jpg
  24. BIN
      Demos/Delphi/physics/OdeSimple.jpg
  25. 159 70
      Demos/Delphi/physics/aPhysics.htm
  26. 20 22
      Packages/GLScene_RT.dpk
  27. 20 22
      Packages/GLScene_RT.dproj
  28. 2 8
      Source/Cg.Shader.pas
  29. 0 1
      Source/GLS.Color.pas
  30. 0 219
      Source/GLS.VerletHairClasses.pas
  31. 0 257
      Source/GLS.VerletSkeletonColliders.pas
  32. 247 148
      Source/GLS.VerletTypes.pas

+ 2 - 2
AdvDemos/Delphi/GLSViewer/GLSViewer.dproj

@@ -100,14 +100,14 @@
     </PropertyGroup>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
     <PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
         <BT_BuildType>Debug</BT_BuildType>
         <BT_BuildType>Debug</BT_BuildType>
-        <VerInfo_Build>91</VerInfo_Build>
+        <VerInfo_Build>92</VerInfo_Build>
         <AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
         <AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
         <VerInfo_AutoIncVersion>true</VerInfo_AutoIncVersion>
         <VerInfo_AutoIncVersion>true</VerInfo_AutoIncVersion>
         <VerInfo_MinorVer>8</VerInfo_MinorVer>
         <VerInfo_MinorVer>8</VerInfo_MinorVer>
         <VerInfo_Debug>true</VerInfo_Debug>
         <VerInfo_Debug>true</VerInfo_Debug>
         <VerInfo_Locale>1033</VerInfo_Locale>
         <VerInfo_Locale>1033</VerInfo_Locale>
         <Icon_MainIcon>Resource\GLSViewer.ico</Icon_MainIcon>
         <Icon_MainIcon>Resource\GLSViewer.ico</Icon_MainIcon>
-        <VerInfo_Keys>CompanyName=;FileVersion=1.8.0.91;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.8.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)</VerInfo_Keys>
+        <VerInfo_Keys>CompanyName=;FileVersion=1.8.0.92;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.8.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)</VerInfo_Keys>
         <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
         <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
     </PropertyGroup>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Cfg_2_Win64)'!=''">
     <PropertyGroup Condition="'$(Cfg_2_Win64)'!=''">

+ 1 - 0
Demos/CPP/glslshaders/BumpShader/Unit1.dfm

@@ -34,6 +34,7 @@ object Form1: TForm1
     OnMouseDown = ViewerMouseDown
     OnMouseDown = ViewerMouseDown
     OnMouseMove = ViewerMouseMove
     OnMouseMove = ViewerMouseMove
     TabOrder = 0
     TabOrder = 0
+    ExplicitTop = 2
   end
   end
   object Panel1: TPanel
   object Panel1: TPanel
     Left = 0
     Left = 0

+ 98 - 11
Demos/CPP/glslshaders/PostShader/Unit1.cpp

@@ -54,13 +54,72 @@ void __fastcall TForm1::FormCreate(TObject *Sender)
   MaterialLibrary->LibMaterialByName("Earth")->Material->Texture->Image->LoadFromFile("Earth.jpg");
   MaterialLibrary->LibMaterialByName("Earth")->Material->Texture->Image->LoadFromFile("Earth.jpg");
   MaterialLibrary->LibMaterialByName("Fighter")->Material->Texture->Image->LoadFromFile("Waste.jpg");
   MaterialLibrary->LibMaterialByName("Fighter")->Material->Texture->Image->LoadFromFile("Waste.jpg");
   MaterialLibrary->LibMaterialByName("Noise")->Material->Texture->Image->LoadFromFile("Flare1.bmp");
   MaterialLibrary->LibMaterialByName("Noise")->Material->Texture->Image->LoadFromFile("Flare1.bmp");
+  // MaterialLibrary->LibMaterialByName('Noise')->Material->Texture->Image->LoadFromFile("wikiNoise.jpg");
+  MaterialLibrary->LibMaterialByName('Mask')->Material->Texture->Image->LoadFromFile("wikiMask.jpg");
 
 
   // Blur Shader
   // Blur Shader
   BlurShader = new TGLSLPostBlurShader(this);
   BlurShader = new TGLSLPostBlurShader(this);
+  BlurShader->Enabled = false;
+  BlurShader->Threshold = 0.001;
   PostShaderHolder->Shaders->Add()->Shader = BlurShader;
   PostShaderHolder->Shaders->Add()->Shader = BlurShader;
-
   ShaderCheckListBox->Items->AddObject("Blur Shader", BlurShader);
   ShaderCheckListBox->Items->AddObject("Blur Shader", BlurShader);
-  ShaderCheckListBox->Checked[0] = True;
+  ShaderCheckListBox->Checked[0] = false;
+
+  // ThermalVision Shader
+  ThermalVisionShader = new TGLSLPostThermalVisionShader(this);
+  ThermalVisionShader->Enabled = false;
+  PostShaderHolder->Shaders->Add->Shader = ThermalVisionShader;
+  ShaderCheckListBox->Items->AddObject('Thermal Vision Shader',
+	ThermalVisionShader);
+  ShaderCheckListBox->Checked[1] = false;
+
+  // DreamVision Shader
+  DreamVisionShader = new TGLSLPostDreamVisionShader(this);
+  DreamVisionShader->Enabled = false;
+  PostShaderHolder->Shaders->Add->Shader = DreamVisionShader;
+  ShaderCheckListBox->Items.AddObject('Dream Vision Shader', DreamVisionShader);
+  ShaderCheckListBox->Checked[2] = false;
+
+  // NightVision Shader
+  NightVisionShader = new TGLSLPostNightVisionShader(this);
+  NightVisionShader->Enabled = false;
+  NightVisionShader->MaterialLibrary = MaterialLibrary;
+  NightVisionShader->NoiseTexName = 'Noise';
+  NightVisionShader->MaskTexName = 'Mask';
+  NightVisionShader->UseMask = 1;
+  PostShaderHolder->Shaders->Add.Shader = NightVisionShader;
+  ShaderCheckListBox->Items->AddObject('Night Vision Shader', NightVisionShader);
+  ShaderCheckListBox->Checked[3] = false;
+
+  // Pixelate Shader
+  PixelateShader = new TGLSLPostPixelateShader(this);
+  PixelateShader->Enabled = false;
+  PostShaderHolder->Shaders->Add->Shader = PixelateShader;
+  ShaderCheckListBox->Items->AddObject('Pixelate Shader', PixelateShader);
+  ShaderCheckListBox->Checked[4] = false;
+
+  // Posterize Shader
+  PosterizeShader = new TGLSLPostPosterizeShader(this);
+  PosterizeShader->Enabled = false;
+  PostShaderHolder->Shaders->Add->Shader = PosterizeShader;
+  ShaderCheckListBox->Items->AddObject('Posterize Shader', PosterizeShader);
+  ShaderCheckListBox->Checked[5] = false;
+
+  // Frost Shader
+  FrostShader = new TGLSLPostFrostShader(this);
+  FrostShader->Enabled = false;
+  PostShaderHolder->Shaders->Add->Shader = FrostShader;
+  ShaderCheckListBox->Items->AddObject('Frost Shader', FrostShader);
+  ShaderCheckListBox->Checked[6] = false;
+
+  // Trouble Shader
+  TroubleShader = new TGLSLPostTroubleShader(this);
+  TroubleShader->Enabled = false;
+  TroubleShader->MaterialLibrary = MaterialLibrary;
+  TroubleShader->NoiseTexName = 'Noise';
+  PostShaderHolder->Shaders->Add->Shader = TroubleShader;
+  ShaderCheckListBox->Items->AddObject('Trouble Shader', TroubleShader);
+  ShaderCheckListBox->Checked[7] = false;
 
 
   // Transformation Shader
   // Transformation Shader
   TransformationShader = new TGLCGPostTransformationShader(this);
   TransformationShader = new TGLCGPostTransformationShader(this);
@@ -70,9 +129,10 @@ void __fastcall TForm1::FormCreate(TObject *Sender)
   ShaderCheckListBox->Items->AddObject("Transformation Shader", TransformationShader);
   ShaderCheckListBox->Items->AddObject("Transformation Shader", TransformationShader);
   ShaderCheckListBox->Checked[1] = true;
   ShaderCheckListBox->Checked[1] = true;
 }
 }
+
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
 void __fastcall TForm1::CadencerProgress(TObject *Sender, const double deltaTime,
 void __fastcall TForm1::CadencerProgress(TObject *Sender, const double deltaTime,
-          const double newTime)
+		  const double newTime)
 {
 {
   Viewer->Invalidate();
   Viewer->Invalidate();
 
 
@@ -83,37 +143,64 @@ void __fastcall TForm1::CadencerProgress(TObject *Sender, const double deltaTime
 	Sphere_little->Roll(40 * deltaTime);
 	Sphere_little->Roll(40 * deltaTime);
 	Teapot->Roll(-20 * deltaTime);
 	Teapot->Roll(-20 * deltaTime);
   }
   }
+  if NightVisionShader->Enabled
+	NightVisionShader->ElapsedTime = newTime; // 20*deltaTime;
 }
 }
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
 void __fastcall TForm1::LightCubeProgress(TObject *Sender, const double deltaTime,
 void __fastcall TForm1::LightCubeProgress(TObject *Sender, const double deltaTime,
-          const double newTime)
+		  const double newTime)
 {
 {
   if (LightMovingCheckBox->Checked)
   if (LightMovingCheckBox->Checked)
 	LightCube->MoveObjectAround(Camera->TargetObject, sin(newTime) * deltaTime * 10, deltaTime * 20);
 	LightCube->MoveObjectAround(Camera->TargetObject, sin(newTime) * deltaTime * 10, deltaTime * 20);
+}
 
 
+//---------------------------------------------------------------------------
+void __fastcall TForm1::ShaderCheckListBoxClick(TObject *Sender)
+{
+  int I;
+  if (ShaderCheckListBox->Items->Count != 0)
+	for (I = 0; I < ShaderCheckListBox->Items->Count - 1; I++) {
+///	  TGLShader(ShaderCheckListBox->Items->Objects[I])->Enabled = ShaderCheckListBox->Checked[I];
+	}
 }
 }
+
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
-void __fastcall TForm1::BigBlurThicknessCheckboxClick(TObject *Sender)
+
+void __fastcall TForm1::tbBlurValueChange(TObject *Sender)
 {
 {
   if (BigBlurThicknessCheckbox->Checked)
   if (BigBlurThicknessCheckbox->Checked)
 	BlurShader->Threshold = 0.005;
 	BlurShader->Threshold = 0.005;
   else
   else
 	BlurShader->Threshold = 0.2;
 	BlurShader->Threshold = 0.2;
 
 
+//---------------------------------------------------------------------------
+
+void __fastcall TForm1::tbDreamThresholdChange(TObject *Sender)
+{
+//
 }
 }
+
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
-void __fastcall TForm1::ShaderCheckListBoxClick(TObject *Sender)
+
+void __fastcall TForm1::tbThermalThresholdChange(TObject *Sender)
 {
 {
-  int I;
-  if (ShaderCheckListBox->Items->Count != 0)
-	for (I = 0; I < ShaderCheckListBox->Items->Count - 1; I++) {
-///	  TGLShader(ShaderCheckListBox->Items->Objects[I])->Enabled = ShaderCheckListBox->Checked[I];
-	}
+//
+}
+
+//---------------------------------------------------------------------------
+
+void __fastcall TForm1::tbThermalIntensityChange(TObject *Sender)
+{
+//
 }
 }
 
 
+
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
 void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
 void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
 {
 {
   Cadencer->Enabled = false;
   Cadencer->Enabled = false;
 }
 }
+}
+
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
+

+ 511 - 30
Demos/CPP/glslshaders/PostShader/Unit1.dfm

@@ -1,18 +1,17 @@
 object Form1: TForm1
 object Form1: TForm1
-  Left = 0
-  Top = 0
+  Left = 261
+  Top = 176
   Caption = 'GLSL Post Shader'
   Caption = 'GLSL Post Shader'
-  ClientHeight = 432
-  ClientWidth = 576
+  ClientHeight = 620
+  ClientWidth = 769
   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 = 'Tahoma'
+  Font.Name = 'MS Sans Serif'
   Font.Style = []
   Font.Style = []
   OldCreateOrder = False
   OldCreateOrder = False
   Position = poScreenCenter
   Position = poScreenCenter
-  WindowState = wsMaximized
   OnClose = FormClose
   OnClose = FormClose
   OnCreate = FormCreate
   OnCreate = FormCreate
   PixelsPerInch = 96
   PixelsPerInch = 96
@@ -20,23 +19,23 @@ object Form1: TForm1
   object Viewer: TGLSceneViewer
   object Viewer: TGLSceneViewer
     Left = 0
     Left = 0
     Top = 0
     Top = 0
-    Width = 417
-    Height = 403
+    Width = 546
+    Height = 591
     Camera = Camera
     Camera = Camera
     Buffer.BackgroundColor = clBackground
     Buffer.BackgroundColor = clBackground
     Buffer.ContextOptions = [roDoubleBuffer, roStencilBuffer, roRenderToWindow]
     Buffer.ContextOptions = [roDoubleBuffer, roStencilBuffer, roRenderToWindow]
     Buffer.AntiAliasing = aaNone
     Buffer.AntiAliasing = aaNone
     Buffer.DepthPrecision = dp24bits
     Buffer.DepthPrecision = dp24bits
     Buffer.ColorDepth = cd24bits
     Buffer.ColorDepth = cd24bits
-    FieldOfView = 144.242599487304700000
+    FieldOfView = 153.215011596679700000
     PenAsTouch = False
     PenAsTouch = False
     Align = alClient
     Align = alClient
     TabOrder = 0
     TabOrder = 0
   end
   end
   object Panel1: TPanel
   object Panel1: TPanel
     Left = 0
     Left = 0
-    Top = 403
-    Width = 576
+    Top = 591
+    Width = 769
     Height = 29
     Height = 29
     Align = alBottom
     Align = alBottom
     TabOrder = 1
     TabOrder = 1
@@ -58,42 +57,518 @@ object Form1: TForm1
       Width = 137
       Width = 137
       Height = 17
       Height = 17
       Caption = 'Turn-Pitch-Roll Enabled'
       Caption = 'Turn-Pitch-Roll Enabled'
+      Checked = True
+      State = cbChecked
       TabOrder = 1
       TabOrder = 1
     end
     end
   end
   end
   object Panel2: TPanel
   object Panel2: TPanel
-    Left = 417
+    Left = 546
     Top = 0
     Top = 0
-    Width = 159
-    Height = 403
+    Width = 223
+    Height = 591
     Align = alRight
     Align = alRight
     TabOrder = 2
     TabOrder = 2
     object Label1: TLabel
     object Label1: TLabel
       Left = 16
       Left = 16
       Top = 8
       Top = 8
-      Width = 43
+      Width = 42
       Height = 13
       Height = 13
       Caption = 'Shaders:'
       Caption = 'Shaders:'
     end
     end
+    object Label2: TLabel
+      Left = 6
+      Top = 184
+      Width = 48
+      Height = 13
+      Caption = 'Blur Value'
+    end
+    object lblBlurValue: TLabel
+      Left = 188
+      Top = 184
+      Width = 15
+      Height = 13
+      Caption = '0.0'
+      Font.Charset = DEFAULT_CHARSET
+      Font.Color = clWindowText
+      Font.Height = -11
+      Font.Name = 'MS Sans Serif'
+      Font.Style = []
+      ParentFont = False
+    end
+    object Label3: TLabel
+      Left = 6
+      Top = 217
+      Width = 88
+      Height = 13
+      Caption = 'Thermal Threshold'
+    end
+    object lblThermalThreshold: TLabel
+      Left = 188
+      Top = 217
+      Width = 15
+      Height = 13
+      Caption = '0.0'
+      Font.Charset = DEFAULT_CHARSET
+      Font.Color = clWindowText
+      Font.Height = -11
+      Font.Name = 'MS Sans Serif'
+      Font.Style = []
+      ParentFont = False
+    end
+    object Label5: TLabel
+      Left = 6
+      Top = 251
+      Width = 80
+      Height = 13
+      Caption = 'Thermal Intensity'
+    end
+    object lblThermalIntensity: TLabel
+      Left = 188
+      Top = 251
+      Width = 15
+      Height = 13
+      Caption = '0.0'
+      Font.Charset = DEFAULT_CHARSET
+      Font.Color = clWindowText
+      Font.Height = -11
+      Font.Name = 'MS Sans Serif'
+      Font.Style = []
+      ParentFont = False
+    end
+    object Label4: TLabel
+      Left = 6
+      Top = 319
+      Width = 75
+      Height = 13
+      Caption = 'Night Threshold'
+    end
+    object lblNight: TLabel
+      Left = 188
+      Top = 319
+      Width = 15
+      Height = 13
+      Caption = '0.0'
+      Font.Charset = DEFAULT_CHARSET
+      Font.Color = clWindowText
+      Font.Height = -11
+      Font.Name = 'MS Sans Serif'
+      Font.Style = []
+      ParentFont = False
+    end
+    object Label6: TLabel
+      Left = 6
+      Top = 353
+      Width = 87
+      Height = 13
+      Caption = 'Night Amplification'
+    end
+    object lblNightAmplification: TLabel
+      Left = 188
+      Top = 353
+      Width = 15
+      Height = 13
+      Caption = '0.0'
+      Font.Charset = DEFAULT_CHARSET
+      Font.Color = clWindowText
+      Font.Height = -11
+      Font.Name = 'MS Sans Serif'
+      Font.Style = []
+      ParentFont = False
+    end
+    object Label7: TLabel
+      Left = 6
+      Top = 285
+      Width = 81
+      Height = 13
+      Caption = 'Dream Threshold'
+    end
+    object lblDreamThreshold: TLabel
+      Left = 188
+      Top = 285
+      Width = 15
+      Height = 13
+      Caption = '0.0'
+      Font.Charset = DEFAULT_CHARSET
+      Font.Color = clWindowText
+      Font.Height = -11
+      Font.Name = 'MS Sans Serif'
+      Font.Style = []
+      ParentFont = False
+    end
+    object Label8: TLabel
+      Left = 6
+      Top = 387
+      Width = 68
+      Height = 13
+      Caption = 'Pixelate Width'
+    end
+    object lblPixelateWidth: TLabel
+      Left = 188
+      Top = 387
+      Width = 6
+      Height = 13
+      Caption = '1'
+      Font.Charset = DEFAULT_CHARSET
+      Font.Color = clWindowText
+      Font.Height = -11
+      Font.Name = 'MS Sans Serif'
+      Font.Style = []
+      ParentFont = False
+    end
+    object Label9: TLabel
+      Left = 6
+      Top = 421
+      Width = 71
+      Height = 13
+      Caption = 'Pixelate Height'
+    end
+    object lblPixelateHeight: TLabel
+      Left = 188
+      Top = 421
+      Width = 6
+      Height = 13
+      Caption = '1'
+      Font.Charset = DEFAULT_CHARSET
+      Font.Color = clWindowText
+      Font.Height = -11
+      Font.Name = 'MS Sans Serif'
+      Font.Style = []
+      ParentFont = False
+    end
+    object Label10: TLabel
+      Left = 6
+      Top = 455
+      Width = 82
+      Height = 13
+      Caption = 'Posterize Gamma'
+    end
+    object lblPosterizeGamma: TLabel
+      Left = 188
+      Top = 455
+      Width = 15
+      Height = 13
+      Caption = '0.0'
+      Font.Charset = DEFAULT_CHARSET
+      Font.Color = clWindowText
+      Font.Height = -11
+      Font.Name = 'MS Sans Serif'
+      Font.Style = []
+      ParentFont = False
+    end
+    object Label12: TLabel
+      Left = 6
+      Top = 489
+      Width = 83
+      Height = 13
+      Caption = 'Posterize NColors'
+    end
+    object lblPosterizeColors: TLabel
+      Left = 188
+      Top = 489
+      Width = 15
+      Height = 13
+      Caption = '0.0'
+      Font.Charset = DEFAULT_CHARSET
+      Font.Color = clWindowText
+      Font.Height = -11
+      Font.Name = 'MS Sans Serif'
+      Font.Style = []
+      ParentFont = False
+    end
+    object Label11: TLabel
+      Left = 6
+      Top = 523
+      Width = 55
+      Height = 13
+      Caption = 'Frost Rand '
+    end
+    object lblFrostRand: TLabel
+      Left = 188
+      Top = 523
+      Width = 15
+      Height = 13
+      Caption = '0.0'
+      Font.Charset = DEFAULT_CHARSET
+      Font.Color = clWindowText
+      Font.Height = -11
+      Font.Name = 'MS Sans Serif'
+      Font.Style = []
+      ParentFont = False
+    end
+    object Label14: TLabel
+      Left = 6
+      Top = 557
+      Width = 56
+      Height = 13
+      Caption = 'Frost Factor'
+    end
+    object lblFrostFactor: TLabel
+      Left = 188
+      Top = 557
+      Width = 15
+      Height = 13
+      Caption = '0.0'
+      Font.Charset = DEFAULT_CHARSET
+      Font.Color = clWindowText
+      Font.Height = -11
+      Font.Name = 'MS Sans Serif'
+      Font.Style = []
+      ParentFont = False
+    end
+    object Label13: TLabel
+      Left = 6
+      Top = 601
+      Width = 67
+      Height = 13
+      Caption = 'Trouble Width'
+    end
+    object lblTroubleWidth: TLabel
+      Left = 188
+      Top = 601
+      Width = 15
+      Height = 13
+      Caption = '0.0'
+      Font.Charset = DEFAULT_CHARSET
+      Font.Color = clWindowText
+      Font.Height = -11
+      Font.Name = 'MS Sans Serif'
+      Font.Style = []
+      ParentFont = False
+    end
+    object Label16: TLabel
+      Left = 6
+      Top = 640
+      Width = 70
+      Height = 13
+      Caption = 'Trouble Height'
+    end
+    object lblTroubleHeight: TLabel
+      Left = 188
+      Top = 640
+      Width = 15
+      Height = 13
+      Caption = '0.0'
+      Font.Charset = DEFAULT_CHARSET
+      Font.Color = clWindowText
+      Font.Height = -11
+      Font.Name = 'MS Sans Serif'
+      Font.Style = []
+      ParentFont = False
+    end
+    object Label18: TLabel
+      Left = 6
+      Top = 679
+      Width = 60
+      Height = 13
+      Caption = 'Trouble Freq'
+    end
+    object lblTroubleFreq: TLabel
+      Left = 188
+      Top = 679
+      Width = 15
+      Height = 13
+      Caption = '0.0'
+      Font.Charset = DEFAULT_CHARSET
+      Font.Color = clWindowText
+      Font.Height = -11
+      Font.Name = 'MS Sans Serif'
+      Font.Style = []
+      ParentFont = False
+    end
     object ShaderCheckListBox: TCheckListBox
     object ShaderCheckListBox: TCheckListBox
       Left = 8
       Left = 8
       Top = 24
       Top = 24
-      Width = 145
+      Width = 207
       Height = 145
       Height = 145
+      OnClickCheck = ShaderCheckListBoxClick
       ItemHeight = 13
       ItemHeight = 13
       TabOrder = 0
       TabOrder = 0
       OnClick = ShaderCheckListBoxClick
       OnClick = ShaderCheckListBoxClick
     end
     end
-    object BigBlurThicknessCheckbox: TCheckBox
-      Left = 6
-      Top = 376
-      Width = 115
-      Height = 17
-      Caption = 'Big blur Thickness'
-      Checked = True
-      State = cbChecked
+    object tbBlurValue: TTrackBar
+      Left = 85
+      Top = 180
+      Width = 97
+      Height = 27
+      Max = 100
+      Min = 1
+      PageSize = 1
+      Position = 1
       TabOrder = 1
       TabOrder = 1
-      OnClick = BigBlurThicknessCheckboxClick
+      TickStyle = tsNone
+      OnChange = tbBlurValueChange
+    end
+    object tbThermalThreshold: TTrackBar
+      Left = 85
+      Top = 213
+      Width = 97
+      Height = 27
+      Max = 100
+      Min = 1
+      PageSize = 1
+      Position = 1
+      TabOrder = 2
+      TickStyle = tsNone
+      OnChange = tbThermalThresholdChange
+    end
+    object tbThermalIntensity: TTrackBar
+      Left = 92
+      Top = 248
+      Width = 97
+      Height = 27
+      Max = 100
+      Min = 1
+      PageSize = 1
+      Position = 1
+      TabOrder = 3
+      TickStyle = tsNone
+      OnChange = tbThermalIntensityChange
+    end
+    object tblNightThreshold: TTrackBar
+      Left = 91
+      Top = 317
+      Width = 97
+      Height = 27
+      Max = 100
+      Min = 1
+      PageSize = 1
+      Position = 1
+      TabOrder = 4
+      TickStyle = tsNone
+    end
+    object tbNightAmplification: TTrackBar
+      Left = 91
+      Top = 351
+      Width = 97
+      Height = 27
+      Max = 1000
+      Min = 1
+      PageSize = 1
+      Position = 1
+      TabOrder = 5
+      TickStyle = tsNone
+    end
+    object tbDreamThreshold: TTrackBar
+      Left = 93
+      Top = 281
+      Width = 97
+      Height = 27
+      Max = 200
+      Min = 1
+      PageSize = 1
+      Position = 1
+      TabOrder = 6
+      TickStyle = tsNone
+      OnChange = tbDreamThresholdChange
+    end
+    object tbPixelateWidth: TTrackBar
+      Left = 91
+      Top = 385
+      Width = 97
+      Height = 27
+      Max = 64
+      Min = 1
+      PageSize = 1
+      Position = 1
+      TabOrder = 7
+      TickStyle = tsNone
+    end
+    object tbPixelateHeight: TTrackBar
+      Left = 91
+      Top = 419
+      Width = 97
+      Height = 27
+      Max = 64
+      Min = 1
+      PageSize = 1
+      Position = 1
+      TabOrder = 8
+      TickStyle = tsNone
+    end
+    object tbPosterizeGamma: TTrackBar
+      Left = 91
+      Top = 454
+      Width = 97
+      Height = 27
+      Max = 300
+      Min = 1
+      PageSize = 1
+      Position = 1
+      TabOrder = 9
+      TickStyle = tsNone
+    end
+    object tbPosterizeColors: TTrackBar
+      Left = 91
+      Top = 488
+      Width = 97
+      Height = 27
+      Max = 255
+      Min = 1
+      PageSize = 1
+      Position = 1
+      TabOrder = 10
+      TickStyle = tsNone
+    end
+    object tbFrostRand: TTrackBar
+      Left = 91
+      Top = 522
+      Width = 97
+      Height = 27
+      Max = 500
+      Min = 10
+      PageSize = 1
+      Position = 10
+      TabOrder = 11
+      TickStyle = tsNone
+    end
+    object tbFrostFactor: TTrackBar
+      Left = 91
+      Top = 557
+      Width = 97
+      Height = 27
+      Max = 250
+      Min = 1
+      PageSize = 1
+      Position = 1
+      TabOrder = 12
+      TickStyle = tsNone
+    end
+    object tbTroubleWidth: TTrackBar
+      Left = 91
+      Top = 601
+      Width = 91
+      Height = 27
+      Max = 64
+      Min = 1
+      PageSize = 1
+      Position = 1
+      TabOrder = 13
+      TickStyle = tsNone
+    end
+    object tbTroubleHeight: TTrackBar
+      Left = 91
+      Top = 634
+      Width = 91
+      Height = 27
+      Max = 64
+      Min = 1
+      PageSize = 1
+      Position = 1
+      TabOrder = 14
+      TickStyle = tsNone
+    end
+    object tbTroubleFreq: TTrackBar
+      Left = 83
+      Top = 679
+      Width = 99
+      Height = 27
+      Max = 300
+      Min = 1
+      PageSize = 1
+      Position = 1
+      TabOrder = 15
+      TickStyle = tsNone
     end
     end
   end
   end
   object Scene: TGLScene
   object Scene: TGLScene
@@ -195,7 +670,7 @@ object Form1: TForm1
     Scene = Scene
     Scene = Scene
     MaxDeltaTime = 0.020000000000000000
     MaxDeltaTime = 0.020000000000000000
     OnProgress = CadencerProgress
     OnProgress = CadencerProgress
-    Left = 120
+    Left = 96
     Top = 16
     Top = 16
   end
   end
   object MaterialLibrary: TGLMaterialLibrary
   object MaterialLibrary: TGLMaterialLibrary
@@ -234,9 +709,15 @@ object Form1: TForm1
         Name = 'FireGrade'
         Name = 'FireGrade'
         Tag = 0
         Tag = 0
         Material.Texture.Disabled = False
         Material.Texture.Disabled = False
+      end
+      item
+        Name = 'Mask'
+        Tag = 0
+        Material.Texture.Disabled = False
+        Material.Texture.DepthTextureMode = dtmIntensity
       end>
       end>
-    Left = 32
-    Top = 88
+    Left = 40
+    Top = 80
   end
   end
   object GLSimpleNavigation1: TGLSimpleNavigation
   object GLSimpleNavigation1: TGLSimpleNavigation
     Form = Owner
     Form = Owner
@@ -255,7 +736,7 @@ object Form1: TForm1
         ShiftState = [ssRight]
         ShiftState = [ssRight]
         Action = snaMoveAroundTarget
         Action = snaMoveAroundTarget
       end>
       end>
-    Left = 128
-    Top = 88
+    Left = 192
+    Top = 16
   end
   end
 end
 end

+ 10 - 8
Demos/CPP/glslshaders/PostShader/Unit1.h

@@ -10,10 +10,11 @@
 #include <Vcl.CheckLst.hpp>
 #include <Vcl.CheckLst.hpp>
 #include <Vcl.ExtCtrls.hpp>
 #include <Vcl.ExtCtrls.hpp>
 #include <Vcl.Imaging.jpeg.hpp>
 #include <Vcl.Imaging.jpeg.hpp>
+#include <Vcl.ComCtrls.hpp>
+
 #include "GLS.BaseClasses.hpp"
 #include "GLS.BaseClasses.hpp"
 #include "GLS.Cadencer.hpp"
 #include "GLS.Cadencer.hpp"
 #include "GLS.Coordinates.hpp"
 #include "GLS.Coordinates.hpp"
-
 #include "GLS.GeomObjects.hpp"
 #include "GLS.GeomObjects.hpp"
 #include "GLS.Graph.hpp"
 #include "GLS.Graph.hpp"
 #include "GLS.Material.hpp"
 #include "GLS.Material.hpp"
@@ -24,15 +25,16 @@
 #include "GLS.SceneViewer.hpp"
 #include "GLS.SceneViewer.hpp"
 #include "GLS.Utils.hpp"
 #include "GLS.Utils.hpp"
 
 
-#include "GLSL.PostShaders.hpp"
-#include "CGs.PostTransformationShader.hpp"
-
 // FileFormats
 // FileFormats
 #include "GLS.FileTGA.hpp"
 #include "GLS.FileTGA.hpp"
 #include "GLS.FileMD2.hpp"
 #include "GLS.FileMD2.hpp"
 #include "GLS.FileMS3D.hpp"
 #include "GLS.FileMS3D.hpp"
 #include "GLS.File3DS.hpp"
 #include "GLS.File3DS.hpp"
+
+// Shader headers
+#include "GLSL.PostShaders.hpp"
 #include "GLSL.PostEffects.hpp"
 #include "GLSL.PostEffects.hpp"
+#include "CG.PostTransformationShader.hpp"
 
 
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
 class TForm1 : public TForm
 class TForm1 : public TForm
@@ -45,7 +47,6 @@ __published:	// IDE-managed Components
 	TPanel *Panel2;
 	TPanel *Panel2;
 	TLabel *Label1;
 	TLabel *Label1;
 	TCheckListBox *ShaderCheckListBox;
 	TCheckListBox *ShaderCheckListBox;
-	TCheckBox *BigBlurThicknessCheckbox;
 	TGLScene *Scene;
 	TGLScene *Scene;
 	TGLDummyCube *GUICube;
 	TGLDummyCube *GUICube;
 	TGLArrowLine *GLArrowLine1;
 	TGLArrowLine *GLArrowLine1;
@@ -66,11 +67,12 @@ __published:	// IDE-managed Components
 	void __fastcall FormCreate(TObject *Sender);
 	void __fastcall FormCreate(TObject *Sender);
 	void __fastcall CadencerProgress(TObject *Sender, const double deltaTime, const double newTime);
 	void __fastcall CadencerProgress(TObject *Sender, const double deltaTime, const double newTime);
 	void __fastcall LightCubeProgress(TObject *Sender, const double deltaTime, const double newTime);
 	void __fastcall LightCubeProgress(TObject *Sender, const double deltaTime, const double newTime);
-	void __fastcall BigBlurThicknessCheckboxClick(TObject *Sender);
 	void __fastcall ShaderCheckListBoxClick(TObject *Sender);
 	void __fastcall ShaderCheckListBoxClick(TObject *Sender);
 	void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
 	void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
-
-
+	void __fastcall tbThermalThresholdChange(TObject *Sender);
+	void __fastcall tbBlurValueChange(TObject *Sender);
+	void __fastcall tbDreamThresholdChange(TObject *Sender);
+	void __fastcall tbThermalIntensityChange(TObject *Sender);
 private:	// User declarations
 private:	// User declarations
 	int mx, my;
 	int mx, my;
 	TGLSLPostBlurShader *BlurShader;
 	TGLSLPostBlurShader *BlurShader;

+ 1 - 0
Demos/CPP/glslshaders/SimpleGLSL/SimpleGLSLUnit.cpp

@@ -56,6 +56,7 @@ void __fastcall TForm1::FormCreate(TObject *Sender)
   MatLib->LibMaterialByName("Brick01")->Material->Texture->Image->LoadFromFile("mur_NormalMap.bmp");
   MatLib->LibMaterialByName("Brick01")->Material->Texture->Image->LoadFromFile("mur_NormalMap.bmp");
   MatLib->LibMaterialByName("Brick02")->Material->Texture->Image->LoadFromFile("mur_Ambiant.bmp");
   MatLib->LibMaterialByName("Brick02")->Material->Texture->Image->LoadFromFile("mur_Ambiant.bmp");
   MatLib->LibMaterialByName("Brick03")->Material->Texture->Image->LoadFromFile("mur_Hauteur.bmp");
   MatLib->LibMaterialByName("Brick03")->Material->Texture->Image->LoadFromFile("mur_Hauteur.bmp");
+
 }
 }
 
 
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------

+ 2 - 0
Demos/CPP/glslshaders/SimpleGLSL/SimpleGLSLUnit.dfm

@@ -34,6 +34,8 @@ object Form1: TForm1
     OnMouseDown = GLSceneViewer1MouseDown
     OnMouseDown = GLSceneViewer1MouseDown
     OnMouseMove = GLSceneViewer1MouseMove
     OnMouseMove = GLSceneViewer1MouseMove
     TabOrder = 0
     TabOrder = 0
+    ExplicitLeft = -7
+    ExplicitTop = 7
   end
   end
   object GLScene1: TGLScene
   object GLScene1: TGLScene
     Left = 176
     Left = 176

+ 9 - 9
Demos/CPP/physics/OdeFurball/Unit1.cpp

@@ -106,11 +106,11 @@ void __fastcall TForm1::FormCreate(TObject *Sender)
   CheckBox_FurGravityClick(Sender);
   CheckBox_FurGravityClick(Sender);
   CheckBox_WindResistenceClick(Sender);
   CheckBox_WindResistenceClick(Sender);
 
 
-  CreateVCPlaneFromGLPlane(GLShadowPlane_Floor, VerletWorld, cOffset);
-  CreateVCPlaneFromGLPlane(GLShadowPlane_Floor2, VerletWorld, cOffset);
-  CreateVCPlaneFromGLPlane(GLShadowPlane_Wall, VerletWorld, cOffset);
-  CreateVCPlaneFromGLPlane(GLShadowPlane_Wall2, VerletWorld, cOffset);
-  CreateVCPlaneFromGLPlane(GLShadowPlane_Wall3, VerletWorld, cOffset);
+  CreateVerletPlaneFromGLPlane(GLShadowPlane_Floor, VerletWorld, cOffset);
+  CreateVerletPlaneFromGLPlane(GLShadowPlane_Floor2, VerletWorld, cOffset);
+  CreateVerletPlaneFromGLPlane(GLShadowPlane_Wall, VerletWorld, cOffset);
+  CreateVerletPlaneFromGLPlane(GLShadowPlane_Wall2, VerletWorld, cOffset);
+  CreateVerletPlaneFromGLPlane(GLShadowPlane_Wall3, VerletWorld, cOffset);
 
 
   HairList = new TList;
   HairList = new TList;
 
 
@@ -223,7 +223,7 @@ void __fastcall TForm1::CreateRandomHair()
   Dir = AffineVectorMake(random() - 0.5, random() - 0.5, random() - 0.5);
   Dir = AffineVectorMake(random() - 0.5, random() - 0.5, random() - 0.5);
   NormalizeVector(Dir);
   NormalizeVector(Dir);
 
 
-  TVHStiffnessSet vhs;
+  TGLStiffnessSetVH vhs;
   vhs << vhsSkip1Node;
   vhs << vhsSkip1Node;
   Hair =
   Hair =
 	new TGLVerletHair(VerletWorld, FurBall->Radius * cRootDepth,
 	new TGLVerletHair(VerletWorld, FurBall->Radius * cRootDepth,
@@ -295,7 +295,7 @@ void __fastcall TForm1::CreateBall()
 
 
   CopyPosFromGeomToGL(odeFurBallGeom, FurBall);
   CopyPosFromGeomToGL(odeFurBallGeom, FurBall);
 
 
-  VCSphere = new TVCSphere(VerletWorld);
+  VCSphere = new TGLVerletFricSphere(VerletWorld);
   VCSphere->Radius = FurBall->Radius * 1.1;
   VCSphere->Radius = FurBall->Radius * 1.1;
   VCSphere->Location = AffineVectorMake(FurBall->AbsolutePosition);
   VCSphere->Location = AffineVectorMake(FurBall->AbsolutePosition);
 
 
@@ -310,7 +310,7 @@ void __fastcall TForm1::CheckBox_FurGravityClick(TObject *Sender)
 	delete Gravity;
 	delete Gravity;
   else
   else
   {
   {
-	Gravity = new TVFGravity(VerletWorld);
+	Gravity = new TGLVerletGravity(VerletWorld);
 	Gravity->Gravity = AffineVectorMake(0, 0, -9.81);
 	Gravity->Gravity = AffineVectorMake(0, 0, -9.81);
   }
   }
 }
 }
@@ -323,7 +323,7 @@ void __fastcall TForm1::CheckBox_WindResistenceClick(TObject *Sender)
 	delete AirResistance;
 	delete AirResistance;
   else
   else
   {
   {
-	AirResistance = new TVFAirResistance(VerletWorld);
+	AirResistance = new TGLVerletAirResistance(VerletWorld);
 	AirResistance->DragCoeff = 0.01;
 	AirResistance->DragCoeff = 0.01;
 	AirResistance->WindDirection = AffineVectorMake(1, 0, 0);
 	AirResistance->WindDirection = AffineVectorMake(1, 0, 0);
 	AirResistance->WindMagnitude =
 	AirResistance->WindMagnitude =

+ 3 - 4
Demos/CPP/physics/OdeFurball/Unit1.h

@@ -26,7 +26,6 @@
 #include "GLS.Keyboard.hpp"
 #include "GLS.Keyboard.hpp"
 #include "GLS.Coordinates.hpp"
 #include "GLS.Coordinates.hpp"
 
 
-#include "GLS.VerletHairClasses.hpp"
 #include "GLS.VerletTypes.hpp"
 #include "GLS.VerletTypes.hpp"
 
 
 
 
@@ -91,11 +90,11 @@ public:		// User declarations
 
 
   TGLVerletWorld *VerletWorld;
   TGLVerletWorld *VerletWorld;
   TList *HairList;
   TList *HairList;
-  TVCSphere *VCSphere;
+  TGLVerletFricSphere *VCSphere;
   float PhysicsTime;
   float PhysicsTime;
 
 
-  TVFGravity *Gravity;
-  TVFAirResistance *AirResistance;
+  TGLVerletGravity *Gravity;
+  TGLVerletAirResistance *AirResistance;
 
 
   void __fastcall CreateBall();
   void __fastcall CreateBall();
   void __fastcall CreateFur();
   void __fastcall CreateFur();

+ 13 - 10
Demos/Delphi/glslshaders/PostShaderFm.dfm

@@ -2,8 +2,8 @@ object PostShaderDemoForm: TPostShaderDemoForm
   Left = 261
   Left = 261
   Top = 176
   Top = 176
   Caption = 'GLSL Post Shader'
   Caption = 'GLSL Post Shader'
-  ClientHeight = 466
-  ClientWidth = 646
+  ClientHeight = 548
+  ClientWidth = 661
   Color = clBtnFace
   Color = clBtnFace
   Font.Charset = DEFAULT_CHARSET
   Font.Charset = DEFAULT_CHARSET
   Font.Color = clWindowText
   Font.Color = clWindowText
@@ -12,7 +12,6 @@ object PostShaderDemoForm: TPostShaderDemoForm
   Font.Style = []
   Font.Style = []
   OldCreateOrder = False
   OldCreateOrder = False
   Position = poScreenCenter
   Position = poScreenCenter
-  WindowState = wsMaximized
   OnClose = FormClose
   OnClose = FormClose
   OnCreate = FormCreate
   OnCreate = FormCreate
   PixelsPerInch = 96
   PixelsPerInch = 96
@@ -20,26 +19,28 @@ object PostShaderDemoForm: TPostShaderDemoForm
   object Viewer: TGLSceneViewer
   object Viewer: TGLSceneViewer
     Left = 0
     Left = 0
     Top = 0
     Top = 0
-    Width = 423
-    Height = 437
+    Width = 438
+    Height = 519
     Camera = Camera
     Camera = Camera
     Buffer.BackgroundColor = clBackground
     Buffer.BackgroundColor = clBackground
     Buffer.ContextOptions = [roDoubleBuffer, roStencilBuffer, roRenderToWindow]
     Buffer.ContextOptions = [roDoubleBuffer, roStencilBuffer, roRenderToWindow]
     Buffer.AntiAliasing = aaNone
     Buffer.AntiAliasing = aaNone
     Buffer.DepthPrecision = dp24bits
     Buffer.DepthPrecision = dp24bits
     Buffer.ColorDepth = cd24bits
     Buffer.ColorDepth = cd24bits
-    FieldOfView = 145.832611083984400000
+    FieldOfView = 146.937835693359400000
     PenAsTouch = False
     PenAsTouch = False
     Align = alClient
     Align = alClient
     TabOrder = 0
     TabOrder = 0
   end
   end
   object Panel1: TPanel
   object Panel1: TPanel
     Left = 0
     Left = 0
-    Top = 437
-    Width = 646
+    Top = 519
+    Width = 661
     Height = 29
     Height = 29
     Align = alBottom
     Align = alBottom
     TabOrder = 1
     TabOrder = 1
+    ExplicitTop = 437
+    ExplicitWidth = 646
     object LightMovingCheckBox: TCheckBox
     object LightMovingCheckBox: TCheckBox
       Left = 8
       Left = 8
       Top = 8
       Top = 8
@@ -64,12 +65,14 @@ object PostShaderDemoForm: TPostShaderDemoForm
     end
     end
   end
   end
   object Panel2: TPanel
   object Panel2: TPanel
-    Left = 423
+    Left = 438
     Top = 0
     Top = 0
     Width = 223
     Width = 223
-    Height = 437
+    Height = 519
     Align = alRight
     Align = alRight
     TabOrder = 2
     TabOrder = 2
+    ExplicitLeft = 423
+    ExplicitHeight = 437
     object Label1: TLabel
     object Label1: TLabel
       Left = 16
       Left = 16
       Top = 8
       Top = 8

+ 133 - 75
Demos/Delphi/glslshaders/PostShaderFm.pas

@@ -9,7 +9,7 @@ uses
   Vcl.Graphics,
   Vcl.Graphics,
   Vcl.Controls,
   Vcl.Controls,
   Vcl.Forms,
   Vcl.Forms,
-  CheckLst,
+  Vcl.CheckLst,
   Vcl.ExtCtrls,
   Vcl.ExtCtrls,
   Vcl.StdCtrls,
   Vcl.StdCtrls,
   Vcl.ComCtrls,
   Vcl.ComCtrls,
@@ -18,7 +18,6 @@ uses
   GLS.Cadencer,
   GLS.Cadencer,
   GLS.SceneViewer,
   GLS.SceneViewer,
   GLS.Scene,
   GLS.Scene,
-  GLSL.PostEffects,
   GLS.Graph,
   GLS.Graph,
   GLS.Utils,
   GLS.Utils,
   GLS.Context,
   GLS.Context,
@@ -28,12 +27,13 @@ uses
   GLS.Objects,
   GLS.Objects,
   GLS.VectorFileObjects,
   GLS.VectorFileObjects,
   GLS.SimpleNavigation,
   GLS.SimpleNavigation,
- 
+
   GLS.Material,
   GLS.Material,
   GLS.BaseClasses,
   GLS.BaseClasses,
   GLSL.PostShaders,
   GLSL.PostShaders,
+  GLSL.PostEffects,
 
 
-  CGs.PostTransformationShader,
+  CG.PostTransformationShader,
   GLS.FileMD2,
   GLS.FileMD2,
   GLS.FileMS3D,
   GLS.FileMS3D,
   GLS.File3DS;
   GLS.File3DS;
@@ -44,7 +44,7 @@ type
     Viewer: TGLSceneViewer;
     Viewer: TGLSceneViewer;
     Cadencer: TGLCadencer;
     Cadencer: TGLCadencer;
     Camera: TGLCamera;
     Camera: TGLCamera;
-    Light:  TGLLightSource;
+    Light: TGLLightSource;
     LightCube: TGLDummyCube;
     LightCube: TGLDummyCube;
     GLSphere1: TGLSphere;
     GLSphere1: TGLSphere;
     GLXYZGrid1: TGLXYZGrid;
     GLXYZGrid1: TGLXYZGrid;
@@ -110,9 +110,11 @@ type
     lblTroubleFreq: TLabel;
     lblTroubleFreq: TLabel;
     tbTroubleFreq: TTrackBar;
     tbTroubleFreq: TTrackBar;
     procedure FormCreate(Sender: TObject);
     procedure FormCreate(Sender: TObject);
-    procedure CadencerProgress(Sender: TObject; const deltaTime, newTime: double);
+    procedure CadencerProgress(Sender: TObject;
+      const deltaTime, newTime: double);
     procedure FormClose(Sender: TObject; var Action: TCloseAction);
     procedure FormClose(Sender: TObject; var Action: TCloseAction);
-    procedure LightCubeProgress(Sender: TObject; const deltaTime, newTime: Double);
+    procedure LightCubeProgress(Sender: TObject;
+      const deltaTime, newTime: double);
     procedure ShaderCheckListBoxClick(Sender: TObject);
     procedure ShaderCheckListBoxClick(Sender: TObject);
     procedure tbBlurValueChange(Sender: TObject);
     procedure tbBlurValueChange(Sender: TObject);
     procedure tbThermalThresholdChange(Sender: TObject);
     procedure tbThermalThresholdChange(Sender: TObject);
@@ -132,16 +134,17 @@ type
   end;
   end;
 
 
 var
 var
-  PostShaderDemoForm:  TPostShaderDemoForm;
+  PostShaderDemoForm: TPostShaderDemoForm;
+  //Shaders
   BlurShader: TGLSLPostBlurShader;
   BlurShader: TGLSLPostBlurShader;
+  ThermalVisionShader: TGLSLPostThermalVisionShader;
   TransformationShader: TGLCGPostTransformationShader;
   TransformationShader: TGLCGPostTransformationShader;
-  ThermalVisionShader : TGLSLPostThermalVisionShader;
-  DreamVisionShader : TGLSLPostDreamVisionShader;
-  NightVisionShader : TGLSLPostNightVisionShader;
-  PixelateShader : TGLSLPostPixelateShader;
-  PosterizeShader : TGLSLPostPosterizeShader;
-  FrostShader : TGLSLPostFrostShader;
-  TroubleShader : TGLSLPostTroubleShader;
+  DreamVisionShader: TGLSLPostDreamVisionShader;
+  NightVisionShader: TGLSLPostNightVisionShader;
+  PosterizeShader: TGLSLPostPosterizeShader;
+  FrostShader: TGLSLPostFrostShader;
+  PixelateShader: TGLSLPostPixelateShader;
+  TroubleShader: TGLSLPostTroubleShader;
 
 
 implementation
 implementation
 
 
@@ -151,12 +154,12 @@ procedure TPostShaderDemoForm.FormCreate(Sender: TObject);
 begin
 begin
   // First load models.
   // First load models.
   SetGLSceneMediaDir();
   SetGLSceneMediaDir();
-  Fighter.LoadFromFile('waste.md2'); //Fighter
+  Fighter.LoadFromFile('waste.md2'); // Fighter
   Fighter.SwitchToAnimation(0, True);
   Fighter.SwitchToAnimation(0, True);
   Fighter.AnimationMode := aamLoop;
   Fighter.AnimationMode := aamLoop;
   Fighter.Scale.Scale(2);
   Fighter.Scale.Scale(2);
 
 
-  Teapot.LoadFromFile('Teapot.3ds'); //Teapot (no texture coordinates)
+  Teapot.LoadFromFile('Teapot.3ds'); // Teapot (no texture coordinates)
   Teapot.Scale.Scale(0.8);
   Teapot.Scale.Scale(0.8);
 
 
   Sphere_big.LoadFromFile('Sphere_big.3DS');
   Sphere_big.LoadFromFile('Sphere_big.3DS');
@@ -164,90 +167,97 @@ begin
 
 
   Sphere_little.LoadFromFile('Sphere_little.3ds');
   Sphere_little.LoadFromFile('Sphere_little.3ds');
   Sphere_little.Scale.Scale(4);
   Sphere_little.Scale.Scale(4);
-
   // Then load textures.
   // Then load textures.
-  MaterialLibrary.LibMaterialByName('Earth').Material.Texture.Image.LoadFromFile('Earth.jpg');
-  MaterialLibrary.LibMaterialByName('Fighter').Material.Texture.Image.LoadFromFile('Waste.jpg');
-  MaterialLibrary.LibMaterialByName('Noise').Material.Texture.Image.LoadFromFile('Flare1.bmp');
-//  MaterialLibrary.LibMaterialByName('Noise').Material.Texture.Image.LoadFromFile('wikiNoise.jpg');
-  MaterialLibrary.LibMaterialByName('Mask').Material.Texture.Image.LoadFromFile('wikiMask.jpg');
+  MaterialLibrary.LibMaterialByName('Earth').Material.Texture.Image.LoadFromFile
+    ('Earth.jpg');
+  MaterialLibrary.LibMaterialByName('Fighter')
+    .Material.Texture.Image.LoadFromFile('Waste.jpg');
+  MaterialLibrary.LibMaterialByName('Noise').Material.Texture.Image.LoadFromFile
+    ('Flare1.bmp');
+  // MaterialLibrary.LibMaterialByName('Noise').Material.Texture.Image.LoadFromFile('wikiNoise.jpg');
+  MaterialLibrary.LibMaterialByName('Mask').Material.Texture.Image.LoadFromFile
+    ('wikiMask.jpg');
 
 
   // Blur Shader
   // Blur Shader
   BlurShader := TGLSLPostBlurShader.Create(Self);
   BlurShader := TGLSLPostBlurShader.Create(Self);
-  BlurShader.Enabled :=false;
+  BlurShader.Enabled := false;
   BlurShader.Threshold := 0.001;
   BlurShader.Threshold := 0.001;
   PostShaderHolder.Shaders.Add.Shader := BlurShader;
   PostShaderHolder.Shaders.Add.Shader := BlurShader;
   ShaderCheckListBox.Items.AddObject('Blur Shader', BlurShader);
   ShaderCheckListBox.Items.AddObject('Blur Shader', BlurShader);
-  ShaderCheckListBox.Checked[0] := False;
+  ShaderCheckListBox.Checked[0] := false;
 
 
   // ThermalVision Shader
   // ThermalVision Shader
   ThermalVisionShader := TGLSLPostThermalVisionShader.Create(Self);
   ThermalVisionShader := TGLSLPostThermalVisionShader.Create(Self);
-  ThermalVisionShader.Enabled :=false;
+  ThermalVisionShader.Enabled := false;
   PostShaderHolder.Shaders.Add.Shader := ThermalVisionShader;
   PostShaderHolder.Shaders.Add.Shader := ThermalVisionShader;
-  ShaderCheckListBox.Items.AddObject('Thermal Vision Shader', ThermalVisionShader);
-  ShaderCheckListBox.Checked[1] := False;
+  ShaderCheckListBox.Items.AddObject('Thermal Vision Shader',
+    ThermalVisionShader);
+  ShaderCheckListBox.Checked[1] := false;
 
 
   // DreamVision Shader
   // DreamVision Shader
   DreamVisionShader := TGLSLPostDreamVisionShader.Create(Self);
   DreamVisionShader := TGLSLPostDreamVisionShader.Create(Self);
   DreamVisionShader.Enabled := false;
   DreamVisionShader.Enabled := false;
   PostShaderHolder.Shaders.Add.Shader := DreamVisionShader;
   PostShaderHolder.Shaders.Add.Shader := DreamVisionShader;
   ShaderCheckListBox.Items.AddObject('Dream Vision Shader', DreamVisionShader);
   ShaderCheckListBox.Items.AddObject('Dream Vision Shader', DreamVisionShader);
-  ShaderCheckListBox.Checked[2] := False;
+  ShaderCheckListBox.Checked[2] := false;
 
 
   // NightVision Shader
   // NightVision Shader
   NightVisionShader := TGLSLPostNightVisionShader.Create(Self);
   NightVisionShader := TGLSLPostNightVisionShader.Create(Self);
   NightVisionShader.Enabled := false;
   NightVisionShader.Enabled := false;
   NightVisionShader.MaterialLibrary := MaterialLibrary;
   NightVisionShader.MaterialLibrary := MaterialLibrary;
-  NightVisionShader.NoiseTexName:='Noise';
-  NightVisionShader.MaskTexName:='Mask';
-  NightVisionShader.UseMask:=1;
+  NightVisionShader.NoiseTexName := 'Noise';
+  NightVisionShader.MaskTexName := 'Mask';
+  NightVisionShader.UseMask := 1;
   PostShaderHolder.Shaders.Add.Shader := NightVisionShader;
   PostShaderHolder.Shaders.Add.Shader := NightVisionShader;
   ShaderCheckListBox.Items.AddObject('Night Vision Shader', NightVisionShader);
   ShaderCheckListBox.Items.AddObject('Night Vision Shader', NightVisionShader);
-  ShaderCheckListBox.Checked[3] := False;
-
+  ShaderCheckListBox.Checked[3] := false;
 
 
   // Pixelate Shader
   // Pixelate Shader
   PixelateShader := TGLSLPostPixelateShader.Create(Self);
   PixelateShader := TGLSLPostPixelateShader.Create(Self);
   PixelateShader.Enabled := false;
   PixelateShader.Enabled := false;
   PostShaderHolder.Shaders.Add.Shader := PixelateShader;
   PostShaderHolder.Shaders.Add.Shader := PixelateShader;
   ShaderCheckListBox.Items.AddObject('Pixelate Shader', PixelateShader);
   ShaderCheckListBox.Items.AddObject('Pixelate Shader', PixelateShader);
-  ShaderCheckListBox.Checked[4] := False;
+  ShaderCheckListBox.Checked[4] := false;
 
 
   // Posterize Shader
   // Posterize Shader
   PosterizeShader := TGLSLPostPosterizeShader.Create(Self);
   PosterizeShader := TGLSLPostPosterizeShader.Create(Self);
   PosterizeShader.Enabled := false;
   PosterizeShader.Enabled := false;
   PostShaderHolder.Shaders.Add.Shader := PosterizeShader;
   PostShaderHolder.Shaders.Add.Shader := PosterizeShader;
   ShaderCheckListBox.Items.AddObject('Posterize Shader', PosterizeShader);
   ShaderCheckListBox.Items.AddObject('Posterize Shader', PosterizeShader);
-  ShaderCheckListBox.Checked[5] := False;
+  ShaderCheckListBox.Checked[5] := false;
 
 
   // Frost Shader
   // Frost Shader
   FrostShader := TGLSLPostFrostShader.Create(Self);
   FrostShader := TGLSLPostFrostShader.Create(Self);
   FrostShader.Enabled := false;
   FrostShader.Enabled := false;
   PostShaderHolder.Shaders.Add.Shader := FrostShader;
   PostShaderHolder.Shaders.Add.Shader := FrostShader;
   ShaderCheckListBox.Items.AddObject('Frost Shader', FrostShader);
   ShaderCheckListBox.Items.AddObject('Frost Shader', FrostShader);
-  ShaderCheckListBox.Checked[6] := False;
+  ShaderCheckListBox.Checked[6] := false;
 
 
   // Trouble Shader
   // Trouble Shader
   TroubleShader := TGLSLPostTroubleShader.Create(Self);
   TroubleShader := TGLSLPostTroubleShader.Create(Self);
   TroubleShader.Enabled := false;
   TroubleShader.Enabled := false;
   TroubleShader.MaterialLibrary := MaterialLibrary;
   TroubleShader.MaterialLibrary := MaterialLibrary;
-  TroubleShader.NoiseTexName:='Noise';
+  TroubleShader.NoiseTexName := 'Noise';
   PostShaderHolder.Shaders.Add.Shader := TroubleShader;
   PostShaderHolder.Shaders.Add.Shader := TroubleShader;
   ShaderCheckListBox.Items.AddObject('Trouble Shader', TroubleShader);
   ShaderCheckListBox.Items.AddObject('Trouble Shader', TroubleShader);
-  ShaderCheckListBox.Checked[7] := False;
+  ShaderCheckListBox.Checked[7] := false;
 
 
   // Transformation Shader
   // Transformation Shader
   TransformationShader := TGLCGPostTransformationShader.Create(Self);
   TransformationShader := TGLCGPostTransformationShader.Create(Self);
-  TransformationShader.TransformationTexture := MaterialLibrary.LibMaterialByName('Noise').Material.Texture;
+  TransformationShader.TransformationTexture :=
+    MaterialLibrary.LibMaterialByName('Noise').Material.Texture;
   PostShaderHolder.Shaders.Add.Shader := TransformationShader;
   PostShaderHolder.Shaders.Add.Shader := TransformationShader;
-  ShaderCheckListBox.Items.AddObject('Transformation Shader', TransformationShader);
+  ShaderCheckListBox.Items.AddObject('Transformation Shader',
+    TransformationShader);
   ShaderCheckListBox.Checked[8] := True;
   ShaderCheckListBox.Checked[8] := True;
 end;
 end;
 
 
-procedure TPostShaderDemoForm.CadencerProgress(Sender: TObject; const deltaTime, newTime: double);
+//-------------------------------------------------------
+
+procedure TPostShaderDemoForm.CadencerProgress(Sender: TObject;
+  const deltaTime, newTime: double);
 begin
 begin
   Viewer.Invalidate;
   Viewer.Invalidate;
-
   if TurnPitchrollCheckBox.Checked then
   if TurnPitchrollCheckBox.Checked then
   begin
   begin
     Fighter.Roll(20 * deltaTime);
     Fighter.Roll(20 * deltaTime);
@@ -256,16 +266,21 @@ begin
     Sphere_little.Roll(40 * deltaTime);
     Sphere_little.Roll(40 * deltaTime);
     Teapot.Roll(-20 * deltaTime);
     Teapot.Roll(-20 * deltaTime);
   end;
   end;
-  if NightVisionShader.Enabled then NightVisionShader.ElapsedTime := newTime; //20*deltaTime;
+  if NightVisionShader.Enabled then
+    NightVisionShader.ElapsedTime := newTime; // 20*deltaTime;
 end;
 end;
 
 
-procedure TPostShaderDemoForm.LightCubeProgress(Sender: TObject; const deltaTime,
-  newTime: Double);
+//-------------------------------------------------------
+
+procedure TPostShaderDemoForm.LightCubeProgress(Sender: TObject;
+  const deltaTime, newTime: double);
 begin
 begin
   if LightMovingCheckBox.Checked then
   if LightMovingCheckBox.Checked then
-    LightCube.MoveObjectAround(Camera.TargetObject, sin(NewTime) * deltaTime * 10, deltaTime * 20);
+    LightCube.MoveObjectAround(Camera.TargetObject, sin(newTime) * deltaTime *
+      10, deltaTime * 20);
 end;
 end;
 
 
+//-------------------------------------------------------
 
 
 procedure TPostShaderDemoForm.ShaderCheckListBoxClick(Sender: TObject);
 procedure TPostShaderDemoForm.ShaderCheckListBoxClick(Sender: TObject);
 var
 var
@@ -273,102 +288,145 @@ var
 begin
 begin
   if ShaderCheckListBox.Items.Count <> 0 then
   if ShaderCheckListBox.Items.Count <> 0 then
     for I := 0 to ShaderCheckListBox.Items.Count - 1 do
     for I := 0 to ShaderCheckListBox.Items.Count - 1 do
-      TGLShader(ShaderCheckListBox.Items.Objects[I]).Enabled := ShaderCheckListBox.Checked[I];
+      TGLShader(ShaderCheckListBox.Items.Objects[I]).Enabled :=
+        ShaderCheckListBox.Checked[I];
 end;
 end;
 
 
+//-------------------------------------------------------
+
 procedure TPostShaderDemoForm.tbBlurValueChange(Sender: TObject);
 procedure TPostShaderDemoForm.tbBlurValueChange(Sender: TObject);
 begin
 begin
-  BlurShader.Threshold :=  tbBlurValue.Position / 100;
+  BlurShader.Threshold := tbBlurValue.Position / 100;
   lblBlurValue.Caption := FloatToStrF(BlurShader.Threshold, ffFixed, 5, 2);
   lblBlurValue.Caption := FloatToStrF(BlurShader.Threshold, ffFixed, 5, 2);
 end;
 end;
 
 
+//-------------------------------------------------------
+
 procedure TPostShaderDemoForm.tbDreamThresholdChange(Sender: TObject);
 procedure TPostShaderDemoForm.tbDreamThresholdChange(Sender: TObject);
 begin
 begin
-  DreamVisionShader.Threshold :=  tbDreamThreshold.Position / 100;
- lblDreamThreshold.Caption := FloatToStrF(DreamVisionShader.Threshold, ffFixed, 5, 2);
+  DreamVisionShader.Threshold := tbDreamThreshold.Position / 100;
+  lblDreamThreshold.Caption := FloatToStrF(DreamVisionShader.Threshold,
+    ffFixed, 5, 2);
 end;
 end;
 
 
+//-------------------------------------------------------
+
 procedure TPostShaderDemoForm.tbFrostFactorChange(Sender: TObject);
 procedure TPostShaderDemoForm.tbFrostFactorChange(Sender: TObject);
 begin
 begin
-  FrostShader.RandFactor :=  tbFrostFactor.Position;
+  FrostShader.RandFactor := tbFrostFactor.Position;
   lblFrostFactor.Caption := FloatToStrF(FrostShader.RandFactor, ffFixed, 5, 2);
   lblFrostFactor.Caption := FloatToStrF(FrostShader.RandFactor, ffFixed, 5, 2);
 end;
 end;
 
 
+//-------------------------------------------------------
+
 procedure TPostShaderDemoForm.tbFrostRandChange(Sender: TObject);
 procedure TPostShaderDemoForm.tbFrostRandChange(Sender: TObject);
 begin
 begin
-  FrostShader.RandScale :=  tbFrostRand.Position;
+  FrostShader.RandScale := tbFrostRand.Position;
   lblFrostRand.Caption := FloatToStrF(FrostShader.RandScale, ffFixed, 5, 2);
   lblFrostRand.Caption := FloatToStrF(FrostShader.RandScale, ffFixed, 5, 2);
 end;
 end;
 
 
+//-------------------------------------------------------
+
 procedure TPostShaderDemoForm.tblNightThresholdChange(Sender: TObject);
 procedure TPostShaderDemoForm.tblNightThresholdChange(Sender: TObject);
 begin
 begin
- NightVisionShader.LuminanceThreshold :=  tblNightThreshold.Position / 100;
- lblNight.Caption := FloatToStrF(NightVisionShader.LuminanceThreshold, ffFixed, 5, 2);
+  NightVisionShader.LuminanceThreshold := tblNightThreshold.Position / 100;
+  lblNight.Caption := FloatToStrF(NightVisionShader.LuminanceThreshold,
+    ffFixed, 5, 2);
 end;
 end;
 
 
+//-------------------------------------------------------
+
 procedure TPostShaderDemoForm.tbNightAmplificationChange(Sender: TObject);
 procedure TPostShaderDemoForm.tbNightAmplificationChange(Sender: TObject);
 begin
 begin
- NightVisionShader.ColorAmplification :=  tbNightAmplification.Position / 100;
- lblNightAmplification.Caption := FloatToStrF(NightVisionShader.ColorAmplification, ffFixed, 5, 2);
+  NightVisionShader.ColorAmplification := tbNightAmplification.Position / 100;
+  lblNightAmplification.Caption :=
+    FloatToStrF(NightVisionShader.ColorAmplification, ffFixed, 5, 2);
 end;
 end;
 
 
+//-------------------------------------------------------
+
 procedure TPostShaderDemoForm.tbPixelateHeightChange(Sender: TObject);
 procedure TPostShaderDemoForm.tbPixelateHeightChange(Sender: TObject);
 begin
 begin
-   PixelateShader.PixelHeight :=  tbPixelateHeight.Position ;
-  lblPixelateHeight.Caption := FloatToStrF(PixelateShader.PixelHeight, ffFixed, 5, 0);
+  PixelateShader.PixelHeight := tbPixelateHeight.Position;
+  lblPixelateHeight.Caption := FloatToStrF(PixelateShader.PixelHeight,
+    ffFixed, 5, 0);
 end;
 end;
 
 
+//-------------------------------------------------------
+
 procedure TPostShaderDemoForm.tbPixelateWidthChange(Sender: TObject);
 procedure TPostShaderDemoForm.tbPixelateWidthChange(Sender: TObject);
 begin
 begin
-   PixelateShader.PixelWidth :=  tbPixelateWidth.Position ;
-  lblPixelateWidth.Caption := FloatToStrF(PixelateShader.PixelWidth, ffFixed, 5, 0);
+  PixelateShader.PixelWidth := tbPixelateWidth.Position;
+  lblPixelateWidth.Caption := FloatToStrF(PixelateShader.PixelWidth,
+    ffFixed, 5, 0);
 end;
 end;
 
 
+//-------------------------------------------------------
+
 procedure TPostShaderDemoForm.tbPosterizeColorsChange(Sender: TObject);
 procedure TPostShaderDemoForm.tbPosterizeColorsChange(Sender: TObject);
 begin
 begin
-  PosterizeShader.NumColors :=  tbPosterizeColors.Position;
-  lblPosterizeColors.Caption := FloatToStrF(PosterizeShader.NumColors, ffFixed, 5, 2);
+  PosterizeShader.NumColors := tbPosterizeColors.Position;
+  lblPosterizeColors.Caption := FloatToStrF(PosterizeShader.NumColors,
+    ffFixed, 5, 2);
 end;
 end;
 
 
+//-------------------------------------------------------
+
 procedure TPostShaderDemoForm.tbPosterizeGammaChange(Sender: TObject);
 procedure TPostShaderDemoForm.tbPosterizeGammaChange(Sender: TObject);
 begin
 begin
-  PosterizeShader.Gamma :=  tbPosterizeGamma.Position / 100;
-  lblPosterizeGamma.Caption := FloatToStrF(PosterizeShader.Gamma, ffFixed, 5, 2);
+  PosterizeShader.Gamma := tbPosterizeGamma.Position / 100;
+  lblPosterizeGamma.Caption := FloatToStrF(PosterizeShader.Gamma,
+    ffFixed, 5, 2);
 end;
 end;
 
 
+//-------------------------------------------------------
+
 procedure TPostShaderDemoForm.tbThermalIntensityChange(Sender: TObject);
 procedure TPostShaderDemoForm.tbThermalIntensityChange(Sender: TObject);
 begin
 begin
-  ThermalVisionShader.Intensity :=  tbThermalIntensity.Position / 100;
-  lblThermalIntensity.Caption := FloatToStrF(ThermalVisionShader.Intensity, ffFixed, 5, 2);
+  ThermalVisionShader.Intensity := tbThermalIntensity.Position / 100;
+  lblThermalIntensity.Caption := FloatToStrF(ThermalVisionShader.Intensity,
+    ffFixed, 5, 2);
 end;
 end;
 
 
+//-------------------------------------------------------
+
 procedure TPostShaderDemoForm.tbThermalThresholdChange(Sender: TObject);
 procedure TPostShaderDemoForm.tbThermalThresholdChange(Sender: TObject);
 begin
 begin
-  ThermalVisionShader.Threshold :=  tbThermalThreshold.Position / 100;
-  lblThermalThreshold.Caption := FloatToStrF(ThermalVisionShader.Threshold, ffFixed, 5, 2);
+  ThermalVisionShader.Threshold := tbThermalThreshold.Position / 100;
+  lblThermalThreshold.Caption := FloatToStrF(ThermalVisionShader.Threshold,
+    ffFixed, 5, 2);
 end;
 end;
 
 
+//-------------------------------------------------------
+
 procedure TPostShaderDemoForm.tbTroubleFreqChange(Sender: TObject);
 procedure TPostShaderDemoForm.tbTroubleFreqChange(Sender: TObject);
 begin
 begin
-   TroubleShader.Freq :=  tbTroubleFreq.Position /100 ;
+  TroubleShader.Freq := tbTroubleFreq.Position / 100;
   lblTroubleFreq.Caption := FloatToStrF(TroubleShader.Freq, ffFixed, 5, 2);
   lblTroubleFreq.Caption := FloatToStrF(TroubleShader.Freq, ffFixed, 5, 2);
 end;
 end;
 
 
+//-------------------------------------------------------
+
 procedure TPostShaderDemoForm.tbTroubleHeightChange(Sender: TObject);
 procedure TPostShaderDemoForm.tbTroubleHeightChange(Sender: TObject);
 begin
 begin
-   TroubleShader.PixelY :=  tbTroubleHeight.Position ;
+  TroubleShader.PixelY := tbTroubleHeight.Position;
   lblTroubleHeight.Caption := FloatToStrF(TroubleShader.PixelY, ffFixed, 5, 2);
   lblTroubleHeight.Caption := FloatToStrF(TroubleShader.PixelY, ffFixed, 5, 2);
 end;
 end;
 
 
+//-------------------------------------------------------
+
 procedure TPostShaderDemoForm.tbTroubleWidthChange(Sender: TObject);
 procedure TPostShaderDemoForm.tbTroubleWidthChange(Sender: TObject);
 begin
 begin
-   TroubleShader.PixelX :=  tbTroubleWidth.Position ;
+  TroubleShader.PixelX := tbTroubleWidth.Position;
   lblTroubleWidth.Caption := FloatToStrF(TroubleShader.PixelX, ffFixed, 5, 2);
   lblTroubleWidth.Caption := FloatToStrF(TroubleShader.PixelX, ffFixed, 5, 2);
 end;
 end;
 
 
-procedure TPostShaderDemoForm.FormClose(Sender: TObject; var Action: TCloseAction);
+//-------------------------------------------------------
+
+procedure TPostShaderDemoForm.FormClose(Sender: TObject;
+  var Action: TCloseAction);
 begin
 begin
-  Cadencer.Enabled := False;
+  Cadencer.Enabled := false;
 end;
 end;
 
 
-end.
+end.

BIN
Demos/Delphi/physics/ClothActor.jpg


+ 7 - 8
Demos/Delphi/physics/ClothActorFm.pas

@@ -25,13 +25,12 @@ uses
   GLS.File3DS,
   GLS.File3DS,
   GLS.VerletTypes,
   GLS.VerletTypes,
   GLS.VerletClothify,
   GLS.VerletClothify,
-  GLS.VerletSkeletonColliders,
   GLS.ShadowVolume,
   GLS.ShadowVolume,
   GLS.Keyboard,
   GLS.Keyboard,
   GLS.VectorGeometry,
   GLS.VectorGeometry,
   GLS.GeometryBB,
   GLS.GeometryBB,
   GLS.SpacePartition,
   GLS.SpacePartition,
- 
+
   GLS.Material,
   GLS.Material,
   GLS.BaseClasses,
   GLS.BaseClasses,
   GLS.RenderContextInfo,
   GLS.RenderContextInfo,
@@ -73,7 +72,7 @@ type
     mx, my: Integer;
     mx, my: Integer;
     VerletWorld: TGLVerletWorld;
     VerletWorld: TGLVerletWorld;
     EdgeDetector: TGLEdgeDetector;
     EdgeDetector: TGLEdgeDetector;
-    AirResistance: TGLAirResistanceVF;
+    AirResistance: TGLVerletAirResistance;
   end;
   end;
 
 
 var
 var
@@ -148,7 +147,7 @@ end;
 
 
 procedure TFormClothActor.FormCreate(Sender: TObject);
 procedure TFormClothActor.FormCreate(Sender: TObject);
 var
 var
-  FloorVC: TGLFloorVC;
+  FloorVC: TGLVerletFloor;
 begin
 begin
   SetGLSceneMediaDir();
   SetGLSceneMediaDir();
   Randomize;
   Randomize;
@@ -187,8 +186,8 @@ begin
   // EdgeDetector.AddOuterEdgesAsSolidEdges(VerletWorld);
   // EdgeDetector.AddOuterEdgesAsSolidEdges(VerletWorld);
 
 
   // Set up verlet gravity and add the floor as a constraint
   // Set up verlet gravity and add the floor as a constraint
-  TGLGravityVF.Create(VerletWorld).Gravity := AffineVectorMake(0, -98.1, 0);
-  FloorVC := TGLFloorVC.Create(VerletWorld);
+  TGLVerletGravity.Create(VerletWorld).Gravity := AffineVectorMake(0, -98.1, 0);
+  FloorVC := TGLVerletFloor.Create(VerletWorld);
   FloorVC.Normal := GLPlane1.Direction.AsAffineVector;
   FloorVC.Normal := GLPlane1.Direction.AsAffineVector;
   FloorVC.Location := VectorAdd(GLPlane1.Position.AsAffineVector,
   FloorVC.Location := VectorAdd(GLPlane1.Position.AsAffineVector,
       VectorScale(GLPlane1.Direction.AsAffineVector, 0.1));
       VectorScale(GLPlane1.Direction.AsAffineVector, 0.1));
@@ -199,9 +198,9 @@ begin
   GLActor1.Skeleton.Colliders.AlignColliders;
   GLActor1.Skeleton.Colliders.AlignColliders;
 
 
   // Add the collider's verlet constraints to the verlet world
   // Add the collider's verlet constraints to the verlet world
-  AddSCVerletConstriantsToVerletWorld(GLActor1.Skeleton.Colliders, VerletWorld);
+  AddVerletConstriantsToVerletWorld(GLActor1.Skeleton.Colliders, VerletWorld);
   (*
   (*
-  AirResistance := TGLAirResistanceVF.Create(VerletWorld);
+  AirResistance := TGLVerletAirResistance.Create(VerletWorld);
   AirResistance.DragCoeff := 0.001;
   AirResistance.DragCoeff := 0.001;
   AirResistance.WindDirection := AffineVectorMake(0,0,1);
   AirResistance.WindDirection := AffineVectorMake(0,0,1);
   AirResistance.WindMagnitude := 15;
   AirResistance.WindMagnitude := 15;

BIN
Demos/Delphi/physics/NewtonJoints.jpg


BIN
Demos/Delphi/physics/NewtonMaterial.jpg


BIN
Demos/Delphi/physics/NewtonMousePick.jpg


BIN
Demos/Delphi/physics/NewtonSimple.jpg


BIN
Demos/Delphi/physics/OdeClothify.jpg


+ 254 - 221
Demos/Delphi/physics/OdeClothifyFm.pas

@@ -15,9 +15,6 @@ uses
   Vcl.StdCtrls,
   Vcl.StdCtrls,
   Vcl.ComCtrls,
   Vcl.ComCtrls,
 
 
-  Imports.ODE,
-  Physics.ODEUtils,
-
   GLS.Objects,
   GLS.Objects,
   GLS.Scene,
   GLS.Scene,
   GLS.PersistentClasses,
   GLS.PersistentClasses,
@@ -44,7 +41,10 @@ uses
   GLS.RenderContextInfo,
   GLS.RenderContextInfo,
   GLS.State,
   GLS.State,
   GLS.Context,
   GLS.Context,
-  GLS.BaseClasses;
+  GLS.BaseClasses,
+
+  Imports.ODE,
+  Physics.ODEUtils;
 
 
 type
 type
   TFormClothify = class(TForm)
   TFormClothify = class(TForm)
@@ -101,36 +101,37 @@ type
     Label1: TLabel;
     Label1: TLabel;
     procedure GLSceneViewer1MouseMove(Sender: TObject; Shift: TShiftState;
     procedure GLSceneViewer1MouseMove(Sender: TObject; Shift: TShiftState;
       X, Y: Integer);
       X, Y: Integer);
-    procedure GLCadencer1Progress(Sender: TObject; const deltaTime,
-      newTime: Double);
+    procedure GLCadencer1Progress(Sender: TObject;
+      const deltaTime, newTime: Double);
     procedure Timer1Timer(Sender: TObject);
     procedure Timer1Timer(Sender: TObject);
     procedure Button_LoadMeshClick(Sender: TObject);
     procedure Button_LoadMeshClick(Sender: TObject);
     procedure FormCreate(Sender: TObject);
     procedure FormCreate(Sender: TObject);
     procedure TrackBar_SlackChange(Sender: TObject);
     procedure TrackBar_SlackChange(Sender: TObject);
-    function GetSlack : single;
+    function GetSlack: single;
     procedure TrackBar_IterationsChange(Sender: TObject);
     procedure TrackBar_IterationsChange(Sender: TObject);
     procedure FormMouseWheel(Sender: TObject; Shift: TShiftState;
     procedure FormMouseWheel(Sender: TObject; Shift: TShiftState;
       WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
       WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
     procedure TrackBar_FrictionChange(Sender: TObject);
     procedure TrackBar_FrictionChange(Sender: TObject);
-    procedure GLDirectOpenGL1Render(Sender: TObject; var rci: TGLRenderContextInfo);
+    procedure GLDirectOpenGL1Render(Sender: TObject;
+      var rci: TGLRenderContextInfo);
     procedure Button_OpenLoadFormClick(Sender: TObject);
     procedure Button_OpenLoadFormClick(Sender: TObject);
     procedure Button_CancelLoadClick(Sender: TObject);
     procedure Button_CancelLoadClick(Sender: TObject);
     procedure ComboBox_ShadowChange(Sender: TObject);
     procedure ComboBox_ShadowChange(Sender: TObject);
   private
   private
   public
   public
-    mx, my : integer;
-    VerletWorld : TGLVerletWorld;
-    EdgeDetector : TEdgeDetector;
-    world : PdxWorld;
-    space : PdxSpace;
+    mx, my: Integer;
+    VerletWorld: TGLVerletWorld;
+    EdgeDetector: TGLEdgeDetector;
+    world: PdxWorld;
+    space: PdxSpace;
     ODESphere: PdxGeom;
     ODESphere: PdxGeom;
-    body : PdxBody;
-    contactgroup : TdJointGroupID;
-    VCSphere : TVCSphere;
+    body: PdxBody;
+    contactgroup: TdJointGroupID;
+    VCSphere: TGLVerletFricSphere;
   end;
   end;
 
 
-  procedure RecalcMeshNormals(BaseMesh : TGLBaseMesh);
-  procedure PrepareMeshForNormalsRecalc(BaseMesh : TGLBaseMesh);
+procedure RecalcMeshNormals(BaseMesh: TGLBaseMesh);
+procedure PrepareMeshForNormalsRecalc(BaseMesh: TGLBaseMesh);
 
 
 var
 var
   FormClothify: TFormClothify;
   FormClothify: TFormClothify;
@@ -142,9 +143,9 @@ implementation
 procedure TFormClothify.FormCreate(Sender: TObject);
 procedure TFormClothify.FormCreate(Sender: TObject);
 begin
 begin
   SetGLSceneMediaDir();
   SetGLSceneMediaDir();
-  ComboBox_MeshName.ItemIndex:=0;
-  ComboBox_ConstraintType.ItemIndex:=0;
-  ComboBox_Collider.ItemIndex:=3;
+  ComboBox_MeshName.ItemIndex := 0;
+  ComboBox_ConstraintType.ItemIndex := 0;
+  ComboBox_Collider.ItemIndex := 3;
   ComboBox_ShadowChange(nil);
   ComboBox_ShadowChange(nil);
   Button_LoadMesh.Click;
   Button_LoadMesh.Click;
   TrackBar_IterationsChange(nil);
   TrackBar_IterationsChange(nil);
@@ -153,106 +154,113 @@ end;
 
 
 procedure PrepareMeshForNormalsRecalc(BaseMesh: TGLBaseMesh);
 procedure PrepareMeshForNormalsRecalc(BaseMesh: TGLBaseMesh);
 var
 var
-   i, j, k : Integer;
-   mo : TMeshObject;
-   fg : TFGVertexNormalTexIndexList;
+  i, j, k: Integer;
+  mo: TMeshObject;
+  fg: TFGVertexNormalTexIndexList;
 begin
 begin
   // update normals
   // update normals
   // (not very efficient, could use some work...)
   // (not very efficient, could use some work...)
-  for i:=0 to BaseMesh.MeshObjects.Count-1 do begin
-     mo:=BaseMesh.MeshObjects[i];
-
-     for j:=0 to mo.FaceGroups.Count-1 do begin
-        if mo.FaceGroups[j] is TFGVertexNormalTexIndexList then begin
-           fg:=TFGVertexNormalTexIndexList(mo.FaceGroups[j]);
-           for k := 0 to fg.VertexIndices.Count-1 do begin
-              fg.NormalIndices.List[k] := fg.VertexIndices.List[k];
-           end;
+  for i := 0 to BaseMesh.MeshObjects.Count - 1 do
+  begin
+    mo := BaseMesh.MeshObjects[i];
+
+    for j := 0 to mo.FaceGroups.Count - 1 do
+    begin
+      if mo.FaceGroups[j] is TFGVertexNormalTexIndexList then
+      begin
+        fg := TFGVertexNormalTexIndexList(mo.FaceGroups[j]);
+        for k := 0 to fg.VertexIndices.Count - 1 do
+        begin
+          fg.NormalIndices.List[k] := fg.VertexIndices.List[k];
         end;
         end;
-     end;
+      end;
+    end;
   end;
   end;
   BaseMesh.StructureChanged;
   BaseMesh.StructureChanged;
 end;
 end;
 
 
 procedure RecalcMeshNormals(BaseMesh: TGLBaseMesh);
 procedure RecalcMeshNormals(BaseMesh: TGLBaseMesh);
 var
 var
-   i, j, k : Integer;
-   mo : TMeshObject;
-   fg : TFGVertexIndexList;
-   n : TAffineVector;
+  i, j, k: Integer;
+  mo: TMeshObject;
+  fg: TFGVertexIndexList;
+  n: TAffineVector;
 begin
 begin
   // update normals
   // update normals
   // (not very efficient, could use some work...)
   // (not very efficient, could use some work...)
-  for i:=0 to BaseMesh.MeshObjects.Count-1 do begin
-     mo:=BaseMesh.MeshObjects[i];
-
-     FillChar(mo.Normals.List[0], SizeOf(TAffineVector)*mo.Normals.Count, 0);
-
-     for j:=0 to mo.FaceGroups.Count-1 do begin
-        if mo.FaceGroups[j] is TFGVertexIndexList then begin
-           fg:=TFGVertexIndexList(mo.FaceGroups[j]);
-           k:=0; while k<=fg.VertexIndices.Count-3 do begin
-              n:=CalcPlaneNormal(mo.Vertices.List[fg.VertexIndices.List[k]],
-                                 mo.Vertices.List[fg.VertexIndices.List[k+1]],
-                                 mo.Vertices.List[fg.VertexIndices.List[k+2]]);
-              mo.Normals.TranslateItem(fg.VertexIndices.List[k], n);
-              mo.Normals.TranslateItem(fg.VertexIndices.List[k+1], n);
-              mo.Normals.TranslateItem(fg.VertexIndices.List[k+2], n);//}
-
-              Inc(k, 3);
-           end;
+  for i := 0 to BaseMesh.MeshObjects.Count - 1 do
+  begin
+    mo := BaseMesh.MeshObjects[i];
+
+    FillChar(mo.Normals.List[0], SizeOf(TAffineVector) * mo.Normals.Count, 0);
+
+    for j := 0 to mo.FaceGroups.Count - 1 do
+    begin
+      if mo.FaceGroups[j] is TFGVertexIndexList then
+      begin
+        fg := TFGVertexIndexList(mo.FaceGroups[j]);
+        k := 0;
+        while k <= fg.VertexIndices.Count - 3 do
+        begin
+          n := CalcPlaneNormal(mo.Vertices.List[fg.VertexIndices.List[k]],
+            mo.Vertices.List[fg.VertexIndices.List[k + 1]],
+            mo.Vertices.List[fg.VertexIndices.List[k + 2]]);
+          mo.Normals.TranslateItem(fg.VertexIndices.List[k], n);
+          mo.Normals.TranslateItem(fg.VertexIndices.List[k + 1], n);
+          mo.Normals.TranslateItem(fg.VertexIndices.List[k + 2], n); // }
+
+          Inc(k, 3);
         end;
         end;
-     end;
-     mo.Normals.Normalize;
+      end;
+    end;
+    mo.Normals.Normalize;
   end;
   end;
 
 
   BaseMesh.StructureChanged;
   BaseMesh.StructureChanged;
 end;
 end;
 
 
-
 procedure TFormClothify.Button_LoadMeshClick(Sender: TObject);
 procedure TFormClothify.Button_LoadMeshClick(Sender: TObject);
 var
 var
-  Floor : TVCFloor;
-  Capsule : TVCCapsule;
-  Sides : TAffineVector;
-  Cube : TVCCube;
-  ColliderGravy : single;
-  s : string;
-  f : single;
-  p : Integer;
-
-  procedure CreateCubeFromGLCube(GLCube : TGLCube);
+  Floor: TGLVerletFloor;
+  Capsule: TGLVerletFricCapsule;
+  Cube: TGLVerletFricCube;
+  Sides: TAffineVector;
+  ColliderGravy: Single;
+  s: string;
+  f: single;
+  p: Integer;
+
+  procedure CreateCubeFromGLCube(GLCube: TGLCube);
   begin
   begin
-    Cube := TVCCube.Create(VerletWorld);
+    Cube := TGLVerletFricCube.Create(VerletWorld);
     Cube.Location := AffineVectorMake(GLCube.AbsolutePosition);
     Cube.Location := AffineVectorMake(GLCube.AbsolutePosition);
     Cube.FrictionRatio := 0.1;
     Cube.FrictionRatio := 0.1;
     Sides.X := GLCube.CubeWidth * 1.1;
     Sides.X := GLCube.CubeWidth * 1.1;
     Sides.Y := GLCube.CubeHeight * 1.1;
     Sides.Y := GLCube.CubeHeight * 1.1;
     Sides.Z := GLCube.CubeDepth * 1.1;
     Sides.Z := GLCube.CubeDepth * 1.1;
-    Cube.Sides := Sides;//}
+    Cube.Sides := Sides; // }
   end;
   end;
 
 
-
   procedure CreateODEWorld;
   procedure CreateODEWorld;
   var
   var
-    m : TdMass;
+    m: TdMass;
 
 
   begin
   begin
     GLSphere1.Visible := true;
     GLSphere1.Visible := true;
     world := dWorldCreate;
     world := dWorldCreate;
-    dWorldSetGravity (world,0,-9.81,0);
+    dWorldSetGravity(world, 0, -9.81, 0);
 
 
-    contactgroup := dJointGroupCreate (0);
+    contactgroup := dJointGroupCreate(0);
     space := dHashSpaceCreate(nil);
     space := dHashSpaceCreate(nil);
     body := dBodyCreate(world);
     body := dBodyCreate(world);
-    dMassSetSphere (m,0.1,GLSphere1.Radius);
-    dCreatePlane (space,0,1,0,GLShadowPlane1.Position.Y);
-
+    dMassSetSphere(m, 0.1, GLSphere1.Radius);
+    dCreatePlane(space, 0, 1, 0, GLShadowPlane1.Position.Y);
 
 
-    ODESphere := dCreateSphere (space, GLSphere1.Radius);
+    ODESphere := dCreateSphere(space, GLSphere1.Radius);
 
 
-    dGeomSetBody (ODESphere, body);
-    dBodySetMass (body, @m); ///How to set centre of mass to origin ???
+    dGeomSetBody(ODESphere, body);
+    dBodySetMass(body, @m);
+    /// How to set centre of mass to origin ???
 
 
     ODESphere.data := GLSphere1;
     ODESphere.data := GLSphere1;
 
 
@@ -262,7 +270,7 @@ var
 begin
 begin
   randomize;
   randomize;
 
 
-  if world<>nil then
+  if world <> nil then
   begin
   begin
     dWorldDestroy(world);
     dWorldDestroy(world);
     world := nil;
     world := nil;
@@ -276,14 +284,17 @@ begin
 
 
   System.SysUtils.FormatSettings.DecimalSeparator := '.';
   System.SysUtils.FormatSettings.DecimalSeparator := '.';
 
 
-  p:=Pos(',', s);
-  if p>0 then begin
-      f := StrToFloatDef(Trim(Copy(s, p+1, MaxInt)), 1);
-      GLActor1.Scale.AsVector := VectorMake(f,f,f,0)
-  end else GLActor1.Scale.AsVector := XYZHmgVector;
+  p := Pos(',', s);
+  if p > 0 then
+  begin
+    f := StrToFloatDef(Trim(Copy(s, p + 1, MaxInt)), 1);
+    GLActor1.Scale.AsVector := VectorMake(f, f, f, 0)
+  end
+  else
+    GLActor1.Scale.AsVector := XYZHmgVector;
 
 
   GLActor1.AutoCentering := [macUseBarycenter];
   GLActor1.AutoCentering := [macUseBarycenter];
-  GLActor1.LoadFromFile(Trim(Copy(s, 1, p-1)));
+  GLActor1.LoadFromFile(Trim(Copy(s, 1, p - 1)));
   PrepareMeshForNormalsRecalc(GLActor1);
   PrepareMeshForNormalsRecalc(GLActor1);
   GLActor1.Reference := aarNone;
   GLActor1.Reference := aarNone;
 
 
@@ -291,25 +302,31 @@ begin
   // this line, it'll be _very_ slow.
   // this line, it'll be _very_ slow.
   GLActor1.BuildSilhouetteConnectivityData;
   GLActor1.BuildSilhouetteConnectivityData;
 
 
-  GLActor1.Roll(random*360);
-  GLActor1.Turn(random*360);//}
+  GLActor1.Roll(random * 360);
+  GLActor1.Turn(random * 360); // }
 
 
   GLSphere1.Visible := false;
   GLSphere1.Visible := false;
   GLCylinder1.Visible := false;
   GLCylinder1.Visible := false;
   GLCube1.Visible := false;
   GLCube1.Visible := false;
-  GLDummyCube_Stairs.Visible := False;
-  GL_Capsule.Visible := False;
+  GLDummyCube_Stairs.Visible := false;
+  GL_Capsule.Visible := false;
 
 
   case ComboBox_Collider.ItemIndex of
   case ComboBox_Collider.ItemIndex of
-    0,-1 : GLSphere1.Visible := true;
-    1 : GLCylinder1.Visible := true;
-    2 : GLCube1.Visible := true;
-    3 : GLDummyCube_Stairs.Visible := true;
-    4 : GL_Capsule.Visible := true;
-    5 : CreateODEWorld;
+    0, -1:
+      GLSphere1.Visible := true;
+    1:
+      GLCylinder1.Visible := true;
+    2:
+      GLCube1.Visible := true;
+    3:
+      GLDummyCube_Stairs.Visible := true;
+    4:
+      GL_Capsule.Visible := true;
+    5:
+      CreateODEWorld;
   end;
   end;
 
 
-  EdgeDetector := TEdgeDetector.Create(GLActor1);
+  EdgeDetector := TGLEdgeDetector.Create(GLActor1);
 
 
   if not CheckBox_Weld.Checked then
   if not CheckBox_Weld.Checked then
     EdgeDetector.WeldDistance := -1;
     EdgeDetector.WeldDistance := -1;
@@ -319,61 +336,67 @@ begin
   VerletWorld := TGLVerletWorld.Create;
   VerletWorld := TGLVerletWorld.Create;
 
 
   if CheckBox_UseOctree.Checked then
   if CheckBox_UseOctree.Checked then
-    VerletWorld.CreateOctree(
-      AffineVectorMake( -20, -5.5, -20),
-      AffineVectorMake(  20,  20,  20), 25, 5);//}
+    VerletWorld.CreateOctree(AffineVectorMake(-20, -5.5, -20),
+      AffineVectorMake(20, 20, 20), 25, 5); // }
 
 
   if CheckBox_SolidEdges.Checked then
   if CheckBox_SolidEdges.Checked then
   begin
   begin
     ColliderGravy := 1;
     ColliderGravy := 1;
     EdgeDetector.AddEdgesAsSolidEdges(VerletWorld);
     EdgeDetector.AddEdgesAsSolidEdges(VerletWorld);
-  end else
+  end
+  else
     ColliderGravy := 1.1;
     ColliderGravy := 1.1;
 
 
-  if ComboBox_ConstraintType.ItemIndex=0 then
+  if ComboBox_ConstraintType.ItemIndex = 0 then
     EdgeDetector.AddEdgesAsSticks(VerletWorld, GetSlack)
     EdgeDetector.AddEdgesAsSticks(VerletWorld, GetSlack)
   else
   else
-    EdgeDetector.AddEdgesAsSprings(VerletWorld, 1000,100, GetSlack);//}
+    EdgeDetector.AddEdgesAsSprings(VerletWorld, 1000, 100, GetSlack); // }
 
 
   // VerletWorld.Nodes[0].NailedDown := true;
   // VerletWorld.Nodes[0].NailedDown := true;
 
 
-  TVFGravity.Create(VerletWorld);
+  TGLVerletGravity.Create(VerletWorld);
 
 
-  Floor := TVCFloor.Create(VerletWorld);
-  Floor.Location := VectorAdd(GLShadowPlane1.Position.AsAffineVector, AffineVectorMake(0,0.1,0));
+  Floor := TGLVerletFloor.Create(VerletWorld);
+  Floor.Location := VectorAdd(GLShadowPlane1.Position.AsAffineVector,
+    AffineVectorMake(0, 0.1, 0));
   Floor.Normal := GLShadowPlane1.Direction.AsAffineVector;
   Floor.Normal := GLShadowPlane1.Direction.AsAffineVector;
 
 
-  Floor.FrictionRatio := 0.6;//}
+  Floor.FrictionRatio := 0.6; // }
 
 
-  if GLSphere1.Visible then begin
-     VCSphere := TVCSphere.Create(VerletWorld);
-     VCSphere.Radius := GLSphere1.Radius * ColliderGravy;
-     VCSphere.Location := AffineVectorMake(GLSphere1.AbsolutePosition);
+  if GLSphere1.Visible then
+  begin
+    VCSphere := TGLVerletFricSphere.Create(VerletWorld);
+    VCSphere.Radius := GLSphere1.Radius * ColliderGravy;
+    VCSphere.Location := AffineVectorMake(GLSphere1.AbsolutePosition);
   end;
   end;
 
 
-  if GLCube1.Visible then begin
+  if GLCube1.Visible then
+  begin
     CreateCubeFromGLCube(GLCube1);
     CreateCubeFromGLCube(GLCube1);
   end;
   end;
 
 
-  if GLCylinder1.Visible then begin
-     Capsule := TVCCapsule.Create(VerletWorld);
-     Capsule.Radius := GLCylinder1.TopRadius * ColliderGravy;
-     Capsule.Location := AffineVectorMake(GLCylinder1.AbsolutePosition);
-     Capsule.Axis := AffineVectorMake(GLCylinder1.AbsoluteUp);//}
-     Capsule.Length := 20;
-     Capsule.FrictionRatio := 0.6;
+  if GLCylinder1.Visible then
+  begin
+    Capsule := TGLVerletFricCapsule.Create(VerletWorld);
+    Capsule.Radius := GLCylinder1.TopRadius * ColliderGravy;
+    Capsule.Location := AffineVectorMake(GLCylinder1.AbsolutePosition);
+    Capsule.Axis := AffineVectorMake(GLCylinder1.AbsoluteUp); // }
+    Capsule.Length := 20;
+    Capsule.FrictionRatio := 0.6;
   end;
   end;
 
 
-  if GL_Capsule.Visible then begin
-     Capsule := TVCCapsule.Create(VerletWorld);
-     Capsule.Radius := GL_Capsule.TopRadius * ColliderGravy;
-     Capsule.Location := AffineVectorMake(GL_Capsule.AbsolutePosition);
-     Capsule.Axis := AffineVectorMake(GL_Capsule.AbsoluteUp);//}
-     Capsule.Length := GL_Capsule.Height * ColliderGravy;
-     Capsule.FrictionRatio := 0.6;
+  if GL_Capsule.Visible then
+  begin
+    Capsule := TGLVerletFricCapsule.Create(VerletWorld);
+    Capsule.Radius := GL_Capsule.TopRadius * ColliderGravy;
+    Capsule.Location := AffineVectorMake(GL_Capsule.AbsolutePosition);
+    Capsule.Axis := AffineVectorMake(GL_Capsule.AbsoluteUp); // }
+    Capsule.Length := GL_Capsule.Height * ColliderGravy;
+    Capsule.FrictionRatio := 0.6;
   end;
   end;
 
 
-  if GLDummyCube_Stairs.Visible then begin
+  if GLDummyCube_Stairs.Visible then
+  begin
     CreateCubeFromGLCube(GLCube_Stair1);
     CreateCubeFromGLCube(GLCube_Stair1);
     CreateCubeFromGLCube(GLCube_Stair2);
     CreateCubeFromGLCube(GLCube_Stair2);
     CreateCubeFromGLCube(GLCube_Stair3);
     CreateCubeFromGLCube(GLCube_Stair3);
@@ -389,57 +412,58 @@ begin
   GroupBox_LoadForm.Hide;
   GroupBox_LoadForm.Hide;
 
 
   CheckBox_ShowOctree.Enabled := CheckBox_UseOctree.Checked;
   CheckBox_ShowOctree.Enabled := CheckBox_UseOctree.Checked;
-  TrackBar_Iterations.Enabled := (ComboBox_ConstraintType.ItemIndex=0);
-  TrackBar_Slack.Enabled := (ComboBox_ConstraintType.ItemIndex=0);
+  TrackBar_Iterations.Enabled := (ComboBox_ConstraintType.ItemIndex = 0);
+  TrackBar_Slack.Enabled := (ComboBox_ConstraintType.ItemIndex = 0);
 end;
 end;
 
 
 procedure TFormClothify.GLSceneViewer1MouseMove(Sender: TObject;
 procedure TFormClothify.GLSceneViewer1MouseMove(Sender: TObject;
   Shift: TShiftState; X, Y: Integer);
   Shift: TShiftState; X, Y: Integer);
 begin
 begin
   if ssLeft in Shift then
   if ssLeft in Shift then
-    GLCamera1.MoveAroundTarget(my-y, mx-x);
+    GLCamera1.MoveAroundTarget(my - Y, mx - X);
 
 
-  mx := x;
-  my := y
+  mx := X;
+  my := Y
 end;
 end;
 
 
-procedure nearCallback (data : pointer; o1, o2 : PdxGeom); cdecl;
+procedure nearCallback(data: pointer; o1, o2: PdxGeom); cdecl;
 const
 const
   cCOL_MAX = 3;
   cCOL_MAX = 3;
 var
 var
-  i : integer;
-  b1, b2 : PdxBody;
-  numc : integer;
-  contact : array[0..cCOL_MAX-1] of TdContact;
-  c : TdJointID;
+  i: Integer;
+  b1, b2: PdxBody;
+  numc: Integer;
+  contact: array [0 .. cCOL_MAX - 1] of TdContact;
+  c: TdJointID;
 begin
 begin
   // exit without doing anything if the two bodies are connected by a joint
   // exit without doing anything if the two bodies are connected by a joint
   b1 := dGeomGetBody(o1);
   b1 := dGeomGetBody(o1);
   b2 := dGeomGetBody(o2);
   b2 := dGeomGetBody(o2);
-  if (assigned(b1) and assigned(b2) and (dAreConnected (b1,b2)<>0)) then
-    exit;//}
+  if (assigned(b1) and assigned(b2) and (dAreConnected(b1, b2) <> 0)) then
+    exit; // }
 
 
-  for i :=0 to cCOL_MAX-1 do
+  for i := 0 to cCOL_MAX - 1 do
   begin
   begin
     contact[i].surface.mode := dContactBounce;
     contact[i].surface.mode := dContactBounce;
 
 
     // This determines friction, play around with it!
     // This determines friction, play around with it!
-    contact[i].surface.mu := 10e9; //dInfinity; SHOULD BE INFINITY!
+    contact[i].surface.mu := 10E9; // dInfinity; SHOULD BE INFINITY!
     contact[i].surface.mu2 := 0;
     contact[i].surface.mu2 := 0;
-    contact[i].surface.bounce := 0.5;//0.5;
+    contact[i].surface.bounce := 0.5; // 0.5;
     contact[i].surface.bounce_vel := 0.1;
     contact[i].surface.bounce_vel := 0.1;
   end;
   end;
 
 
-  numc := dCollide (o1,o2,cCOL_MAX,contact[0].geom,sizeof(TdContact));
-  if (numc>0) then
+  numc := dCollide(o1, o2, cCOL_MAX, contact[0].geom, SizeOf(TdContact));
+  if (numc > 0) then
   begin
   begin
     // dMatrix3 RI;
     // dMatrix3 RI;
     // dRSetIdentity (RI);
     // dRSetIdentity (RI);
     // const dReal ss[3] = {0.02,0.02,0.02};
     // const dReal ss[3] = {0.02,0.02,0.02};
-    for i := 0 to numc-1 do
+    for i := 0 to numc - 1 do
     begin
     begin
-      c := dJointCreateContact (FormClothify.world,FormClothify.contactgroup, @contact[i]);
-      dJointAttach (c,b1,b2);
+      c := dJointCreateContact(FormClothify.world, FormClothify.contactgroup,
+        @contact[i]);
+      dJointAttach(c, b1, b2);
       // dsDrawBox (contact[i].geom.pos,RI,ss);
       // dsDrawBox (contact[i].geom.pos,RI,ss);
     end;
     end;
   end;
   end;
@@ -449,109 +473,110 @@ procedure TFormClothify.GLCadencer1Progress(Sender: TObject;
   const deltaTime, newTime: Double);
   const deltaTime, newTime: Double);
 begin
 begin
 
 
-   {if CheckBox_Pause.Checked then
-      VerletWorld.SimTime := newTime
-   else//}
-   begin
-      if world <> nil then begin
-         PositionSceneObjectForGeom(ODESphere);
-         VCSphere.Location := GLSphere1.Position.AsAffineVector;
-         dBodyAddForce(dGeomGetBody(ODESphere),
-                       VCSphere.KickbackForce.X,
-                       VCSphere.KickbackForce.Y,
-                       VCSphere.KickbackForce.Z);
-         dSpaceCollide (space,nil,nearCallback);
-         dWorldStep(World, VerletWorld.MaxDeltaTime);
-         dJointGroupEmpty (contactgroup);
-      end;
+  { if CheckBox_Pause.Checked then
+    VerletWorld.SimTime := newTime
+    else// }
+  begin
+    if world <> nil then
+    begin
+      PositionSceneObjectForGeom(ODESphere);
+      VCSphere.Location := GLSphere1.Position.AsAffineVector;
+      dBodyAddForce(dGeomGetBody(ODESphere), VCSphere.KickbackForce.X,
+        VCSphere.KickbackForce.Y, VCSphere.KickbackForce.Z);
+      dSpaceCollide(space, nil, nearCallback);
+      dWorldStep(world, VerletWorld.MaxDeltaTime);
+      dJointGroupEmpty(contactgroup);
+    end;
 
 
-      VerletWorld.Progress(VerletWorld.MaxDeltaTime, newTime);
+    VerletWorld.Progress(VerletWorld.MaxDeltaTime, newTime);
 
 
-      RecalcMeshNormals(GLActor1);
+    RecalcMeshNormals(GLActor1);
 
 
-   end;
+  end;
 end;
 end;
 
 
 procedure TFormClothify.Timer1Timer(Sender: TObject);
 procedure TFormClothify.Timer1Timer(Sender: TObject);
 begin
 begin
-  Label1.Caption := Format('%2.1f FPS',[GLSceneViewer1.FramesPerSecond]);
+  Label1.Caption := Format('%2.1f FPS', [GLSceneViewer1.FramesPerSecond]);
   GLSceneViewer1.ResetPerformanceMonitor;
   GLSceneViewer1.ResetPerformanceMonitor;
 end;
 end;
 
 
 procedure TFormClothify.TrackBar_SlackChange(Sender: TObject);
 procedure TFormClothify.TrackBar_SlackChange(Sender: TObject);
 var
 var
-  i : integer;
+  i: Integer;
 begin
 begin
-  for i := 0 to VerletWorld.Constraints.Count-1 do
+  for i := 0 to VerletWorld.Constraints.Count - 1 do
   begin
   begin
-    if VerletWorld.Constraints[i] is TVCStick then
-      TVCStick(VerletWorld.Constraints[i]).Slack := GetSlack;
+    if VerletWorld.Constraints[i] is TGLVerletStick then
+      TGLVerletStick(VerletWorld.Constraints[i]).Slack := GetSlack;
   end;
   end;
 end;
 end;
 
 
 function TFormClothify.GetSlack: single;
 function TFormClothify.GetSlack: single;
 begin
 begin
-  result := TrackBar_Slack.Position/500;
+  result := TrackBar_Slack.Position / 500;
 end;
 end;
 
 
 procedure TFormClothify.TrackBar_IterationsChange(Sender: TObject);
 procedure TFormClothify.TrackBar_IterationsChange(Sender: TObject);
 begin
 begin
   VerletWorld.Iterations := TrackBar_Iterations.Position;
   VerletWorld.Iterations := TrackBar_Iterations.Position;
 
 
-  Label6.Caption := Format('Iterations %d',[TrackBar_Iterations.Position]);
+  Label6.Caption := Format('Iterations %d', [TrackBar_Iterations.Position]);
 end;
 end;
 
 
 procedure TFormClothify.FormMouseWheel(Sender: TObject; Shift: TShiftState;
 procedure TFormClothify.FormMouseWheel(Sender: TObject; Shift: TShiftState;
   WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
   WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
 begin
 begin
-	GLCamera1.AdjustDistanceToTarget(Power(1.1, WheelDelta/120));
+  GLCamera1.AdjustDistanceToTarget(Power(1.1, WheelDelta / 120));
 end;
 end;
 
 
 procedure TFormClothify.TrackBar_FrictionChange(Sender: TObject);
 procedure TFormClothify.TrackBar_FrictionChange(Sender: TObject);
 var
 var
-  i : integer;
+  i: Integer;
 begin
 begin
-  for i := 0 to VerletWorld.Constraints.Count-1 do
+  for i := 0 to VerletWorld.Constraints.Count - 1 do
     if VerletWorld.Constraints[i] is TGLVerletGlobalFrictionConstraint then
     if VerletWorld.Constraints[i] is TGLVerletGlobalFrictionConstraint then
-      TGLVerletGlobalFrictionConstraint(VerletWorld.Constraints[i]).FrictionRatio := TrackBar_Friction.Position / 100;
+      TGLVerletGlobalFrictionConstraint(VerletWorld.Constraints[i])
+        .FrictionRatio := TrackBar_Friction.Position / 100;
 end;
 end;
 
 
-procedure TFormClothify.GLDirectOpenGL1Render(Sender: TObject; var rci: TGLRenderContextInfo);
-  procedure RenderAABB(AABB : TAABB; w, r,g,b : single);
+procedure TFormClothify.GLDirectOpenGL1Render(Sender: TObject;
+  var rci: TGLRenderContextInfo);
+  procedure RenderAABB(AABB: TAABB; w, r, g, b: single);
   begin
   begin
-    GL.Color3f(r,g,b);
+    GL.Color3f(r, g, b);
     rci.GLStates.LineWidth := w;
     rci.GLStates.LineWidth := w;
 
 
     GL.Begin_(GL_LINE_STRIP);
     GL.Begin_(GL_LINE_STRIP);
-      GL.Vertex3f(AABB.min.X,AABB.min.Y, AABB.min.Z);
-      GL.Vertex3f(AABB.min.X,AABB.max.Y, AABB.min.Z);
-      GL.Vertex3f(AABB.max.X,AABB.max.Y, AABB.min.Z);
-      GL.Vertex3f(AABB.max.X,AABB.min.Y, AABB.min.Z);
-      GL.Vertex3f(AABB.min.X,AABB.min.Y, AABB.min.Z);
-
-      GL.Vertex3f(AABB.min.X,AABB.min.Y, AABB.max.Z);
-      GL.Vertex3f(AABB.min.X,AABB.max.Y, AABB.max.Z);
-      GL.Vertex3f(AABB.max.X,AABB.max.Y, AABB.max.Z);
-      GL.Vertex3f(AABB.max.X,AABB.min.Y, AABB.max.Z);
-      GL.Vertex3f(AABB.min.X,AABB.min.Y, AABB.max.Z);
+    GL.Vertex3f(AABB.min.X, AABB.min.Y, AABB.min.Z);
+    GL.Vertex3f(AABB.min.X, AABB.max.Y, AABB.min.Z);
+    GL.Vertex3f(AABB.max.X, AABB.max.Y, AABB.min.Z);
+    GL.Vertex3f(AABB.max.X, AABB.min.Y, AABB.min.Z);
+    GL.Vertex3f(AABB.min.X, AABB.min.Y, AABB.min.Z);
+
+    GL.Vertex3f(AABB.min.X, AABB.min.Y, AABB.max.Z);
+    GL.Vertex3f(AABB.min.X, AABB.max.Y, AABB.max.Z);
+    GL.Vertex3f(AABB.max.X, AABB.max.Y, AABB.max.Z);
+    GL.Vertex3f(AABB.max.X, AABB.min.Y, AABB.max.Z);
+    GL.Vertex3f(AABB.min.X, AABB.min.Y, AABB.max.Z);
     GL.End_;
     GL.End_;
 
 
     GL.Begin_(GL_LINES);
     GL.Begin_(GL_LINES);
-      GL.Vertex3f(AABB.min.X,AABB.max.Y, AABB.min.Z);
-      GL.Vertex3f(AABB.min.X,AABB.max.Y, AABB.max.Z);
+    GL.Vertex3f(AABB.min.X, AABB.max.Y, AABB.min.Z);
+    GL.Vertex3f(AABB.min.X, AABB.max.Y, AABB.max.Z);
 
 
-      GL.Vertex3f(AABB.max.X,AABB.max.Y, AABB.min.Z);
-      GL.Vertex3f(AABB.max.X,AABB.max.Y, AABB.max.Z);
+    GL.Vertex3f(AABB.max.X, AABB.max.Y, AABB.min.Z);
+    GL.Vertex3f(AABB.max.X, AABB.max.Y, AABB.max.Z);
 
 
-      GL.Vertex3f(AABB.max.X,AABB.min.Y, AABB.min.Z);
-      GL.Vertex3f(AABB.max.X,AABB.min.Y, AABB.max.Z);
+    GL.Vertex3f(AABB.max.X, AABB.min.Y, AABB.min.Z);
+    GL.Vertex3f(AABB.max.X, AABB.min.Y, AABB.max.Z);
     GL.End_;
     GL.End_;
   end;
   end;
 
 
-  procedure RenderOctreeNode(Node : TSectorNode);
+  procedure RenderOctreeNode(Node: TSectorNode);
   var
   var
-    i : integer;
-    AABB : TAABB;
+    i: Integer;
+    AABB: TAABB;
   begin
   begin
     if Node.NoChildren then
     if Node.NoChildren then
     begin
     begin
@@ -560,21 +585,25 @@ procedure TFormClothify.GLDirectOpenGL1Render(Sender: TObject; var rci: TGLRende
       if Node.RecursiveLeafCount > 0 then
       if Node.RecursiveLeafCount > 0 then
         RenderAABB(AABB, 1, 0, 0, 0)
         RenderAABB(AABB, 1, 0, 0, 0)
       else
       else
-        RenderAABB(AABB, 1, 0.8, 0.8, 0.8)//}
+        RenderAABB(AABB, 1, 0.8, 0.8, 0.8) // }
 
 
-    end else
+    end
+    else
     begin
     begin
-      for i := 0 to Node.ChildCount-1 do
+      for i := 0 to Node.ChildCount - 1 do
         RenderOctreeNode(Node.Children[i]);
         RenderOctreeNode(Node.Children[i]);
     end;
     end;
   end;
   end;
+
 begin
 begin
-  if CheckBox_ShowOctree.Checked and (VerletWorld.SpacePartition is TOctreeSpacePartition) then
+  if CheckBox_ShowOctree.Checked and
+    (VerletWorld.SpacePartition is TOctreeSpacePartition) then
   begin
   begin
     rci.GLStates.PushAttrib([sttEnable, sttCurrent, sttLine, sttColorBuffer]);
     rci.GLStates.PushAttrib([sttEnable, sttCurrent, sttLine, sttColorBuffer]);
     rci.GLStates.Disable(stLighting);
     rci.GLStates.Disable(stLighting);
 
 
-    RenderOctreeNode(TOctreeSpacePartition(VerletWorld.SpacePartition).RootNode);
+    RenderOctreeNode(TOctreeSpacePartition(VerletWorld.SpacePartition)
+      .RootNode);
     rci.GLStates.PopAttrib;
     rci.GLStates.PopAttrib;
   end;
   end;
 end;
 end;
@@ -592,24 +621,28 @@ end;
 
 
 procedure TFormClothify.ComboBox_ShadowChange(Sender: TObject);
 procedure TFormClothify.ComboBox_ShadowChange(Sender: TObject);
 begin
 begin
-  GLShadowVolume1.Mode := svmOff;
+  GLShadowVolume1.mode := svmOff;
   GLShadowPlane1.Visible := false;
   GLShadowPlane1.Visible := false;
   GLPlane1.Visible := true;
   GLPlane1.Visible := true;
-  GLSceneViewer1.Buffer.ContextOptions := GLSceneViewer1.Buffer.ContextOptions - [roStencilBuffer];
+  GLSceneViewer1.Buffer.ContextOptions := GLSceneViewer1.Buffer.ContextOptions -
+    [roStencilBuffer];
 
 
   case ComboBox_Shadow.ItemIndex of
   case ComboBox_Shadow.ItemIndex of
-    0 :;
-    1 :
-    begin
-      GLShadowVolume1.Mode := svmDarkening;
-      GLSceneViewer1.Buffer.ContextOptions := GLSceneViewer1.Buffer.ContextOptions + [roStencilBuffer];
-    end;
-    2 :
-    begin
-      GLShadowPlane1.Visible := true;
-      GLPlane1.Visible := false;
-      GLSceneViewer1.Buffer.ContextOptions := GLSceneViewer1.Buffer.ContextOptions + [roStencilBuffer];
-    end;
+    0:
+      ;
+    1:
+      begin
+        GLShadowVolume1.mode := svmDarkening;
+        GLSceneViewer1.Buffer.ContextOptions :=
+          GLSceneViewer1.Buffer.ContextOptions + [roStencilBuffer];
+      end;
+    2:
+      begin
+        GLShadowPlane1.Visible := true;
+        GLPlane1.Visible := false;
+        GLSceneViewer1.Buffer.ContextOptions :=
+          GLSceneViewer1.Buffer.ContextOptions + [roStencilBuffer];
+      end;
   end;
   end;
 end;
 end;
 
 

BIN
Demos/Delphi/physics/OdeFurBall.jpg


+ 11 - 12
Demos/Delphi/physics/OdeFurballFm.pas

@@ -29,7 +29,6 @@ uses
   GLS.ShadowPlane,
   GLS.ShadowPlane,
   GLS.Navigator,
   GLS.Navigator,
   GLS.VerletTypes,
   GLS.VerletTypes,
-  GLS.VerletHairClasses,
   GLS.Keyboard,
   GLS.Keyboard,
   GLS.Color,
   GLS.Color,
  
  
@@ -92,10 +91,10 @@ type
     contactgroup : TdJointGroupID;
     contactgroup : TdJointGroupID;
     VerletWorld : TGLVerletWorld;
     VerletWorld : TGLVerletWorld;
     HairList : TList;
     HairList : TList;
-    VCSphere : TVCSphere;
+    VCSphere : TGLVerletFricSphere;
     PhysicsTime : single;
     PhysicsTime : single;
-    Gravity : TVFGravity;
-    AirResistance : TVFAirResistance;
+    Gravity : TGLVerletGravity;
+    AirResistance : TGLVerletAirResistance;
     procedure CreateBall;
     procedure CreateBall;
     procedure CreateFur;
     procedure CreateFur;
   end;
   end;
@@ -175,11 +174,11 @@ begin
   CheckBox_FurGravityClick(Sender);
   CheckBox_FurGravityClick(Sender);
   CheckBox_WindResistenceClick(Sender);
   CheckBox_WindResistenceClick(Sender);
 
 
-  CreateVCPlaneFromGLPlane(GLShadowPlane_Floor, VerletWorld, cOffset);
-  CreateVCPlaneFromGLPlane(GLShadowPlane_Floor2, VerletWorld, cOffset);
-  CreateVCPlaneFromGLPlane(GLShadowPlane_Wall, VerletWorld, cOffset);
-  CreateVCPlaneFromGLPlane(GLShadowPlane_Wall2, VerletWorld, cOffset);
-  CreateVCPlaneFromGLPlane(GLShadowPlane_Wall3, VerletWorld, cOffset);
+  CreateVerletPlaneFromGLPlane(GLShadowPlane_Floor, VerletWorld, cOffset);
+  CreateVerletPlaneFromGLPlane(GLShadowPlane_Floor2, VerletWorld, cOffset);
+  CreateVerletPlaneFromGLPlane(GLShadowPlane_Wall, VerletWorld, cOffset);
+  CreateVerletPlaneFromGLPlane(GLShadowPlane_Wall2, VerletWorld, cOffset);
+  CreateVerletPlaneFromGLPlane(GLShadowPlane_Wall3, VerletWorld, cOffset);
 
 
   HairList := TList.Create;
   HairList := TList.Create;
 
 
@@ -292,7 +291,7 @@ begin
 
 
   CopyPosFromGeomToGL(odeFurBallGeom, FurBall);
   CopyPosFromGeomToGL(odeFurBallGeom, FurBall);
 
 
-  VCSphere := TVCSphere.Create(VerletWorld);
+  VCSphere := TGLVerletFricSphere.Create(VerletWorld);
   VCSphere.Radius := FurBall.Radius * 1.1;
   VCSphere.Radius := FurBall.Radius * 1.1;
   VCSphere.Location := AffineVectorMake(FurBall.AbsolutePosition);
   VCSphere.Location := AffineVectorMake(FurBall.AbsolutePosition);
 
 
@@ -371,7 +370,7 @@ begin
     FreeAndNil(Gravity)
     FreeAndNil(Gravity)
   else
   else
   begin
   begin
-    Gravity := TVFGravity.Create(VerletWorld);
+    Gravity := TGLVerletGravity.Create(VerletWorld);
     Gravity.Gravity := AffineVectorMake(0,0,-9.81);
     Gravity.Gravity := AffineVectorMake(0,0,-9.81);
   end;
   end;
 end;
 end;
@@ -382,7 +381,7 @@ begin
     FreeAndNil(AirResistance)
     FreeAndNil(AirResistance)
   else
   else
   begin
   begin
-    AirResistance := TVFAirResistance.Create(VerletWorld);
+    AirResistance := TGLVerletAirResistance.Create(VerletWorld);
     AirResistance.DragCoeff := 0.01;
     AirResistance.DragCoeff := 0.01;
     AirResistance.WindDirection := AffineVectorMake(1,0,0);
     AirResistance.WindDirection := AffineVectorMake(1,0,0);
     AirResistance.WindMagnitude := TrackBar_WindForce.Position/100 * cMaxWindMag;
     AirResistance.WindMagnitude := TrackBar_WindForce.Position/100 * cMaxWindMag;

BIN
Demos/Delphi/physics/OdeMachine.jpg


BIN
Demos/Delphi/physics/OdeRagdoll.jpg


BIN
Demos/Delphi/physics/OdeSimple.jpg


+ 159 - 70
Demos/Delphi/physics/aPhysics.htm

@@ -1,79 +1,168 @@
 <html>
 <html>
 
 
 <head>
 <head>
-<title>Behaviours demos
-</title>
-<meta http-equiv="Content-Type"
-content="text/html; charset=iso-8859-1">
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=Generator content="Microsoft Word 15 (filtered)">
+<title>Behaviours demos</title>
+<style>
+<!--
+ /* Font Definitions */
+ @font-face
+	{font-family:"Cambria Math";
+	panose-1:2 4 5 3 5 4 6 3 2 4;}
+@font-face
+	{font-family:Consolas;
+	panose-1:2 11 6 9 2 2 4 3 2 4;}
+ /* Style Definitions */
+ p.MsoNormal, li.MsoNormal, div.MsoNormal
+	{margin:0cm;
+	margin-bottom:.0001pt;
+	font-size:12.0pt;
+	font-family:"Times New Roman",serif;}
+a:link, span.MsoHyperlink
+	{color:blue;
+	text-decoration:underline;}
+a:visited, span.MsoHyperlinkFollowed
+	{color:purple;
+	text-decoration:underline;}
+p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
+	{mso-style-link:"\0422\0435\043A\0441\0442 \0417\043D\0430\043A";
+	margin-right:0cm;
+	margin-left:0cm;
+	font-size:12.0pt;
+	font-family:"Times New Roman",serif;}
+p.msonormal0, li.msonormal0, div.msonormal0
+	{mso-style-name:msonormal;
+	margin-right:0cm;
+	margin-left:0cm;
+	font-size:12.0pt;
+	font-family:"Times New Roman",serif;}
+span.a
+	{mso-style-name:"\0422\0435\043A\0441\0442 \0417\043D\0430\043A";
+	mso-style-link:\0422\0435\043A\0441\0442;
+	font-family:Consolas;}
+p.msochpdefault, li.msochpdefault, div.msochpdefault
+	{mso-style-name:msochpdefault;
+	margin-right:0cm;
+	margin-left:0cm;
+	font-size:10.0pt;
+	font-family:"Times New Roman",serif;}
+.MsoChpDefault
+	{font-size:10.0pt;}
+@page WordSection1
+	{size:595.3pt 841.9pt;
+	margin:2.0cm 42.5pt 2.0cm 3.0cm;}
+div.WordSection1
+	{page:WordSection1;}
+ /* List Definitions */
+ ol
+	{margin-bottom:0cm;}
+ul
+	{margin-bottom:0cm;}
+-->
+</style>
+
 </head>
 </head>
 
 
-<body bgcolor="#ffffff" link="#0000ff" vlink="#800080" lang="FR"
-style="tab-interval: 35.4pt">
-
-<p class="MsoPlainText"><font size="4" face="Courier New"><b>Physics&nbsp;:
-</b></font></p>
-
-<ul>
-    <li><a href="clothactor/clothactor.dpr"><b>clothactor
-</b></a><b>&nbsp;:
-</b><ul>
-            <li>Verlet cloth simulation and verlet constraints controlled by an actor's skeleton.
-</li>
-            <li>Verlet physics is used to simulate a cloth-like effect on a mesh. Trinity in a cape.
-</li>
-        </ul></li>
-    <li><a href="clothify/clothify.dpr"><b>clothify
-</b></a><b>&nbsp;:
-</b><ul>
-            <li>using VerletAssembly to simulate cloths / jellies
-</li>
-            <li>using GLVerletClothify to create a freeform/actor into a jelly / cloth
-</li>
-        </ul></li>
-    <li><a href="OdeFurball/OdeFurball.dpr"><b>Ode FurBall
-</b></a><b>&nbsp;:
-</b><ul>
-            <li>Using Verlet Hair with ODE: Fur Balls
-</li>
-            <li>This determines friction, play around with it!
-</li>
-        </ul></li>
-    <li><a href="OdeMachine/OdeMachine.dpr"><b>Ode Machine
-</b></a><b>&nbsp;:
-</b><ul>
-            <li>Using ODEManager to create complex dynamics objects
-</li>
-            <li>Using joints to connect several objects
-</li>
-        </ul>
-    </li>
-    <li><a href="file:///D:/GLScene/Samples/Delphi/Demos/physics/OdeMachine/OdeMachine.dpr"><b><font color="#0066cc">Ode Ragdoll</font>
-</b></a><b>&nbsp;:
-</b><ul>
-            <li>Using ODEManager to create skinned ragdolls
-</li>
-            <li>Using joints to cast a ragdoll on&nbsp;different objects
-</li>
-        </ul>
-    </li>
-    <li><a href="OdeSimple/OdeSimple.dpr"><b>Ode Simple
-</b></a><b>&nbsp;:
-</b><ul>
-            <li>Using ODEManager to create simple dynamics objects
-</li>
-        </ul></li>
-    <li><a href="OdeTerrain/OdeTerrain.dpr"><b>Ode Terrain
-</b></a><b>&nbsp;:
-</b><ul>
-            <li>Getting a GLODEManager and GLTerrainRenderer talking.
-</li>
-            <li>Use '1' -&gt; '5' keys to drop objects onto Terrain.
-</li>
-        </ul>
-    </li>
+<body bgcolor=white lang=RU link=blue vlink=purple>
+
+<div class=WordSection1>
+
+<p class=MsoPlainText><b><span lang=FR style='font-size:13.5pt;font-family:
+"Courier New"'>Physics&nbsp;: </span></b></p>
+
+<ul style='margin-top:0cm' type=disc>
+ <li class=MsoNormal><span lang=FR><a href="../../clothactor/clothactor.dpr"><b>Clothactor
+     </b></a><b>&nbsp;: </b></span></li>
+ <ul style='margin-top:0cm' type=circle>
+  <li class=MsoNormal><span lang=FR>Verlet cloth simulation and verlet
+      constraints controlled by an actor's skeleton. </span></li>
+  <li class=MsoNormal><span lang=FR>Verlet physics is used to simulate a
+      cloth-like effect on a mesh. Trinity in a cape. </span></li>
+ </ul>
+</ul>
+
+<p class=MsoNormal><img border=0 width=549 height=406 src=ClothActor.jpg></p>
+
+<ul style='margin-top:0cm' type=disc>
+ <li class=MsoNormal><span lang=FR><a href="../../clothify/OdeClothify.dpr"><b>OdeClothify
+     </b></a><b>&nbsp;: </b></span></li>
+ <ul style='margin-top:0cm' type=circle>
+  <li class=MsoNormal><span lang=FR>using VerletAssembly to simulate cloths /
+      jellies </span></li>
+  <li class=MsoNormal><span lang=FR>using GLVerletClothify to create a
+      freeform/actor into a jelly / cloth </span></li>
+ </ul>
+</ul>
+
+<p class=MsoNormal><img border=0 width=616 height=445 src=OdeClothify.jpg></p>
+
+<ul style='margin-top:0cm' type=disc>
+ <li class=MsoNormal><span lang=FR><a href="../../OdeFurball/OdeFurball.dpr"><b>Ode
+     FurBall </b></a><b>&nbsp;: </b></span></li>
+ <ul style='margin-top:0cm' type=circle>
+  <li class=MsoNormal><span lang=FR>Using Verlet Hair with ODE: Fur Balls </span></li>
+  <li class=MsoNormal><span lang=FR>This determines friction, play around with
+      it! </span></li>
+ </ul>
+</ul>
+
+<p class=MsoNormal><img border=0 width=640 height=437 src=OdeFurBall.jpg></p>
+
+<ul style='margin-top:0cm' type=disc>
+ <li class=MsoNormal><span lang=FR><a href="../../OdeMachine/OdeMachine.dpr"><b>Ode
+     Machine </b></a><b>&nbsp;: </b></span></li>
+ <ul style='margin-top:0cm' type=circle>
+  <li class=MsoNormal><span lang=FR>Using ODEManager to create complex dynamics
+      objects </span></li>
+  <li class=MsoNormal><span lang=FR>Using joints to connect several objects </span></li>
+ </ul>
 </ul>
 </ul>
 
 
-<a href="../demos.htm">Back
-</a></p>
+<p class=MsoNormal><img border=0 width=507 height=356 src=OdeMachine.jpg></p>
+
+<ul style='margin-top:0cm' type=disc>
+ <li class=MsoNormal><span lang=FR><a
+     href="../../../../../Samples/Delphi/Demos/physics/OdeMachine/OdeMachine.dpr"><b><span
+     style='color:#0066CC'>Ode Ragdoll</span> </b></a><b>&nbsp;: </b></span></li>
+ <ul style='margin-top:0cm' type=circle>
+  <li class=MsoNormal><span lang=FR>Using ODEManager to create skinned ragdolls
+      </span></li>
+  <li class=MsoNormal><span lang=FR>Using joints to cast a ragdoll
+      on&nbsp;different objects </span></li>
+ </ul>
+</ul>
+
+<p class=MsoNormal><img border=0 width=583 height=420 src=OdeRagdoll.jpg></p>
+
+<ul style='margin-top:0cm' type=disc>
+ <li class=MsoNormal><span lang=FR><a href="../../OdeSimple/OdeSimple.dpr"><b>Ode
+     Simple </b></a><b>&nbsp;: </b></span></li>
+ <ul style='margin-top:0cm' type=circle>
+  <li class=MsoNormal><span lang=FR>Using ODEManager to create simple dynamics
+      objects </span></li>
+ </ul>
+</ul>
+
+<p class=MsoNormal><img border=0 width=694 height=510 src=OdeSimple.jpg></p>
+
+<ul style='margin-top:0cm' type=disc>
+ <li class=MsoNormal><span lang=FR><a href="../../OdeTerrain/OdeTerrain.dpr"><b>Ode
+     Terrain </b></a><b>&nbsp;: </b></span></li>
+ <ul style='margin-top:0cm' type=circle>
+  <li class=MsoNormal><span lang=FR>Getting a GLODEManager and
+      GLTerrainRenderer talking. </span></li>
+  <li class=MsoNormal><span lang=FR>Use '1' -&gt; '5' keys to drop objects onto
+      Terrain. </span></li>
+ </ul>
+</ul>
+
+<p class=MsoNormal><img border=0 width=725 height=537 src=OdeTerrain.jpg></p>
+
+<p class=MsoNormal><span lang=FR><a href="../../../demos.htm">Back </a></span></p>
+
+</div>
+
 </body>
 </body>
+
 </html>
 </html>

+ 20 - 22
Packages/GLScene_RT.dpk

@@ -57,10 +57,11 @@ contains
   GLS.AVIRecorder in '..\Source\GLS.AVIRecorder.pas',
   GLS.AVIRecorder in '..\Source\GLS.AVIRecorder.pas',
   GLS.AnimatedSprite in '..\Source\GLS.AnimatedSprite.pas',
   GLS.AnimatedSprite in '..\Source\GLS.AnimatedSprite.pas',
   GLS.AnimationUtils in '..\Source\GLS.AnimationUtils.pas',
   GLS.AnimationUtils in '..\Source\GLS.AnimationUtils.pas',
+  GLS.ApplicationFileIO in '..\Source\GLS.ApplicationFileIO.pas',
   GLS.AsyncHDS in '..\Source\GLS.AsyncHDS.pas',
   GLS.AsyncHDS in '..\Source\GLS.AsyncHDS.pas',
   GLS.AsyncTimer in '..\Source\GLS.AsyncTimer.pas',
   GLS.AsyncTimer in '..\Source\GLS.AsyncTimer.pas',
   GLS.Atmosphere in '..\Source\GLS.Atmosphere.pas',
   GLS.Atmosphere in '..\Source\GLS.Atmosphere.pas',
-  GLS.MeshBSP in '..\Source\GLS.MeshBSP.pas',
+  GLS.BaseClasses in '..\Source\GLS.BaseClasses.pas',
   GLS.BaseMeshSilhouette in '..\Source\GLS.BaseMeshSilhouette.pas',
   GLS.BaseMeshSilhouette in '..\Source\GLS.BaseMeshSilhouette.pas',
   GLS.Behaviours in '..\Source\GLS.Behaviours.pas',
   GLS.Behaviours in '..\Source\GLS.Behaviours.pas',
   GLS.BitmapFont in '..\Source\GLS.BitmapFont.pas',
   GLS.BitmapFont in '..\Source\GLS.BitmapFont.pas',
@@ -74,6 +75,8 @@ contains
   GLS.CompositeImage in '..\Source\GLS.CompositeImage.pas',
   GLS.CompositeImage in '..\Source\GLS.CompositeImage.pas',
   GLS.Console in '..\Source\GLS.Console.pas',
   GLS.Console in '..\Source\GLS.Console.pas',
   GLS.Context in '..\Source\GLS.Context.pas',
   GLS.Context in '..\Source\GLS.Context.pas',
+  GLS.Coordinates in '..\Source\GLS.Coordinates.pas',
+  GLS.CurvesAndSurfaces in '..\Source\GLS.CurvesAndSurfaces.pas',
   GLS.DCE in '..\Source\GLS.DCE.pas',
   GLS.DCE in '..\Source\GLS.DCE.pas',
   GLS.DynamicTexture in '..\Source\GLS.DynamicTexture.pas',
   GLS.DynamicTexture in '..\Source\GLS.DynamicTexture.pas',
   GLS.EParticleMasksManager in '..\Source\GLS.EParticleMasksManager.pas',
   GLS.EParticleMasksManager in '..\Source\GLS.EParticleMasksManager.pas',
@@ -90,6 +93,7 @@ contains
   GLS.FileB3D in '..\Source\GLS.FileB3D.pas',
   GLS.FileB3D in '..\Source\GLS.FileB3D.pas',
   GLS.FileBMP in '..\Source\GLS.FileBMP.pas',
   GLS.FileBMP in '..\Source\GLS.FileBMP.pas',
   GLS.FileDDS in '..\Source\GLS.FileDDS.pas',
   GLS.FileDDS in '..\Source\GLS.FileDDS.pas',
+  GLS.FileDXF in '..\Source\GLS.FileDXF.pas',
   GLS.FileGL2 in '..\Source\GLS.FileGL2.pas',
   GLS.FileGL2 in '..\Source\GLS.FileGL2.pas',
   GLS.FileGLB in '..\Source\GLS.FileGLB.pas',
   GLS.FileGLB in '..\Source\GLS.FileGLB.pas',
   GLS.FileGLTF in '..\Source\GLS.FileGLTF.pas',
   GLS.FileGLTF in '..\Source\GLS.FileGLTF.pas',
@@ -119,6 +123,7 @@ contains
   GLS.FileSMD in '..\Source\GLS.FileSMD.pas',
   GLS.FileSMD in '..\Source\GLS.FileSMD.pas',
   GLS.FileSTL in '..\Source\GLS.FileSTL.pas',
   GLS.FileSTL in '..\Source\GLS.FileSTL.pas',
   GLS.FileTGA in '..\Source\GLS.FileTGA.pas',
   GLS.FileTGA in '..\Source\GLS.FileTGA.pas',
+  GLS.FileTIN in '..\Source\GLS.FileTIN.pas',
   GLS.FileVfsPAK in '..\Source\GLS.FileVfsPAK.pas',
   GLS.FileVfsPAK in '..\Source\GLS.FileVfsPAK.pas',
   GLS.FileVRML in '..\Source\GLS.FileVRML.pas',
   GLS.FileVRML in '..\Source\GLS.FileVRML.pas',
   GLS.FileWAV in '..\Source\GLS.FileWAV.pas',
   GLS.FileWAV in '..\Source\GLS.FileWAV.pas',
@@ -141,7 +146,6 @@ contains
   GLS.HUDObjects in '..\Source\GLS.HUDObjects.pas',
   GLS.HUDObjects in '..\Source\GLS.HUDObjects.pas',
   GLS.HeightData in '..\Source\GLS.HeightData.pas',
   GLS.HeightData in '..\Source\GLS.HeightData.pas',
   GLS.HeightTileFileHDS in '..\Source\GLS.HeightTileFileHDS.pas',
   GLS.HeightTileFileHDS in '..\Source\GLS.HeightTileFileHDS.pas',
-  GLSL.LineShaders in '..\Source\GLSL.LineShaders.pas',
   GLS.ImageUtils in '..\Source\GLS.ImageUtils.pas',
   GLS.ImageUtils in '..\Source\GLS.ImageUtils.pas',
   GLS.Imposter in '..\Source\GLS.Imposter.pas',
   GLS.Imposter in '..\Source\GLS.Imposter.pas',
   GLS.Isolines in '..\Source\GLS.Isolines.pas',
   GLS.Isolines in '..\Source\GLS.Isolines.pas',
@@ -149,12 +153,14 @@ contains
   GLS.Joystick in '..\Source\GLS.Joystick.pas',
   GLS.Joystick in '..\Source\GLS.Joystick.pas',
   GLS.LensFlare in '..\Source\GLS.LensFlare.pas',
   GLS.LensFlare in '..\Source\GLS.LensFlare.pas',
   GLS.LinePFX in '..\Source\GLS.LinePFX.pas',
   GLS.LinePFX in '..\Source\GLS.LinePFX.pas',
+  GLS.Logger in '..\Source\GLS.Logger.pas',
   GLS.Manager in '..\Source\GLS.Manager.pas',
   GLS.Manager in '..\Source\GLS.Manager.pas',
   GLS.Material in '..\Source\GLS.Material.pas',
   GLS.Material in '..\Source\GLS.Material.pas',
   GLS.MaterialEx in '..\Source\GLS.MaterialEx.pas',
   GLS.MaterialEx in '..\Source\GLS.MaterialEx.pas',
   GLS.MaterialMultiProxy in '..\Source\GLS.MaterialMultiProxy.pas',
   GLS.MaterialMultiProxy in '..\Source\GLS.MaterialMultiProxy.pas',
   GLS.MaterialScript in '..\Source\GLS.MaterialScript.pas',
   GLS.MaterialScript in '..\Source\GLS.MaterialScript.pas',
   GLS.Mesh in '..\Source\GLS.Mesh.pas',
   GLS.Mesh in '..\Source\GLS.Mesh.pas',
+  GLS.MeshBSP in '..\Source\GLS.MeshBSP.pas',
   GLS.MeshBuilder in '..\Source\GLS.MeshBuilder.pas',
   GLS.MeshBuilder in '..\Source\GLS.MeshBuilder.pas',
   GLS.MeshCSG in '..\Source\GLS.MeshCSG.pas',
   GLS.MeshCSG in '..\Source\GLS.MeshCSG.pas',
   GLS.MeshLines in '..\Source\GLS.MeshLines.pas',
   GLS.MeshLines in '..\Source\GLS.MeshLines.pas',
@@ -169,6 +175,7 @@ contains
   GLS.ObjectManager in '..\Source\GLS.ObjectManager.pas',
   GLS.ObjectManager in '..\Source\GLS.ObjectManager.pas',
   GLS.Objects in '..\Source\GLS.Objects.pas',
   GLS.Objects in '..\Source\GLS.Objects.pas',
   GLS.Octree in '..\Source\GLS.Octree.pas',
   GLS.Octree in '..\Source\GLS.Octree.pas',
+  GLS.RGBE in '..\Source\GLS.RGBE.pas',
   GLS.ParametricSurfaces in '..\Source\GLS.ParametricSurfaces.pas',
   GLS.ParametricSurfaces in '..\Source\GLS.ParametricSurfaces.pas',
   GLS.ParticleFX in '..\Source\GLS.ParticleFX.pas',
   GLS.ParticleFX in '..\Source\GLS.ParticleFX.pas',
   GLS.Particles in '..\Source\GLS.Particles.pas',
   GLS.Particles in '..\Source\GLS.Particles.pas',
@@ -185,20 +192,24 @@ contains
   GLS.ArchiveManager in '..\Source\GLS.ArchiveManager.pas',
   GLS.ArchiveManager in '..\Source\GLS.ArchiveManager.pas',
   GLS.Generics in '..\Source\GLS.Generics.pas',
   GLS.Generics in '..\Source\GLS.Generics.pas',
   GLSL.AsmShader in '..\Source\GLSL.AsmShader.pas',
   GLSL.AsmShader in '..\Source\GLSL.AsmShader.pas',
-  GLSL.ShaderCombiner in '..\Source\GLSL.ShaderCombiner.pas',
+  GLSL.BumpShaders in '..\Source\GLSL.BumpShaders.pas',
+  GLSL.DiffuseSpecularShader in '..\Source\GLSL.DiffuseSpecularShader.pas',
   GLSL.CustomShader in '..\Source\GLSL.CustomShader.pas',
   GLSL.CustomShader in '..\Source\GLSL.CustomShader.pas',
+  GLSL.LineShaders in '..\Source\GLSL.LineShaders.pas',
   GLSL.MultiMaterialShader in '..\Source\GLSL.MultiMaterialShader.pas',
   GLSL.MultiMaterialShader in '..\Source\GLSL.MultiMaterialShader.pas',
+  GLSL.PostShaders in '..\Source\GLSL.PostShaders.pas',
+  GLSL.ProjectedTextures in '..\Source\GLSL.ProjectedTextures.pas',
   GLSL.PhongShader in '..\Source\GLSL.PhongShader.pas',
   GLSL.PhongShader in '..\Source\GLSL.PhongShader.pas',
+  GLSL.ShaderCombiner in '..\Source\GLSL.ShaderCombiner.pas',
   GLSL.TextureShaders in '..\Source\GLSL.TextureShaders.pas',
   GLSL.TextureShaders in '..\Source\GLSL.TextureShaders.pas',
   GLSL.UserShader in '..\Source\GLSL.UserShader.pas',
   GLSL.UserShader in '..\Source\GLSL.UserShader.pas',
-  GLSL.BumpShaders in '..\Source\GLSL.BumpShaders.pas',
-  GLSL.DiffuseSpecularShader in '..\Source\GLSL.DiffuseSpecularShader.pas',
   GLSL.ShapeShaders in '..\Source\GLSL.ShapeShaders.pas',
   GLSL.ShapeShaders in '..\Source\GLSL.ShapeShaders.pas',
   GLSL.ShaderParameter in '..\Source\GLSL.ShaderParameter.pas',
   GLSL.ShaderParameter in '..\Source\GLSL.ShaderParameter.pas',
-  GLSL.PostShaders in '..\Source\GLSL.PostShaders.pas',
-  GLSL.ProjectedTextures in '..\Source\GLSL.ProjectedTextures.pas',
   GLSL.Shader in '..\Source\GLSL.Shader.pas',
   GLSL.Shader in '..\Source\GLSL.Shader.pas',
   GLS.Language in '..\Source\GLS.Language.pas',
   GLS.Language in '..\Source\GLS.Language.pas',
+  GLS.Memo in '..\Source\GLS.Memo.pas',
+  GLS.OpenGLVCL in '..\Source\GLS.OpenGLVCL.pas',
+  GLS.ProjectedTextures in '..\Source\GLS.ProjectedTextures.pas',
   GLS.Scene in '..\Source\GLS.Scene.pas',
   GLS.Scene in '..\Source\GLS.Scene.pas',
   GLS.SceneForm in '..\Source\GLS.SceneForm.pas',
   GLS.SceneForm in '..\Source\GLS.SceneForm.pas',
   GLS.Screen in '..\Source\GLS.Screen.pas',
   GLS.Screen in '..\Source\GLS.Screen.pas',
@@ -215,11 +226,7 @@ contains
   GLS.SpacePartition in '..\Source\GLS.SpacePartition.pas',
   GLS.SpacePartition in '..\Source\GLS.SpacePartition.pas',
   GLS.State in '..\Source\GLS.State.pas',
   GLS.State in '..\Source\GLS.State.pas',
   GLS.SpaceText in '..\Source\GLS.SpaceText.pas',
   GLS.SpaceText in '..\Source\GLS.SpaceText.pas',
-  GLS.FileDXF in '..\Source\GLS.FileDXF.pas',
-  GLS.FileTIN in '..\Source\GLS.FileTIN.pas',
-  GLS.Memo in '..\Source\GLS.Memo.pas',
-  GLS.OpenGLVCL in '..\Source\GLS.OpenGLVCL.pas',
-  GLS.ProjectedTextures in '..\Source\GLS.ProjectedTextures.pas',
+  GLS.SceneViewer in '..\Source\GLS.SceneViewer.pas',
   GLS.TerrainRenderer in '..\Source\GLS.TerrainRenderer.pas',
   GLS.TerrainRenderer in '..\Source\GLS.TerrainRenderer.pas',
   GLS.TexLensFlare in '..\Source\GLS.TexLensFlare.pas',
   GLS.TexLensFlare in '..\Source\GLS.TexLensFlare.pas',
   GLS.Texture in '..\Source\GLS.Texture.pas',
   GLS.Texture in '..\Source\GLS.Texture.pas',
@@ -235,22 +242,15 @@ contains
   GLS.Triangulation in '..\Source\GLS.Triangulation.pas',
   GLS.Triangulation in '..\Source\GLS.Triangulation.pas',
   GLS.Utils in '..\Source\GLS.Utils.pas',
   GLS.Utils in '..\Source\GLS.Utils.pas',
   GLS.VectorFileObjects in '..\Source\GLS.VectorFileObjects.pas',
   GLS.VectorFileObjects in '..\Source\GLS.VectorFileObjects.pas',
-  GLS.VerletClothify in '..\Source\GLS.VerletClothify.pas',
-  GLS.VerletHairClasses in '..\Source\GLS.VerletHairClasses.pas',
-  GLS.VerletSkeletonColliders in '..\Source\GLS.VerletSkeletonColliders.pas',
   GLS.VerletTypes in '..\Source\GLS.VerletTypes.pas',
   GLS.VerletTypes in '..\Source\GLS.VerletTypes.pas',
+  GLS.VerletClothify in '..\Source\GLS.VerletClothify.pas',
   GLS.WaterPlane in '..\Source\GLS.WaterPlane.pas',
   GLS.WaterPlane in '..\Source\GLS.WaterPlane.pas',
-  GLS.SceneViewer in '..\Source\GLS.SceneViewer.pas',
   GLS.Windows in '..\Source\GLS.Windows.pas',
   GLS.Windows in '..\Source\GLS.Windows.pas',
   GLS.WindowsContext in '..\Source\GLS.WindowsContext.pas',
   GLS.WindowsContext in '..\Source\GLS.WindowsContext.pas',
   GLS.WindowsFont in '..\Source\GLS.WindowsFont.pas',
   GLS.WindowsFont in '..\Source\GLS.WindowsFont.pas',
   GLS.zBuffer in '..\Source\GLS.zBuffer.pas',
   GLS.zBuffer in '..\Source\GLS.zBuffer.pas',
   GLS.OpenGLAdapter in '..\Source\GLS.OpenGLAdapter.pas',
   GLS.OpenGLAdapter in '..\Source\GLS.OpenGLAdapter.pas',
   GLS.OpenGLTokens in '..\Source\GLS.OpenGLTokens.pas',
   GLS.OpenGLTokens in '..\Source\GLS.OpenGLTokens.pas',
-  GLS.ApplicationFileIO in '..\Source\GLS.ApplicationFileIO.pas',
-  GLS.BaseClasses in '..\Source\GLS.BaseClasses.pas',
-  GLS.Coordinates in '..\Source\GLS.Coordinates.pas',
-  GLS.CurvesAndSurfaces in '..\Source\GLS.CurvesAndSurfaces.pas',
   GLS.PersistentClasses in '..\Source\GLS.PersistentClasses.pas',
   GLS.PersistentClasses in '..\Source\GLS.PersistentClasses.pas',
   GLS.PipelineTransformation in '..\Source\GLS.PipelineTransformation.pas',
   GLS.PipelineTransformation in '..\Source\GLS.PipelineTransformation.pas',
   GLS.Polynomials in '..\Source\GLS.Polynomials.pas',
   GLS.Polynomials in '..\Source\GLS.Polynomials.pas',
@@ -259,8 +259,6 @@ contains
   GLS.PlugInManager in '..\Source\GLS.PlugInManager.pas',
   GLS.PlugInManager in '..\Source\GLS.PlugInManager.pas',
   GLS.VectorTypesExt in '..\Source\GLS.VectorTypesExt.pas',
   GLS.VectorTypesExt in '..\Source\GLS.VectorTypesExt.pas',
   GLS.VectorGeometry in '..\Source\GLS.VectorGeometry.pas',
   GLS.VectorGeometry in '..\Source\GLS.VectorGeometry.pas',
-  GLS.Logger in '..\Source\GLS.Logger.pas',
-  GLS.RGBE in '..\Source\GLS.RGBE.pas',
   GLS.VectorLists in '..\Source\GLS.VectorLists.pas',
   GLS.VectorLists in '..\Source\GLS.VectorLists.pas',
   GLS.VectorTypes in '..\Source\GLS.VectorTypes.pas',
   GLS.VectorTypes in '..\Source\GLS.VectorTypes.pas',
   GLS.ScriptBase in '..\Source\GLS.ScriptBase.pas',
   GLS.ScriptBase in '..\Source\GLS.ScriptBase.pas',

+ 20 - 22
Packages/GLScene_RT.dproj

@@ -161,10 +161,11 @@
         <DCCReference Include="..\Source\GLS.AVIRecorder.pas"/>
         <DCCReference Include="..\Source\GLS.AVIRecorder.pas"/>
         <DCCReference Include="..\Source\GLS.AnimatedSprite.pas"/>
         <DCCReference Include="..\Source\GLS.AnimatedSprite.pas"/>
         <DCCReference Include="..\Source\GLS.AnimationUtils.pas"/>
         <DCCReference Include="..\Source\GLS.AnimationUtils.pas"/>
+        <DCCReference Include="..\Source\GLS.ApplicationFileIO.pas"/>
         <DCCReference Include="..\Source\GLS.AsyncHDS.pas"/>
         <DCCReference Include="..\Source\GLS.AsyncHDS.pas"/>
         <DCCReference Include="..\Source\GLS.AsyncTimer.pas"/>
         <DCCReference Include="..\Source\GLS.AsyncTimer.pas"/>
         <DCCReference Include="..\Source\GLS.Atmosphere.pas"/>
         <DCCReference Include="..\Source\GLS.Atmosphere.pas"/>
-        <DCCReference Include="..\Source\GLS.MeshBSP.pas"/>
+        <DCCReference Include="..\Source\GLS.BaseClasses.pas"/>
         <DCCReference Include="..\Source\GLS.BaseMeshSilhouette.pas"/>
         <DCCReference Include="..\Source\GLS.BaseMeshSilhouette.pas"/>
         <DCCReference Include="..\Source\GLS.Behaviours.pas"/>
         <DCCReference Include="..\Source\GLS.Behaviours.pas"/>
         <DCCReference Include="..\Source\GLS.BitmapFont.pas"/>
         <DCCReference Include="..\Source\GLS.BitmapFont.pas"/>
@@ -178,6 +179,8 @@
         <DCCReference Include="..\Source\GLS.CompositeImage.pas"/>
         <DCCReference Include="..\Source\GLS.CompositeImage.pas"/>
         <DCCReference Include="..\Source\GLS.Console.pas"/>
         <DCCReference Include="..\Source\GLS.Console.pas"/>
         <DCCReference Include="..\Source\GLS.Context.pas"/>
         <DCCReference Include="..\Source\GLS.Context.pas"/>
+        <DCCReference Include="..\Source\GLS.Coordinates.pas"/>
+        <DCCReference Include="..\Source\GLS.CurvesAndSurfaces.pas"/>
         <DCCReference Include="..\Source\GLS.DCE.pas"/>
         <DCCReference Include="..\Source\GLS.DCE.pas"/>
         <DCCReference Include="..\Source\GLS.DynamicTexture.pas"/>
         <DCCReference Include="..\Source\GLS.DynamicTexture.pas"/>
         <DCCReference Include="..\Source\GLS.EParticleMasksManager.pas"/>
         <DCCReference Include="..\Source\GLS.EParticleMasksManager.pas"/>
@@ -194,6 +197,7 @@
         <DCCReference Include="..\Source\GLS.FileB3D.pas"/>
         <DCCReference Include="..\Source\GLS.FileB3D.pas"/>
         <DCCReference Include="..\Source\GLS.FileBMP.pas"/>
         <DCCReference Include="..\Source\GLS.FileBMP.pas"/>
         <DCCReference Include="..\Source\GLS.FileDDS.pas"/>
         <DCCReference Include="..\Source\GLS.FileDDS.pas"/>
+        <DCCReference Include="..\Source\GLS.FileDXF.pas"/>
         <DCCReference Include="..\Source\GLS.FileGL2.pas"/>
         <DCCReference Include="..\Source\GLS.FileGL2.pas"/>
         <DCCReference Include="..\Source\GLS.FileGLB.pas"/>
         <DCCReference Include="..\Source\GLS.FileGLB.pas"/>
         <DCCReference Include="..\Source\GLS.FileGLTF.pas"/>
         <DCCReference Include="..\Source\GLS.FileGLTF.pas"/>
@@ -223,6 +227,7 @@
         <DCCReference Include="..\Source\GLS.FileSMD.pas"/>
         <DCCReference Include="..\Source\GLS.FileSMD.pas"/>
         <DCCReference Include="..\Source\GLS.FileSTL.pas"/>
         <DCCReference Include="..\Source\GLS.FileSTL.pas"/>
         <DCCReference Include="..\Source\GLS.FileTGA.pas"/>
         <DCCReference Include="..\Source\GLS.FileTGA.pas"/>
+        <DCCReference Include="..\Source\GLS.FileTIN.pas"/>
         <DCCReference Include="..\Source\GLS.FileVfsPAK.pas"/>
         <DCCReference Include="..\Source\GLS.FileVfsPAK.pas"/>
         <DCCReference Include="..\Source\GLS.FileVRML.pas"/>
         <DCCReference Include="..\Source\GLS.FileVRML.pas"/>
         <DCCReference Include="..\Source\GLS.FileWAV.pas"/>
         <DCCReference Include="..\Source\GLS.FileWAV.pas"/>
@@ -245,7 +250,6 @@
         <DCCReference Include="..\Source\GLS.HUDObjects.pas"/>
         <DCCReference Include="..\Source\GLS.HUDObjects.pas"/>
         <DCCReference Include="..\Source\GLS.HeightData.pas"/>
         <DCCReference Include="..\Source\GLS.HeightData.pas"/>
         <DCCReference Include="..\Source\GLS.HeightTileFileHDS.pas"/>
         <DCCReference Include="..\Source\GLS.HeightTileFileHDS.pas"/>
-        <DCCReference Include="..\Source\GLSL.LineShaders.pas"/>
         <DCCReference Include="..\Source\GLS.ImageUtils.pas"/>
         <DCCReference Include="..\Source\GLS.ImageUtils.pas"/>
         <DCCReference Include="..\Source\GLS.Imposter.pas"/>
         <DCCReference Include="..\Source\GLS.Imposter.pas"/>
         <DCCReference Include="..\Source\GLS.Isolines.pas"/>
         <DCCReference Include="..\Source\GLS.Isolines.pas"/>
@@ -253,12 +257,14 @@
         <DCCReference Include="..\Source\GLS.Joystick.pas"/>
         <DCCReference Include="..\Source\GLS.Joystick.pas"/>
         <DCCReference Include="..\Source\GLS.LensFlare.pas"/>
         <DCCReference Include="..\Source\GLS.LensFlare.pas"/>
         <DCCReference Include="..\Source\GLS.LinePFX.pas"/>
         <DCCReference Include="..\Source\GLS.LinePFX.pas"/>
+        <DCCReference Include="..\Source\GLS.Logger.pas"/>
         <DCCReference Include="..\Source\GLS.Manager.pas"/>
         <DCCReference Include="..\Source\GLS.Manager.pas"/>
         <DCCReference Include="..\Source\GLS.Material.pas"/>
         <DCCReference Include="..\Source\GLS.Material.pas"/>
         <DCCReference Include="..\Source\GLS.MaterialEx.pas"/>
         <DCCReference Include="..\Source\GLS.MaterialEx.pas"/>
         <DCCReference Include="..\Source\GLS.MaterialMultiProxy.pas"/>
         <DCCReference Include="..\Source\GLS.MaterialMultiProxy.pas"/>
         <DCCReference Include="..\Source\GLS.MaterialScript.pas"/>
         <DCCReference Include="..\Source\GLS.MaterialScript.pas"/>
         <DCCReference Include="..\Source\GLS.Mesh.pas"/>
         <DCCReference Include="..\Source\GLS.Mesh.pas"/>
+        <DCCReference Include="..\Source\GLS.MeshBSP.pas"/>
         <DCCReference Include="..\Source\GLS.MeshBuilder.pas"/>
         <DCCReference Include="..\Source\GLS.MeshBuilder.pas"/>
         <DCCReference Include="..\Source\GLS.MeshCSG.pas"/>
         <DCCReference Include="..\Source\GLS.MeshCSG.pas"/>
         <DCCReference Include="..\Source\GLS.MeshLines.pas"/>
         <DCCReference Include="..\Source\GLS.MeshLines.pas"/>
@@ -273,6 +279,7 @@
         <DCCReference Include="..\Source\GLS.ObjectManager.pas"/>
         <DCCReference Include="..\Source\GLS.ObjectManager.pas"/>
         <DCCReference Include="..\Source\GLS.Objects.pas"/>
         <DCCReference Include="..\Source\GLS.Objects.pas"/>
         <DCCReference Include="..\Source\GLS.Octree.pas"/>
         <DCCReference Include="..\Source\GLS.Octree.pas"/>
+        <DCCReference Include="..\Source\GLS.RGBE.pas"/>
         <DCCReference Include="..\Source\GLS.ParametricSurfaces.pas"/>
         <DCCReference Include="..\Source\GLS.ParametricSurfaces.pas"/>
         <DCCReference Include="..\Source\GLS.ParticleFX.pas"/>
         <DCCReference Include="..\Source\GLS.ParticleFX.pas"/>
         <DCCReference Include="..\Source\GLS.Particles.pas"/>
         <DCCReference Include="..\Source\GLS.Particles.pas"/>
@@ -289,20 +296,24 @@
         <DCCReference Include="..\Source\GLS.ArchiveManager.pas"/>
         <DCCReference Include="..\Source\GLS.ArchiveManager.pas"/>
         <DCCReference Include="..\Source\GLS.Generics.pas"/>
         <DCCReference Include="..\Source\GLS.Generics.pas"/>
         <DCCReference Include="..\Source\GLSL.AsmShader.pas"/>
         <DCCReference Include="..\Source\GLSL.AsmShader.pas"/>
-        <DCCReference Include="..\Source\GLSL.ShaderCombiner.pas"/>
+        <DCCReference Include="..\Source\GLSL.BumpShaders.pas"/>
+        <DCCReference Include="..\Source\GLSL.DiffuseSpecularShader.pas"/>
         <DCCReference Include="..\Source\GLSL.CustomShader.pas"/>
         <DCCReference Include="..\Source\GLSL.CustomShader.pas"/>
+        <DCCReference Include="..\Source\GLSL.LineShaders.pas"/>
         <DCCReference Include="..\Source\GLSL.MultiMaterialShader.pas"/>
         <DCCReference Include="..\Source\GLSL.MultiMaterialShader.pas"/>
+        <DCCReference Include="..\Source\GLSL.PostShaders.pas"/>
+        <DCCReference Include="..\Source\GLSL.ProjectedTextures.pas"/>
         <DCCReference Include="..\Source\GLSL.PhongShader.pas"/>
         <DCCReference Include="..\Source\GLSL.PhongShader.pas"/>
+        <DCCReference Include="..\Source\GLSL.ShaderCombiner.pas"/>
         <DCCReference Include="..\Source\GLSL.TextureShaders.pas"/>
         <DCCReference Include="..\Source\GLSL.TextureShaders.pas"/>
         <DCCReference Include="..\Source\GLSL.UserShader.pas"/>
         <DCCReference Include="..\Source\GLSL.UserShader.pas"/>
-        <DCCReference Include="..\Source\GLSL.BumpShaders.pas"/>
-        <DCCReference Include="..\Source\GLSL.DiffuseSpecularShader.pas"/>
         <DCCReference Include="..\Source\GLSL.ShapeShaders.pas"/>
         <DCCReference Include="..\Source\GLSL.ShapeShaders.pas"/>
         <DCCReference Include="..\Source\GLSL.ShaderParameter.pas"/>
         <DCCReference Include="..\Source\GLSL.ShaderParameter.pas"/>
-        <DCCReference Include="..\Source\GLSL.PostShaders.pas"/>
-        <DCCReference Include="..\Source\GLSL.ProjectedTextures.pas"/>
         <DCCReference Include="..\Source\GLSL.Shader.pas"/>
         <DCCReference Include="..\Source\GLSL.Shader.pas"/>
         <DCCReference Include="..\Source\GLS.Language.pas"/>
         <DCCReference Include="..\Source\GLS.Language.pas"/>
+        <DCCReference Include="..\Source\GLS.Memo.pas"/>
+        <DCCReference Include="..\Source\GLS.OpenGLVCL.pas"/>
+        <DCCReference Include="..\Source\GLS.ProjectedTextures.pas"/>
         <DCCReference Include="..\Source\GLS.Scene.pas"/>
         <DCCReference Include="..\Source\GLS.Scene.pas"/>
         <DCCReference Include="..\Source\GLS.SceneForm.pas"/>
         <DCCReference Include="..\Source\GLS.SceneForm.pas"/>
         <DCCReference Include="..\Source\GLS.Screen.pas"/>
         <DCCReference Include="..\Source\GLS.Screen.pas"/>
@@ -319,11 +330,7 @@
         <DCCReference Include="..\Source\GLS.SpacePartition.pas"/>
         <DCCReference Include="..\Source\GLS.SpacePartition.pas"/>
         <DCCReference Include="..\Source\GLS.State.pas"/>
         <DCCReference Include="..\Source\GLS.State.pas"/>
         <DCCReference Include="..\Source\GLS.SpaceText.pas"/>
         <DCCReference Include="..\Source\GLS.SpaceText.pas"/>
-        <DCCReference Include="..\Source\GLS.FileDXF.pas"/>
-        <DCCReference Include="..\Source\GLS.FileTIN.pas"/>
-        <DCCReference Include="..\Source\GLS.Memo.pas"/>
-        <DCCReference Include="..\Source\GLS.OpenGLVCL.pas"/>
-        <DCCReference Include="..\Source\GLS.ProjectedTextures.pas"/>
+        <DCCReference Include="..\Source\GLS.SceneViewer.pas"/>
         <DCCReference Include="..\Source\GLS.TerrainRenderer.pas"/>
         <DCCReference Include="..\Source\GLS.TerrainRenderer.pas"/>
         <DCCReference Include="..\Source\GLS.TexLensFlare.pas"/>
         <DCCReference Include="..\Source\GLS.TexLensFlare.pas"/>
         <DCCReference Include="..\Source\GLS.Texture.pas"/>
         <DCCReference Include="..\Source\GLS.Texture.pas"/>
@@ -339,22 +346,15 @@
         <DCCReference Include="..\Source\GLS.Triangulation.pas"/>
         <DCCReference Include="..\Source\GLS.Triangulation.pas"/>
         <DCCReference Include="..\Source\GLS.Utils.pas"/>
         <DCCReference Include="..\Source\GLS.Utils.pas"/>
         <DCCReference Include="..\Source\GLS.VectorFileObjects.pas"/>
         <DCCReference Include="..\Source\GLS.VectorFileObjects.pas"/>
-        <DCCReference Include="..\Source\GLS.VerletClothify.pas"/>
-        <DCCReference Include="..\Source\GLS.VerletHairClasses.pas"/>
-        <DCCReference Include="..\Source\GLS.VerletSkeletonColliders.pas"/>
         <DCCReference Include="..\Source\GLS.VerletTypes.pas"/>
         <DCCReference Include="..\Source\GLS.VerletTypes.pas"/>
+        <DCCReference Include="..\Source\GLS.VerletClothify.pas"/>
         <DCCReference Include="..\Source\GLS.WaterPlane.pas"/>
         <DCCReference Include="..\Source\GLS.WaterPlane.pas"/>
-        <DCCReference Include="..\Source\GLS.SceneViewer.pas"/>
         <DCCReference Include="..\Source\GLS.Windows.pas"/>
         <DCCReference Include="..\Source\GLS.Windows.pas"/>
         <DCCReference Include="..\Source\GLS.WindowsContext.pas"/>
         <DCCReference Include="..\Source\GLS.WindowsContext.pas"/>
         <DCCReference Include="..\Source\GLS.WindowsFont.pas"/>
         <DCCReference Include="..\Source\GLS.WindowsFont.pas"/>
         <DCCReference Include="..\Source\GLS.zBuffer.pas"/>
         <DCCReference Include="..\Source\GLS.zBuffer.pas"/>
         <DCCReference Include="..\Source\GLS.OpenGLAdapter.pas"/>
         <DCCReference Include="..\Source\GLS.OpenGLAdapter.pas"/>
         <DCCReference Include="..\Source\GLS.OpenGLTokens.pas"/>
         <DCCReference Include="..\Source\GLS.OpenGLTokens.pas"/>
-        <DCCReference Include="..\Source\GLS.ApplicationFileIO.pas"/>
-        <DCCReference Include="..\Source\GLS.BaseClasses.pas"/>
-        <DCCReference Include="..\Source\GLS.Coordinates.pas"/>
-        <DCCReference Include="..\Source\GLS.CurvesAndSurfaces.pas"/>
         <DCCReference Include="..\Source\GLS.PersistentClasses.pas"/>
         <DCCReference Include="..\Source\GLS.PersistentClasses.pas"/>
         <DCCReference Include="..\Source\GLS.PipelineTransformation.pas"/>
         <DCCReference Include="..\Source\GLS.PipelineTransformation.pas"/>
         <DCCReference Include="..\Source\GLS.Polynomials.pas"/>
         <DCCReference Include="..\Source\GLS.Polynomials.pas"/>
@@ -363,8 +363,6 @@
         <DCCReference Include="..\Source\GLS.PlugInManager.pas"/>
         <DCCReference Include="..\Source\GLS.PlugInManager.pas"/>
         <DCCReference Include="..\Source\GLS.VectorTypesExt.pas"/>
         <DCCReference Include="..\Source\GLS.VectorTypesExt.pas"/>
         <DCCReference Include="..\Source\GLS.VectorGeometry.pas"/>
         <DCCReference Include="..\Source\GLS.VectorGeometry.pas"/>
-        <DCCReference Include="..\Source\GLS.Logger.pas"/>
-        <DCCReference Include="..\Source\GLS.RGBE.pas"/>
         <DCCReference Include="..\Source\GLS.VectorLists.pas"/>
         <DCCReference Include="..\Source\GLS.VectorLists.pas"/>
         <DCCReference Include="..\Source\GLS.VectorTypes.pas"/>
         <DCCReference Include="..\Source\GLS.VectorTypes.pas"/>
         <DCCReference Include="..\Source\GLS.ScriptBase.pas"/>
         <DCCReference Include="..\Source\GLS.ScriptBase.pas"/>

+ 2 - 8
Source/Cg.Shader.pas

@@ -25,11 +25,10 @@ uses
   GLS.Material,
   GLS.Material,
   GLS.TextureFormat,
   GLS.TextureFormat,
 
 
-  Imports.cg,
+  Imports.Cg,
   Imports.cgGL;
   Imports.cgGL;
 
 
-{$I GLScene.inc}
-
+{.$I GLScene.inc}
 { .$DEFINE OutputCompilerWarnings }
 { .$DEFINE OutputCompilerWarnings }
 
 
 (* Define OutputCompilerWarnings to output Cg compiler warnings to a file. Useful
 (* Define OutputCompilerWarnings to output Cg compiler warnings to a file. Useful
@@ -40,18 +39,14 @@ type
   TCustomCgShader = class;
   TCustomCgShader = class;
   TCgProgram = class;
   TCgProgram = class;
   TCgParameter = class;
   TCgParameter = class;
-
   TCgApplyEvent = procedure(CgProgram: TCgProgram; Sender: TObject) of object;
   TCgApplyEvent = procedure(CgProgram: TCgProgram; Sender: TObject) of object;
   TCgUnApplyEvent = procedure(CgProgram: TCgProgram) of object;
   TCgUnApplyEvent = procedure(CgProgram: TCgProgram) of object;
   TCgShaderEvent = procedure(CgShader: TCustomCgShader) of object;
   TCgShaderEvent = procedure(CgShader: TCustomCgShader) of object;
-
   TcgProgramType = (ptVertex, ptFragment);
   TcgProgramType = (ptVertex, ptFragment);
-
   // Available vertex program profile
   // Available vertex program profile
   TCgVPProfile = (vpDetectLatest, vp20, vp30, vp40, arbvp1);
   TCgVPProfile = (vpDetectLatest, vp20, vp30, vp40, arbvp1);
   // Available fragment program profile
   // Available fragment program profile
   TCgFPProfile = (fpDetectLatest, fp20, fp30, fp40, arbfp1);
   TCgFPProfile = (fpDetectLatest, fp20, fp30, fp40, arbfp1);
-
   TPrecisionSetting = (psFull, psFast);
   TPrecisionSetting = (psFull, psFast);
 
 
   // Wrapper around a Cg program.
   // Wrapper around a Cg program.
@@ -591,7 +586,6 @@ begin
     Exit;
     Exit;
   if Assigned(FOnUnApply) then
   if Assigned(FOnUnApply) then
     FOnUnApply(Self);
     FOnUnApply(Self);
-
   cgGLDisableProfile(FProfile);
   cgGLDisableProfile(FProfile);
 end;
 end;
 
 

+ 0 - 1
Source/GLS.Color.pas

@@ -1,7 +1,6 @@
 //
 //
 // The graphics rendering engine GLScene http://glscene.org
 // The graphics rendering engine GLScene http://glscene.org
 //
 //
-
 unit GLS.Color;
 unit GLS.Color;
 
 
 (* All color types, constants and utilities should go here *)
 (* All color types, constants and utilities should go here *)

+ 0 - 219
Source/GLS.VerletHairClasses.pas

@@ -1,219 +0,0 @@
-//
-// The graphics rendering engine GLScene http://glscene.org
-//
-unit GLS.VerletHairClasses;
-
-(*
-  Creates a single strand of hair using verlet classes. Can be used to simulate
-  ropes, fur or hair.
-*)
-
-interface
-
-{$I GLScene.inc}
-
-uses
-  System.Classes,
-  System.SysUtils,
-  GLS.VerletTypes,
-  GLS.VectorTypes,
-  GLS.VectorLists,
-  GLS.VectorGeometry;
-
-type
-  TGLStiffnessVH = (vhsFull, vhsSkip1Node, vhsSkip2Node, vhsSkip3Node,
-    vhsSkip4Node, vhsSkip5Node, vhsSkip6Node, vhsSkip7Node, vhsSkip8Node,
-    vhsSkip9Node);
-  TGLStiffnessSetVH = set of TGLStiffnessVH;
-
-  TGLVerletHair = class
-  private
-    FNodeList: TGLVerletNodeList;
-    FLinkCount: integer;
-    FRootDepth: single;
-    FVerletWorld: TGLVerletWorld;
-    FHairLength: single;
-    FData: pointer;
-    FStiffness: TGLStiffnessSetVH;
-    FStiffnessList: TList;
-    function GetAnchor: TGLBaseNode;
-    function GetRoot: TGLBaseNode;
-    function GetLinkLength: single;
-    procedure AddStickStiffness(const ANodeSkip: integer);
-    procedure SetStiffness(const Value: TGLStiffnessSetVH);
-  public
-    procedure BuildHair(const AAnchorPosition, AHairDirection: TAffineVector);
-    procedure BuildStiffness;
-    procedure ClearStiffness;
-    procedure Clear;
-    constructor Create(const AVerletWorld: TGLVerletWorld;
-      const ARootDepth, AHairLength: single; ALinkCount: integer;
-      const AAnchorPosition, AHairDirection: TAffineVector;
-      const AStiffness: TGLStiffnessSetVH);
-    destructor Destroy; override;
-    property NodeList: TGLVerletNodeList read FNodeList;
-    property VerletWorld: TGLVerletWorld read FVerletWorld;
-    property RootDepth: single read FRootDepth;
-    property LinkLength: single read GetLinkLength;
-    property LinkCount: integer read FLinkCount;
-    property HairLength: single read FHairLength;
-    property Stiffness: TGLStiffnessSetVH read FStiffness write SetStiffness;
-    property Data: pointer read FData write FData;
-    // Anchor should be nailed down to give the hair stability
-    property Anchor: TGLBaseNode read GetAnchor;
-    // Root should be nailed down to give the hair stability
-    property Root: TGLBaseNode read GetRoot;
-  end;
-
-// ------------------------------------------------------------------
-implementation
-// ------------------------------------------------------------------
-
-//-----------------------------
-// TGLVerletHair
-//-----------------------------
-procedure TGLVerletHair.AddStickStiffness(const ANodeSkip: integer);
-var
-  i: integer;
-begin
-  for i := 0 to NodeList.Count - (1 + ANodeSkip * 2) do
-    FStiffnessList.Add(VerletWorld.CreateStick(NodeList[i],
-      NodeList[i + 2 * ANodeSkip]));
-end;
-
-procedure TGLVerletHair.BuildHair(const AAnchorPosition, AHairDirection
-  : TAffineVector);
-var
-  i: integer;
-  Position: TAffineVector;
-  Node, PrevNode: TGLBaseNode;
-  Direction: TAffineVector;
-begin
-  Clear;
-  Direction := VectorNormalize(AHairDirection);
-  // Fix the root of the hair
-  Position := VectorAdd(AAnchorPosition, VectorScale(Direction, -FRootDepth));
-  Node := VerletWorld.CreateOwnedNode(Position);
-  NodeList.Add(Node);
-  Node.NailedDown := true;
-  PrevNode := Node;
-  // Now add the links in the hair
-  for i := 0 to FLinkCount - 1 do
-  begin
-    Position := VectorAdd(AAnchorPosition, VectorScale(Direction,
-      HairLength * (i / LinkCount)));
-    Node := VerletWorld.CreateOwnedNode(Position);
-    NodeList.Add(Node);
-    // first one is the anchor
-    if i = 0 then
-      Node.NailedDown := true
-    else
-      // Creates the hair link
-      VerletWorld.CreateStick(PrevNode, Node);
-    PrevNode := Node;
-  end;
-  // Now we must stiffen the hair with either sticks or springs
-  BuildStiffness;
-end;
-
-procedure TGLVerletHair.BuildStiffness;
-var
-  i: integer;
-begin
-  ClearStiffness;
-  if vhsFull in FStiffness then
-  begin
-    for i := 1 to 100 do
-      AddStickStiffness(i);
-    exit;
-  end;
-  if vhsSkip1Node in FStiffness then
-    AddStickStiffness(1);
-  if vhsSkip2Node in FStiffness then
-    AddStickStiffness(2);
-  if vhsSkip3Node in FStiffness then
-    AddStickStiffness(3);
-  if vhsSkip4Node in FStiffness then
-    AddStickStiffness(4);
-  if vhsSkip5Node in FStiffness then
-    AddStickStiffness(5);
-  if vhsSkip6Node in FStiffness then
-    AddStickStiffness(6);
-  if vhsSkip7Node in FStiffness then
-    AddStickStiffness(7);
-  if vhsSkip8Node in FStiffness then
-    AddStickStiffness(8);
-  if vhsSkip9Node in FStiffness then
-    AddStickStiffness(9);
-end;
-
-procedure TGLVerletHair.Clear;
-var
-  i: integer;
-begin
-  ClearStiffness;
-  for i := FNodeList.Count - 1 downto 0 do
-    FNodeList[i].Free;
-  FNodeList.Clear;
-  FStiffnessList.Clear;
-end;
-
-procedure TGLVerletHair.ClearStiffness;
-var
-  i: integer;
-begin
-  for i := 0 to FStiffnessList.Count - 1 do
-    TGLVerletConstraint(FStiffnessList[i]).Free;
-  FStiffnessList.Clear;
-end;
-
-constructor TGLVerletHair.Create(const AVerletWorld: TGLVerletWorld;
-  const ARootDepth, AHairLength: single; ALinkCount: integer;
-  const AAnchorPosition, AHairDirection: TAffineVector;
-  const AStiffness: TGLStiffnessSetVH);
-begin
-  FVerletWorld := AVerletWorld;
-  FRootDepth := ARootDepth;
-  FLinkCount := ALinkCount;
-  FHairLength := AHairLength;
-
-  FNodeList := TGLVerletNodeList.Create;
-  FStiffness := AStiffness;
-  FStiffnessList := TList.Create;
-
-  BuildHair(AAnchorPosition, AHairDirection);
-end;
-
-destructor TGLVerletHair.Destroy;
-begin
-  Clear;
-  FreeAndNil(FNodeList);
-  FreeAndNil(FStiffnessList);
-  inherited;
-end;
-
-function TGLVerletHair.GetAnchor: TGLBaseNode;
-begin
-  result := NodeList[1];
-end;
-
-function TGLVerletHair.GetLinkLength: single;
-begin
-  if LinkCount > 0 then
-    result := HairLength / LinkCount
-  else
-    result := 0;
-end;
-
-function TGLVerletHair.GetRoot: TGLBaseNode;
-begin
-  result := NodeList[0];
-end;
-
-procedure TGLVerletHair.SetStiffness(const Value: TGLStiffnessSetVH);
-begin
-  FStiffness := Value;
-  BuildStiffness;
-end;
-
-end.

+ 0 - 257
Source/GLS.VerletSkeletonColliders.pas

@@ -1,257 +0,0 @@
-//
-// The graphics rendering engine GLScene http://glscene.org
-//
-unit GLS.VerletSkeletonColliders;
-
-(* Skeleton colliders for defining and controlling verlet constraints. *)
-
-interface
-
-uses
-  System.Classes,
-  GLS.PersistentClasses,
-  GLS.VectorGeometry,
-  GLS.VectorFileObjects,
-  GLS.VerletTypes,
-  GLS.VectorTypes;
-
-type
-  // Base Verlet Skeleton Collider class.
-  TGLVerletBase = class(TGLSkeletonCollider)
-  private
-    FVerletConstraint: TGLVerletConstraint;
-  public
-    procedure WriteToFiler(writer: TVirtualWriter); override;
-    procedure ReadFromFiler(reader: TVirtualReader); override;
-    procedure AddToVerletWorld(VerletWorld: TGLVerletWorld); virtual;
-    // The verlet constraint is created through the AddToVerletWorld procedure
-    property VerletConstraint: TGLVerletConstraint read FVerletConstraint;
-  end;
-
-  // Sphere shaped verlet constraint in a skeleton collider
-  TGLVerletSphere = class(TGLVerletBase)
-  private
-    FRadius: Single;
-  protected
-    procedure SetRadius(const val: Single);
-  public
-    constructor Create; override;
-    procedure WriteToFiler(writer: TVirtualWriter); override;
-    procedure ReadFromFiler(reader: TVirtualReader); override;
-    procedure AddToVerletWorld(VerletWorld: TGLVerletWorld); override;
-    procedure AlignCollider; override;
-    property Radius: Single read FRadius write SetRadius;
-  end;
-
-  // Capsule shaped verlet constraint in a skeleton collider
-  TGLVerletCapsule = class(TGLVerletBase)
-  private
-    FRadius, FLength: Single;
-  protected
-    procedure SetRadius(const val: Single);
-    procedure SetLength(const val: Single);
-  public
-    constructor Create; override;
-    procedure WriteToFiler(writer: TVirtualWriter); override;
-    procedure ReadFromFiler(reader: TVirtualReader); override;
-    procedure AddToVerletWorld(VerletWorld: TGLVerletWorld); override;
-    procedure AlignCollider; override;
-    property Radius: Single read FRadius write SetRadius;
-    property Length: Single read FLength write SetLength;
-  end;
-
-  (* After loading call this function to add all the constraints in a
-    skeleton collider list to a given verlet world. *)
-procedure AddSCVerletConstriantsToVerletWorld
-  (colliders: TGLSkeletonColliderList; world: TGLVerletWorld);
-
-// ------------------------------------------------------------------
-implementation
-// ------------------------------------------------------------------
-
-// ------------------
-// ------------------ Global methods ------------------
-// ------------------
-
-procedure AddSCVerletConstriantsToVerletWorld
-  (colliders: TGLSkeletonColliderList; world: TGLVerletWorld);
-var
-  i: Integer;
-begin
-  for i := 0 to colliders.Count - 1 do
-    if colliders[i] is TGLVerletBase then
-      TGLVerletBase(colliders[i]).AddToVerletWorld(world);
-end;
-
-// ------------------
-// ------------------ TGLVerletBase ------------------
-// ------------------
-
-procedure TGLVerletBase.WriteToFiler(writer: TVirtualWriter);
-begin
-  inherited WriteToFiler(writer);
-  with writer do
-  begin
-    WriteInteger(0); // Archive Version 0
-  end;
-end;
-
-procedure TGLVerletBase.ReadFromFiler(reader: TVirtualReader);
-var
-  archiveVersion: Integer;
-begin
-  inherited ReadFromFiler(reader);
-  archiveVersion := reader.ReadInteger;
-  if archiveVersion = 0 then
-    with reader do
-      // Nothing yet
-    else
-      RaiseFilerException(archiveVersion);
-end;
-
-procedure TGLVerletBase.AddToVerletWorld(VerletWorld: TGLVerletWorld);
-begin
-  AlignCollider;
-end;
-
-// ------------------
-// ------------------ TGLVerletSphere ------------------
-// ------------------
-constructor TGLVerletSphere.Create;
-begin
-  inherited;
-  Radius := 0.5;
-  AlignCollider;
-end;
-
-procedure TGLVerletSphere.WriteToFiler(writer: TVirtualWriter);
-begin
-  inherited WriteToFiler(writer);
-  with writer do
-  begin
-    WriteInteger(0); // Archive Version 0
-    WriteFloat(FRadius);
-  end;
-end;
-
-procedure TGLVerletSphere.ReadFromFiler(reader: TVirtualReader);
-var
-  archiveVersion: Integer;
-begin
-  inherited ReadFromFiler(reader);
-  archiveVersion := reader.ReadInteger;
-  if archiveVersion = 0 then
-    with reader do
-      Radius := ReadFloat
-  else
-    RaiseFilerException(archiveVersion);
-end;
-
-procedure TGLVerletSphere.AddToVerletWorld(VerletWorld: TGLVerletWorld);
-begin
-  FVerletConstraint := TVCSphere.Create(VerletWorld);
-  TVCSphere(FVerletConstraint).Radius := FRadius;
-  inherited;
-end;
-
-procedure TGLVerletSphere.AlignCollider;
-begin
-  inherited;
-  if Assigned(FVerletConstraint) then
-    TVCSphere(FVerletConstraint).Location := AffineVectorMake(GlobalMatrix.W);
-end;
-
-procedure TGLVerletSphere.SetRadius(const val: Single);
-begin
-  if val <> FRadius then
-  begin
-    FRadius := val;
-    if Assigned(FVerletConstraint) then
-      TVCSphere(FVerletConstraint).Radius := FRadius;
-  end;
-end;
-
-// ------------------
-// ------------------ TGLVerletCapsule ------------------
-// ------------------
-constructor TGLVerletCapsule.Create;
-begin
-  inherited;
-  Radius := 0.5;
-  Length := 1;
-  AlignCollider;
-end;
-
-procedure TGLVerletCapsule.WriteToFiler(writer: TVirtualWriter);
-begin
-  inherited WriteToFiler(writer);
-  with writer do
-  begin
-    WriteInteger(0); // Archive Version 0
-    WriteFloat(FRadius);
-    WriteFloat(FLength);
-  end;
-end;
-
-procedure TGLVerletCapsule.ReadFromFiler(reader: TVirtualReader);
-var
-  archiveVersion: Integer;
-begin
-  inherited ReadFromFiler(reader);
-  archiveVersion := reader.ReadInteger;
-  if archiveVersion = 0 then
-    with reader do
-    begin
-      Radius := ReadFloat;
-      Length := ReadFloat;
-    end
-  else
-    RaiseFilerException(archiveVersion);
-end;
-
-procedure TGLVerletCapsule.AddToVerletWorld(VerletWorld: TGLVerletWorld);
-begin
-  FVerletConstraint := TVCCapsule.Create(VerletWorld);
-  TVCCapsule(FVerletConstraint).Radius := FRadius;
-  TVCCapsule(FVerletConstraint).Length := FLength;
-  inherited;
-end;
-
-procedure TGLVerletCapsule.AlignCollider;
-begin
-  inherited;
-  if Assigned(FVerletConstraint) then
-  begin
-    TVCCapsule(FVerletConstraint).Location := AffineVectorMake(GlobalMatrix.W);
-    TVCCapsule(FVerletConstraint).Axis := AffineVectorMake(GlobalMatrix.Y);
-  end;
-end;
-
-procedure TGLVerletCapsule.SetRadius(const val: Single);
-begin
-  if val <> FRadius then
-  begin
-    FRadius := val;
-    if Assigned(FVerletConstraint) then
-      TVCCapsule(FVerletConstraint).Radius := FRadius;
-  end;
-end;
-
-procedure TGLVerletCapsule.SetLength(const val: Single);
-begin
-  if val <> FLength then
-  begin
-    FLength := val;
-    if Assigned(FVerletConstraint) then
-      TVCCapsule(FVerletConstraint).Length := FLength;
-  end;
-end;
-
-// ------------------------------------------------------------------
-initialization
-
-// ------------------------------------------------------------------
-
-RegisterClasses([TGLVerletBase, TGLVerletSphere, TGLVerletCapsule]);
-
-end.

File diff suppressed because it is too large
+ 247 - 148
Source/GLS.VerletTypes.pas


Some files were not shown because too many files changed in this diff