MathgeomGLS
104 строки · 2.0 Кб
1unit fGems;
2
3interface
4
5uses
6Winapi.Windows,
7Winapi.Messages,
8System.SysUtils,
9System.Variants,
10System.Classes,
11Vcl.Graphics,
12Vcl.Controls,
13Vcl.Forms,
14Vcl.Dialogs,
15GLS.SceneViewer,
16GLS.BaseClasses,
17GLS.Scene,
18GLS.Coordinates,
19GLS.Objects,
20GLS.Cadencer,
21GLS.SimpleNavigation,
22GLS.Graph,
23GLS.GeomObjects;
24
25type
26TForm1 = class(TForm)
27GLSceneViewer1: TGLSceneViewer;
28GLSimpleNavigation1: TGLSimpleNavigation;
29GLCadencer1: TGLCadencer;
30GLScene1: TGLScene;
31GLLightSource1: TGLLightSource;
32GLCamera1: TGLCamera;
33GLDummyCube1: TGLDummyCube;
34procedure FormCreate(Sender: TObject);
35private
36
37Superellipsoids: array [0 .. 5, 0 .. 5] of TGLSuperellipsoid;
38protected
39public
40
41end;
42
43var
44Form1: TForm1;
45
46implementation
47
48{$R *.dfm}
49
50uses
51GLS.VectorGeometry;
52
53procedure TForm1.FormCreate(Sender: TObject);
54var
55i, j: integer;
56x, y, d: single;
57
58begin
59d := 6;
60Randomize;
61for j := 0 to 5 do
62for i := 0 to 5 do
63begin
64x := -d * 2.5 + d * i;
65y := d * 2.5 - d * j;
66Superellipsoids[i, j] := TGLSuperellipsoid
67(GLScene1.Objects.AddNewChild(TGLSuperellipsoid));
68
69with Superellipsoids[i, j] do
70begin
71Slices := 32;
72Stacks := 32;
73Scale.SetVector(5, 5, 5);
74Position.SetPoint(x, y, 0);
75Direction.SetVector(0, 1, 0);
76Up.SetVector(0, 0, 1);
77case i of
780: VCurve := 0.2;
791: VCurve := 0.8;
802: VCurve := 1.0;
813: VCurve := 1.5;
824: VCurve := 2.0;
835: VCurve := 3.0;
84end;
85case j of
860: HCurve := 0.2;
871: HCurve := 0.8;
882: HCurve := 1.0;
893: HCurve := 1.5;
904: HCurve := 2.0;
915: HCurve := 3.0;
92end;
93with Material.FrontProperties do
94begin
95Ambient.RandomColor;
96Diffuse.RandomColor;
97Specular.RandomColor;
98Shininess := 125;
99end;
100end;
101end;
102end;
103
104end.
105