glscene 7 місяців тому
батько
коміт
37f39fc1a9

+ 2 - 2
Examples/AdvDemos/Forest/ForestD.dpr

@@ -2,12 +2,12 @@ program ForestD;
 
 uses
   Forms,
-  fForestD in 'fForestD.pas' {Form1};
+  fForestD in 'fForestD.pas' {FormForest};
 
 {$R *.res}
 
 begin
   Application.Initialize;
-  Application.CreateForm(TForm1, Form1);
+  Application.CreateForm(TFormForest, FormForest);
   Application.Run;
 end.

+ 1 - 1
Examples/AdvDemos/Forest/ForestD.dproj

@@ -127,7 +127,7 @@
             <MainSource>MainSource</MainSource>
         </DelphiCompile>
         <DCCReference Include="fForestD.pas">
-            <Form>Form1</Form>
+            <Form>FormForest</Form>
         </DCCReference>
         <BuildConfiguration Include="Base">
             <Key>Base</Key>

+ 8 - 9
Examples/AdvDemos/Forest/fForestD.dfm

@@ -1,17 +1,16 @@
-object Form1: TForm1
+object FormForest: TFormForest
   Left = 541
   Top = 166
-  BorderStyle = bsNone
-  Caption = 'Form1'
-  ClientHeight = 457
-  ClientWidth = 611
+  Caption = 'Forest'
+  ClientHeight = 418
+  ClientWidth = 595
   Color = clBtnFace
   Font.Charset = DEFAULT_CHARSET
   Font.Color = clWindowText
   Font.Height = -11
   Font.Name = 'MS Sans Serif'
   Font.Style = []
-  WindowState = wsMaximized
+  Position = poScreenCenter
   OnCreate = FormCreate
   OnDestroy = FormDestroy
   OnDeactivate = FormDeactivate
@@ -22,8 +21,8 @@ object Form1: TForm1
   object SceneViewer: TGLSceneViewer
     Left = 0
     Top = 0
-    Width = 611
-    Height = 457
+    Width = 595
+    Height = 418
     Camera = Camera
     Buffer.FogEnvironment.FogColor.Color = {9CC4403FFED4583F48E17A3F0000803F}
     Buffer.FogEnvironment.FogStart = 3500.000000000000000000
@@ -33,7 +32,7 @@ object Form1: TForm1
     Buffer.FogEnable = True
     Buffer.Lighting = False
     Buffer.AntiAliasing = aaNone
-    FieldOfView = 155.314346313476600000
+    FieldOfView = 153.091491699218800000
     PenAsTouch = False
     Align = alClient
     TabOrder = 0

+ 26 - 25
Examples/AdvDemos/Forest/fForestD.pas

@@ -19,6 +19,7 @@ uses
 
   Stage.VectorTypes,
   Stage.VectorGeometry,
+  Stage.OpenGLTokens,
   GLS.XCollection,
   GLS.VectorLists,
   GLS.PersistentClasses,
@@ -55,7 +56,7 @@ uses
   Stage.Utils;
 
 type
-  TForm1 = class(TForm)
+  TFormForest = class(TForm)
     SceneViewer: TGLSceneViewer;
     GLScene: TGLScene;
     MLTrees: TGLMaterialLibrary;
@@ -124,7 +125,7 @@ type
   end;
 
 var
-  Form1: TForm1;
+  FormForest: TFormForest;
 
 implementation // ------------------------------------------------------------
 
@@ -136,7 +137,7 @@ const
   cMapHeight: Integer = 1024;
   cBaseSpeed: Single = 50;
 
-procedure TForm1.FormCreate(Sender: TObject);
+procedure TFormForest.FormCreate(Sender: TObject);
 var
   density: TPicture;
 
@@ -226,7 +227,7 @@ end;
 
 //----------------------------------------------------------------
 
-procedure TForm1.FormDestroy(Sender: TObject);
+procedure TFormForest.FormDestroy(Sender: TObject);
 begin
   // RestoreDefaultMode;
 
@@ -234,22 +235,22 @@ begin
   nearTrees.Free;
 end;
 
-procedure TForm1.FormResize(Sender: TObject);
+procedure TFormForest.FormResize(Sender: TObject);
 begin
   Camera.FocalLength := Width * 50 / 800;
 end;
 
-procedure TForm1.FormDeactivate(Sender: TObject);
+procedure TFormForest.FormDeactivate(Sender: TObject);
 begin
   Close;
 end;
 
-procedure TForm1.FormShow(Sender: TObject);
+procedure TFormForest.FormShow(Sender: TObject);
 begin
   SetFocus;
 end;
 
-procedure TForm1.GLCadencerProgress(Sender: TObject; const deltaTime, newTime: Double);
+procedure TFormForest.GLCadencerProgress(Sender: TObject; const deltaTime, newTime: Double);
 var
   speed, z: Single;
   nmp: TPoint;
@@ -296,11 +297,11 @@ begin
   SceneViewer.Invalidate;
 end;
 
-procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
+procedure TFormForest.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
 begin
   case Key of
     VK_ESCAPE:
-      Form1.Close;
+      FormForest.Close;
     VK_ADD:
       if TreesShown < PFXTrees.Particles.ItemCount then
         TreesShown := TreesShown + 100;
@@ -318,7 +319,7 @@ begin
   end;
 end;
 
-procedure TForm1.Timer1Timer(Sender: TObject);
+procedure TFormForest.Timer1Timer(Sender: TObject);
 var
   hud: string;
 begin
@@ -337,7 +338,7 @@ begin
   Caption := Format('%.2f', [RenderTrees.LastSortTime]);
 end;
 
-procedure TForm1.PFXTreesCreateParticle(Sender: TObject; aParticle: TGLParticle);
+procedure TFormForest.PFXTreesCreateParticle(Sender: TObject; aParticle: TGLParticle);
 var
   u, v, p: Single;
   // x, y, i, j, dark : Integer;
@@ -360,13 +361,13 @@ begin
 
 end;
 
-procedure TForm1.PFXTreesBeginParticles(Sender: TObject; var rci: TGLRenderContextInfo);
+procedure TFormForest.PFXTreesBeginParticles(Sender: TObject; var rci: TGLRenderContextInfo);
 begin
   Imposter := SIBTree.ImposterFor(TestTree);
   Imposter.BeginRender(rci);
 end;
 
-procedure TForm1.PFXTreesRenderParticle(Sender: TObject; aParticle: TGLParticle;
+procedure TFormForest.PFXTreesRenderParticle(Sender: TObject; aParticle: TGLParticle;
   var rci: TGLRenderContextInfo);
 const
   cTreeCenteringOffset: TAffineVector = (X: 0; Y: 30; z: 0);
@@ -391,7 +392,7 @@ begin
   end;
 end;
 
-procedure TForm1.PFXTreesEndParticles(Sender: TObject; var rci: TGLRenderContextInfo);
+procedure TFormForest.PFXTreesEndParticles(Sender: TObject; var rci: TGLRenderContextInfo);
 var
   aParticle: TGLParticle;
   camPos: TGLVector;
@@ -409,7 +410,7 @@ begin
   Imposter.EndRender(rci);
 end;
 
-procedure TForm1.DOTreesRender(Sender: TObject; var rci: TGLRenderContextInfo);
+procedure TFormForest.DOTreesRender(Sender: TObject; var rci: TGLRenderContextInfo);
 var
   i: Integer;
   particle: TGLParticle;
@@ -436,7 +437,7 @@ begin
   nearTrees.Clear;
 end;
 
-procedure TForm1.TerrainGetTerrainBounds(var l, t, r, b: Single);
+procedure TFormForest.TerrainGetTerrainBounds(var l, t, r, b: Single);
 begin
   l := 0;
   t := cMapHeight;
@@ -444,7 +445,7 @@ begin
   b := 0;
 end;
 
-function TForm1.SIBTreeLoadingImposter(Sender: TObject; impostoredObject: TGLBaseSceneObject;
+function TFormForest.SIBTreeLoadingImposter(Sender: TObject; impostoredObject: TGLBaseSceneObject;
   destImposter: TImposter): TGLBitmap32;
 var
   bmp: TBitmap;
@@ -467,7 +468,7 @@ begin
   bmp.Free;
 end;
 
-procedure TForm1.SIBTreeImposterLoaded(Sender: TObject; impostoredObject: TGLBaseSceneObject;
+procedure TFormForest.SIBTreeImposterLoaded(Sender: TObject; impostoredObject: TGLBaseSceneObject;
   destImposter: TImposter);
 var
   bmp32: TGLBitmap32;
@@ -484,18 +485,18 @@ begin
   end;
 end;
 
-function TForm1.PFXTreesGetParticleCountEvent(Sender: TObject): Integer;
+function TFormForest.PFXTreesGetParticleCountEvent(Sender: TObject): Integer;
 begin
   Result := TreesShown;
 end;
 
-procedure TForm1.PFXTreesProgress(Sender: TObject; const progressTime: TGLProgressTimes;
+procedure TFormForest.PFXTreesProgress(Sender: TObject; const progressTime: TGLProgressTimes;
   var defaultProgress: Boolean);
 begin
   defaultProgress := False;
 end;
 
-procedure TForm1.DOInitializeReflectionRender(Sender: TObject; var rci: TGLRenderContextInfo);
+procedure TFormForest.DOInitializeReflectionRender(Sender: TObject; var rci: TGLRenderContextInfo);
 var
   w, h: Integer;
   refMat: TGLMatrix;
@@ -594,7 +595,7 @@ begin
   GL.Clear(GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT + GL_STENCIL_BUFFER_BIT);
 end;
 
-procedure TForm1.DOClassicWaterPlaneRender(Sender: TObject; var rci: TGLRenderContextInfo);
+procedure TFormForest.DOClassicWaterPlaneRender(Sender: TObject; var rci: TGLRenderContextInfo);
 const
   cWaveScale = 7;
   cWaveSpeed = 0.02;
@@ -687,7 +688,7 @@ begin
   rci.GLStates.ResetTextureMatrix;
 end;
 
-procedure TForm1.DOGLSLWaterPlaneRender(Sender: TObject; var rci: TGLRenderContextInfo);
+procedure TFormForest.DOGLSLWaterPlaneRender(Sender: TObject; var rci: TGLRenderContextInfo);
 var
   X, Y: Integer;
 begin
@@ -735,7 +736,7 @@ end;
 
 // SetupReflectionMatrix
 //
-function TForm1.GetTextureReflectionMatrix: TGLMatrix;
+function TFormForest.GetTextureReflectionMatrix: TGLMatrix;
 const
   cBaseMat: TGLMatrix = (v: ((X: 0.5; Y: 0; z: 0; w: 0), (X: 0; Y: 0.5; z: 0; w: 0), (X: 0; Y: 0;
     z: 1; w: 0), (X: 0.5; Y: 0.5; z: 0; w: 1)));

+ 46 - 91
Examples/Demos/graph/fxy/fFxyD.dfm

@@ -1,156 +1,112 @@
 object FormFxy: TFormFxy
   Left = 179
   Top = 106
-  Margins.Left = 5
-  Margins.Top = 5
-  Margins.Right = 5
-  Margins.Bottom = 5
   BorderWidth = 4
   Caption = 'Fxy'
-  ClientHeight = 716
-  ClientWidth = 933
+  ClientHeight = 512
+  ClientWidth = 607
   Color = clBtnFace
   DockSite = True
   Font.Charset = DEFAULT_CHARSET
   Font.Color = clWindowText
-  Font.Height = -19
+  Font.Height = -11
   Font.Name = 'MS Sans Serif'
   Font.Style = []
   Position = poScreenCenter
   OnMouseWheel = FormMouseWheel
-  PixelsPerInch = 168
-  TextHeight = 24
+  TextHeight = 13
   object GLSceneViewer1: TGLSceneViewer
     Left = 0
     Top = 0
-    Width = 637
-    Height = 716
-    Margins.Left = 5
-    Margins.Top = 5
-    Margins.Right = 5
-    Margins.Bottom = 5
+    Width = 437
+    Height = 512
     Camera = GLCamera1
     Buffer.BackgroundColor = clTeal
-    FieldOfView = 137.143493652343800000
+    FieldOfView = 120.453773498535200000
     PenAsTouch = False
     Align = alClient
     OnMouseDown = GLSceneViewer1MouseDown
     OnMouseMove = GLSceneViewer1MouseMove
     TabOrder = 0
+    ExplicitWidth = 360
+    ExplicitHeight = 409
   end
   object Panel1: TPanel
-    Left = 637
+    Left = 437
     Top = 0
-    Width = 296
-    Height = 716
-    Margins.Left = 5
-    Margins.Top = 5
-    Margins.Right = 5
-    Margins.Bottom = 5
+    Width = 170
+    Height = 512
     Align = alRight
     TabOrder = 1
+    ExplicitLeft = 351
+    ExplicitHeight = 384
     object Label1: TLabel
-      Left = 81
-      Top = 600
-      Width = 148
-      Height = 24
-      Margins.Left = 5
-      Margins.Top = 5
-      Margins.Right = 5
-      Margins.Bottom = 5
+      Left = 46
+      Top = 343
+      Width = 82
+      Height = 13
       Caption = 'XYZ Grid position'
     end
     object Label2: TLabel
-      Left = 39
-      Top = 121
-      Width = 14
-      Height = 24
-      Margins.Left = 5
-      Margins.Top = 5
-      Margins.Right = 5
-      Margins.Bottom = 5
+      Left = 22
+      Top = 69
+      Width = 7
+      Height = 13
       Caption = 'X'
     end
     object Label3: TLabel
-      Left = 135
-      Top = 121
-      Width = 12
-      Height = 24
-      Margins.Left = 5
-      Margins.Top = 5
-      Margins.Right = 5
-      Margins.Bottom = 5
+      Left = 77
+      Top = 69
+      Width = 7
+      Height = 13
       Caption = 'Y'
     end
     object Label4: TLabel
-      Left = 221
-      Top = 121
-      Width = 12
-      Height = 24
-      Margins.Left = 5
-      Margins.Top = 5
-      Margins.Right = 5
-      Margins.Bottom = 5
+      Left = 126
+      Top = 69
+      Width = 7
+      Height = 13
       Caption = 'Z'
     end
     object CBCentered: TCheckBox
-      Left = 84
-      Top = 44
-      Width = 170
-      Height = 30
-      Margins.Left = 5
-      Margins.Top = 5
-      Margins.Right = 5
-      Margins.Bottom = 5
+      Left = 48
+      Top = 25
+      Width = 97
+      Height = 17
       Caption = 'Centered grids'
       TabOrder = 0
       OnClick = CBCenteredClick
     end
     object TBXYPosition: TTrackBar
-      Left = 200
-      Top = 154
-      Width = 78
-      Height = 436
-      Margins.Left = 5
-      Margins.Top = 5
-      Margins.Right = 5
-      Margins.Bottom = 5
+      Left = 114
+      Top = 88
+      Width = 45
+      Height = 249
       Min = -10
       Orientation = trVertical
       TabOrder = 1
-      ThumbLength = 35
       TickMarks = tmBoth
       OnChange = TBXYPositionChange
     end
     object TBYZPosition: TTrackBar
-      Left = 21
-      Top = 154
-      Width = 79
-      Height = 436
-      Margins.Left = 5
-      Margins.Top = 5
-      Margins.Right = 5
-      Margins.Bottom = 5
+      Left = 12
+      Top = 88
+      Width = 45
+      Height = 249
       Min = -10
       Orientation = trVertical
       TabOrder = 2
-      ThumbLength = 35
       TickMarks = tmBoth
       OnChange = TBYZPositionChange
     end
     object TBXZPosition: TTrackBar
-      Left = 110
-      Top = 154
-      Width = 79
-      Height = 436
-      Margins.Left = 5
-      Margins.Top = 5
-      Margins.Right = 5
-      Margins.Bottom = 5
+      Left = 63
+      Top = 88
+      Width = 45
+      Height = 249
       Min = -10
       Orientation = trVertical
       TabOrder = 3
-      ThumbLength = 35
       TickMarks = tmBoth
       OnChange = TBXZPositionChange
     end
@@ -182,7 +138,6 @@ object FormFxy: TFormFxy
       YSamplingScale.Min = -1.000000000000000000
       YSamplingScale.Max = 1.000000000000000000
       YSamplingScale.Step = 0.009999999776482582
-      OnGetHeight = HeightField1GetHeight
       object YZGrid: TGLXYZGrid
         LineColor.Color = {0000803F00000000000000000000803F}
         XSamplingScale.Min = -1.000000000000000000

+ 2 - 3
Examples/Demos/graph/fxy/fFxyD.pas

@@ -65,9 +65,8 @@ type
 var
   FormFxy: TFormFxy;
 
-// ----------------------------------
-implementation
-// ----------------------------------
+
+implementation // ----------------------------------------------------------
 
 {$R *.DFM}
 

+ 16 - 32
Examples/Demos/physics/ClothActor/fClothActorD.dfm

@@ -1,37 +1,29 @@
 object FormClothActor: TFormClothActor
   Left = 69
   Top = 116
-  Margins.Left = 5
-  Margins.Top = 5
-  Margins.Right = 5
-  Margins.Bottom = 5
   Caption = 'Cloth Actor'
-  ClientHeight = 756
-  ClientWidth = 1096
+  ClientHeight = 432
+  ClientWidth = 626
   Color = clBtnFace
   Font.Charset = DEFAULT_CHARSET
   Font.Color = clWindowText
-  Font.Height = -19
+  Font.Height = -11
   Font.Name = 'MS Sans Serif'
   Font.Style = []
   Position = poScreenCenter
   OnCreate = FormCreate
   OnDestroy = FormDestroy
-  PixelsPerInch = 168
-  TextHeight = 24
+  TextHeight = 13
   object GLSceneViewer1: TGLSceneViewer
     Left = 0
     Top = 0
-    Width = 1096
-    Height = 756
-    Margins.Left = 5
-    Margins.Top = 5
-    Margins.Right = 5
-    Margins.Bottom = 5
+    Width = 626
+    Height = 432
     Camera = GLCamera1
+    Buffer.BackgroundColor = clTeal
     Buffer.AmbientColor.Color = {CDCCCC3ECDCCCC3ECDCCCC3E0000803F}
     Buffer.ContextOptions = [roDoubleBuffer, roStencilBuffer, roRenderToWindow, roTwoSideLighting]
-    FieldOfView = 164.929870605468800000
+    FieldOfView = 153.933288574218800000
     PenAsTouch = False
     Align = alClient
     OnMouseDown = GLSceneViewer1MouseDown
@@ -39,26 +31,18 @@ object FormClothActor: TFormClothActor
     TabOrder = 0
   end
   object cbShowOctree: TCheckBox
-    Left = 490
-    Top = 30
-    Width = 170
-    Height = 30
-    Margins.Left = 5
-    Margins.Top = 5
-    Margins.Right = 5
-    Margins.Bottom = 5
+    Left = 280
+    Top = 17
+    Width = 97
+    Height = 17
     Caption = 'Show Octree'
     TabOrder = 1
   end
   object StaticTextFPS: TStaticText
-    Left = 28
-    Top = 30
-    Width = 40
-    Height = 28
-    Margins.Left = 5
-    Margins.Top = 5
-    Margins.Right = 5
-    Margins.Bottom = 5
+    Left = 16
+    Top = 17
+    Width = 24
+    Height = 17
     Caption = 'FPS'
     TabOrder = 2
   end

+ 6 - 4
Examples/Demos/physics/OdeRagdoll/fOdeRagdollD.pas

@@ -50,8 +50,8 @@ type
     contactgroup: TdJointGroupID;
     ground_box : PdxGeom;
     ground_box2 : PdxGeom;
-    cube: TGLCube;
-    cube2: TGLCube;
+    Cube: TGLCube;
+    Cube2: TGLCube;
     ODEEnable : boolean;
     physTime : double;
     destructor Destroy; override;
@@ -87,10 +87,9 @@ type
     procedure FormKeyUp(Sender: TObject; var Key: Word;
       Shift: TShiftState);
   private
-     
     my,mx: integer;
   public
-     
+
   end;
 
 var
@@ -130,6 +129,7 @@ begin
   dGeomSetPosition (ground_box,32,5,0.5);
   dGeomSetRotation (ground_box,R);
   Cube := TGLCube(FormRagdoll.ODEScene.AddNewChild(TGLCube));
+  Cube.Material.FrontProperties.Ambient.RandomColor;
   PdxGeom(ground_box).data := Cube;
   CopyCubeSizeFromBox(Cube, ground_box);
   PositionSceneObject(TGLBaseSceneObject(PdxGeom(ground_box).data), ground_box);
@@ -139,6 +139,7 @@ begin
   dGeomSetPosition (ground_box2,-12,-5,2.5);
   dGeomSetRotation (ground_box2,R);
   Cube2 := TGLCube(FormRagdoll.ODEScene.AddNewChild(TGLCube));
+  Cube2.Material.FrontProperties.Ambient.RandomColor;
   PdxGeom(ground_box2).data := Cube2;
   CopyCubeSizeFromBox(Cube2, ground_box2);
   PositionSceneObject(TGLBaseSceneObject(PdxGeom(ground_box2).data), ground_box2);
@@ -148,6 +149,7 @@ begin
   dGeomSetPosition (ground_box2,0,-15,2.5);
   PdxGeom(ground_box2).data := TGLSphere(FormRagdoll.ODEScene.AddNewChild(TGLSphere));
   TGLSphere(PdxGeom(ground_box2).data).Radius := 5;
+  TGLSphere(PdxGeom(ground_box2).data).Material.FrontProperties.Ambient.RandomColor;
   PositionSceneObject(TGLSphere(PdxGeom(ground_box2).data), ground_box2);
 end;
 

BIN
Help/Screenshots/RagDoll.gif


+ 1 - 1
README.md

@@ -15,7 +15,7 @@ GLS Viewer
 Dune Fighter
 ![DuneFighter](./Help/Screenshots/DuneFighter.png)
 Clothify 
-![Clothify](./Help/Screenshots/Clothify.png)
+![Clothify](./Help/Screenshots/RagDoll.gif)
 Christmas
 ![Christmas](./Help/Screenshots/Christmas.png)
 Forest