MathgeomGLS

Форк
0
104 строки · 2.0 Кб
1
unit fGems;
2

3
interface
4

5
uses
6
  Winapi.Windows,
7
  Winapi.Messages,
8
  System.SysUtils,
9
  System.Variants,
10
  System.Classes,
11
  Vcl.Graphics,
12
  Vcl.Controls,
13
  Vcl.Forms,
14
  Vcl.Dialogs,
15
  GLS.SceneViewer,
16
  GLS.BaseClasses,
17
  GLS.Scene,
18
  GLS.Coordinates,
19
  GLS.Objects,
20
  GLS.Cadencer,
21
  GLS.SimpleNavigation,
22
  GLS.Graph,
23
  GLS.GeomObjects;
24

25
type
26
  TForm1 = class(TForm)
27
    GLSceneViewer1: TGLSceneViewer;
28
    GLSimpleNavigation1: TGLSimpleNavigation;
29
    GLCadencer1: TGLCadencer;
30
    GLScene1: TGLScene;
31
    GLLightSource1: TGLLightSource;
32
    GLCamera1: TGLCamera;
33
    GLDummyCube1: TGLDummyCube;
34
    procedure FormCreate(Sender: TObject);
35
  private
36

37
    Superellipsoids: array [0 .. 5, 0 .. 5] of TGLSuperellipsoid;
38
  protected
39
  public
40

41
  end;
42

43
var
44
  Form1: TForm1;
45

46
implementation
47

48
{$R *.dfm}
49

50
uses
51
  GLS.VectorGeometry;
52

53
procedure TForm1.FormCreate(Sender: TObject);
54
var
55
  i, j: integer;
56
  x, y, d: single;
57

58
begin
59
  d := 6;
60
  Randomize;
61
  for j := 0 to 5 do
62
    for i := 0 to 5 do
63
    begin
64
      x := -d * 2.5 + d * i;
65
      y := d * 2.5 - d * j;
66
      Superellipsoids[i, j] := TGLSuperellipsoid
67
        (GLScene1.Objects.AddNewChild(TGLSuperellipsoid));
68

69
      with Superellipsoids[i, j] do
70
      begin
71
        Slices := 32;
72
        Stacks := 32;
73
        Scale.SetVector(5, 5, 5);
74
        Position.SetPoint(x, y, 0);
75
        Direction.SetVector(0, 1, 0);
76
        Up.SetVector(0, 0, 1);
77
        case i of
78
          0: VCurve := 0.2;
79
          1: VCurve := 0.8;
80
          2: VCurve := 1.0;
81
          3: VCurve := 1.5;
82
          4: VCurve := 2.0;
83
          5: VCurve := 3.0;
84
        end;
85
        case j of
86
          0: HCurve := 0.2;
87
          1: HCurve := 0.8;
88
          2: HCurve := 1.0;
89
          3: HCurve := 1.5;
90
          4: HCurve := 2.0;
91
          5: HCurve := 3.0;
92
        end;
93
        with Material.FrontProperties do
94
        begin
95
          Ambient.RandomColor;
96
          Diffuse.RandomColor;
97
          Specular.RandomColor;
98
          Shininess := 125;
99
        end;
100
      end;
101
    end;
102
end;
103

104
end.
105

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.