MathgeomGLS

Форк
0
/
fSuperEllips.pas 
726 строк · 20.5 Кб
1
unit fSuperEllips;
2

3
// Made to understand some properties of TGLSuperellipsoid
4
// Code below was based on a code by Eric Hardinge with some modifications
5
// made by Sergio Feitoza
6

7
interface
8

9
uses
10
  Winapi.Windows,
11
  Winapi.Messages,
12
  System.Actions,
13
  System.SysUtils,
14
  System.Math,
15
  System.ImageList,
16
  System.Classes,
17
  Vcl.Graphics,
18
  Vcl.Forms,
19
  Vcl.Controls,
20
  Vcl.Menus,
21
  Vcl.StdCtrls,
22
  Vcl.Dialogs,
23
  Vcl.Buttons,
24
  Vcl.ExtCtrls,
25
  Vcl.ComCtrls,
26
  Vcl.StdActns,
27
  Vcl.ActnList,
28
  Vcl.ToolWin,
29
  ButtonGroup,
30
  Vcl.ImgList,
31

32
  GLS.OpenGLTokens,
33
  GLS.BitmapFont,
34
  GLS.WindowsFont,
35
  GLS.HUDObjects,
36
  GLS.Objects,
37
  GLS.Scene,
38
  GLS.Graph,
39
  GLS.GeomObjects,
40
  GLS.Coordinates,
41
  GLS.BaseClasses,
42
  GLS.SceneViewer,
43
  GLS.Color,
44
  Vcl.Imaging.Jpeg,
45
  GLS.Material,
46
  GLS.Texture,
47
  GLS.Context,
48
  GLS.VectorTypes,
49
  GLS.VectorTypesExt,
50
  GLS.VectorGeometry,
51
  GLS.VectorLists;
52

53
type
54
  TFormEllips = class(TForm)
55
    MainMenu1: TMainMenu;
56
    File1: TMenuItem;
57
    FileNewItem: TMenuItem;
58
    FileOpenItem: TMenuItem;
59
    FileCloseItem: TMenuItem;
60
    Window1: TMenuItem;
61
    Help1: TMenuItem;
62
    N1: TMenuItem;
63
    FileExitItem: TMenuItem;
64
    WindowCascadeItem: TMenuItem;
65
    WindowTileItem: TMenuItem;
66
    WindowArrangeItem: TMenuItem;
67
    HelpAboutItem: TMenuItem;
68
    OpenDialog: TOpenDialog;
69
    FileSaveItem: TMenuItem;
70
    FileSaveAsItem: TMenuItem;
71
    Edit1: TMenuItem;
72
    CutItem: TMenuItem;
73
    CopyItem: TMenuItem;
74
    PasteItem: TMenuItem;
75
    WindowMinimizeItem: TMenuItem;
76
    ActionList1: TActionList;
77
    EditCut1: TEditCut;
78
    EditCopy1: TEditCopy;
79
    EditPaste1: TEditPaste;
80
    FileNew1: TAction;
81
    FileSave1: TAction;
82
    FileExit1: TAction;
83
    FileOpen1: TAction;
84
    FileSaveAs1: TAction;
85
    WindowCascade1: TWindowCascade;
86
    WindowTileHorizontal1: TWindowTileHorizontal;
87
    WindowArrangeAll1: TWindowArrange;
88
    WindowMinimizeAll1: TWindowMinimizeAll;
89
    HelpAbout1: TAction;
90
    FileClose1: TWindowClose;
91
    WindowTileVertical1: TWindowTileVertical;
92
    WindowTileItem2: TMenuItem;
93
    ToolBar2: TToolBar;
94
    ToolButton1: TToolButton;
95
    ToolButton2: TToolButton;
96
    ToolButton3: TToolButton;
97
    ToolButton4: TToolButton;
98
    ToolButton5: TToolButton;
99
    ToolButton6: TToolButton;
100
    ToolButton9: TToolButton;
101
    ToolButton7: TToolButton;
102
    ToolButton8: TToolButton;
103
    ToolButton10: TToolButton;
104
    ToolButton11: TToolButton;
105
    ImageList1: TImageList;
106
    GLScene1: TGLScene;
107
    CameraCube: TGLDummyCube;
108
    Camera: TGLCamera;
109
    GLLightSource1: TGLLightSource;
110
    ObjectsCube: TGLDummyCube;
111
    ArrowZ: TGLArrowLine;
112
    ArrowY: TGLArrowLine;
113
    ArrowX: TGLArrowLine;
114
    GLXYZGridXZ: TGLXYZGrid;
115
    CubeL0L1L2: TGLCube;
116
    GLRenderPoint1: TGLRenderPoint;
117
    GLHUDText1: TGLHUDText;
118
    GLWindowsBitmapFont1: TGLWindowsBitmapFont;
119
    Panel1: TPanel;
120
    Label1: TLabel;
121
    Label2: TLabel;
122
    Label3: TLabel;
123
    Label4: TLabel;
124
    Label6: TLabel;
125
    Label5: TLabel;
126
    Label8: TLabel;
127
    Label14: TLabel;
128
    Label13: TLabel;
129
    Label11: TLabel;
130
    Label19: TLabel;
131
    Label20: TLabel;
132
    Label21: TLabel;
133
    Label15: TLabel;
134
    Label16: TLabel;
135
    Label18: TLabel;
136
    Label22: TLabel;
137
    xRadiusTrackBar: TTrackBar;
138
    yRadiusTrackBar: TTrackBar;
139
    zRadiusTrackBar: TTrackBar;
140
    VCurveTrackBar: TTrackBar;
141
    HCurveTrackBar: TTrackBar;
142
    SlicesTrackBar: TTrackBar;
143
    StacksTrackBar: TTrackBar;
144
    xPositionTrackBar: TTrackBar;
145
    yPositionTrackBar: TTrackBar;
146
    zPositionTrackBar: TTrackBar;
147
    xdirectiontrackbar: TTrackBar;
148
    ydirectiontrackbar: TTrackBar;
149
    zdirectiontrackbar: TTrackBar;
150
    L0trackbar: TTrackBar;
151
    L1trackbar: TTrackBar;
152
    L2trackbar: TTrackBar;
153
    R1trackbar: TTrackBar;
154
    Reset: TButton;
155
    GLSceneViewer1: TGLSceneViewer;
156
    Label7: TLabel;
157
    Label9: TLabel;
158
    Label10: TLabel;
159
    Label12: TLabel;
160
    BottomTrackBar: TTrackBar;
161
    TopTrackBar: TTrackBar;
162
    StartTrackBar: TTrackBar;
163
    StopTrackBar: TTrackBar;
164
    ArrowsCheckBox: TCheckBox;
165
    GridCheckBox: TCheckBox;
166
    BottomCapRadioGroup: TRadioGroup;
167
    TopCapRadioGroup: TRadioGroup;
168
    Cube_Map: TButton;
169
    HCheckBox: TCheckBox;
170
    VCheckBox: TCheckBox;
171
    StatusBar: TStatusBar;
172
    Test: TButton;
173
    RGdimensionsMultiplier: TRadioGroup;
174
    GLSuperellipsoid1: TGLSuperellipsoid;
175
    GLSuperellipsoid2: TGLSuperellipsoid;
176
    procedure FileNew1Execute(Sender: TObject);
177
    procedure FileOpen1Execute(Sender: TObject);
178
    procedure HelpAbout1Execute(Sender: TObject);
179
    procedure FileExit1Execute(Sender: TObject);
180
    procedure ArrowsCheckBoxClick(Sender: TObject);
181
    procedure FormCreate(Sender: TObject);
182
    procedure FormShow(Sender: TObject);
183
    procedure ShowCameraLocation;
184
    procedure ShowFocalLength;
185
    procedure ShowDisplacement;
186
    procedure ShowSuperellipsoid;
187
    procedure GLSceneViewer1MouseDown(Sender: TObject; Button: TMouseButton;
188
      Shift: TShiftState; X, Y: Integer);
189
    procedure GLSceneViewer1MouseMove(Sender: TObject; Shift: TShiftState; X,
190
      Y: Integer);
191
    procedure GLSceneViewer1MouseUp(Sender: TObject; Button: TMouseButton;
192
      Shift: TShiftState; X, Y: Integer);
193
    procedure GridCheckBoxClick(Sender: TObject);
194
    procedure xdirectiontrackbarChange(Sender: TObject);
195
    procedure xRadiusTrackBarChange(Sender: TObject);
196
    procedure ydirectiontrackbarChange(Sender: TObject);
197
    procedure yPositionTrackBarChange(Sender: TObject);
198
    procedure yRadiusTrackBarChange(Sender: TObject);
199
    procedure zdirectiontrackbarChange(Sender: TObject);
200
    procedure zPositionTrackBarChange(Sender: TObject);
201
    procedure zRadiusTrackBarChange(Sender: TObject);
202
    procedure L0trackbarChange(Sender: TObject);
203
    procedure L1trackbarChange(Sender: TObject);
204
    procedure L2trackbarChange(Sender: TObject);
205
    procedure SlicesTrackBarChange(Sender: TObject);
206
    procedure StacksTrackBarChange(Sender: TObject);
207
    procedure StartTrackBarChange(Sender: TObject);
208
    procedure TopTrackBarChange(Sender: TObject);
209
    procedure TopCapRadioGroupClick(Sender: TObject);
210
    procedure StopTrackBarChange(Sender: TObject);
211
    procedure BottomCapRadioGroupClick(Sender: TObject);
212
    procedure BottomTrackBarChange(Sender: TObject);
213
    procedure TestClick(Sender: TObject);
214
    procedure ResetClick(Sender: TObject);
215
    procedure R1trackbarChange(Sender: TObject);
216
    procedure VCurveTrackBarChange(Sender: TObject);
217
    procedure HCurveTrackBarChange(Sender: TObject);
218

219
  private
220
     
221
    procedure CreateMDIChild(const Name: string);
222
  public
223
     
224
  end;
225

226
var
227
  FormEllips: TFormEllips;
228

229

230
implementation
231

232
{$R *.dfm}
233

234
uses
235
  CHILDWIN, About;
236

237
const
238
  crLightxz  = 1;        crLightyz  = 2;          crLightxy  = 3;
239
  crSlidexy  = 4;         crSlideyz  = 5;         crSlidexz  = 6;
240
  crRotate   = 7;         crZoom     = 8;        crHandMove = 9;
241
  spheredensity =1000;    Surf_Bounce=1.5;
242
  NXmax= 16;    NYmax =  11 ;  NZmax = 11 ;
243

244
var
245
  L0,L1, L2,R1: double;
246
  EllipsDir: TGLVector;
247
  MousePoint: TPoint;
248

249
procedure TFormEllips.CreateMDIChild(const Name: string);
250
var
251
  Child: TMDIChild;
252
begin
253
  { create a new MDI child window }
254
  Child := TMDIChild.Create(Application);
255
  Child.Caption := Name;
256
  if FileExists(Name) then Child.Memo1.Lines.LoadFromFile(Name);
257
end;
258

259
procedure TFormEllips.FileNew1Execute(Sender: TObject);
260
begin
261
  CreateMDIChild('NONAME' + IntToStr(MDIChildCount + 1));
262
end;
263

264
procedure TFormEllips.FileOpen1Execute(Sender: TObject);
265
begin
266
  if OpenDialog.Execute then
267
    CreateMDIChild(OpenDialog.FileName);
268
end;
269

270
procedure TFormEllips.FormCreate(Sender: TObject);
271
begin
272
Screen.Cursors[crSlidexy] := LoadCursor(HInstance, 'SLIDEXY');
273
  Screen.Cursors[crRotate]  := LoadCursor(HInstance, 'ROTATE');
274
  Screen.Cursors[crZoom]    := LoadCursor(HInstance, 'ZOOM');
275

276
  Randomize;
277
    {
278
  Superellipsoid := TGLSuperellipsoid(GLScene1.Objects.AddNewChild(TGLSuperellipsoid));
279
  Superellipsoid.name:='SuperEllis';
280
  Superellipsoid.Direction.SetVector(0, 0, 1);
281
  Superellipsoid.Up.SetVector(0, 1, 0);
282
  Superellipsoid.Position.SetPoint(0, 1, 0);
283
  Superellipsoid.Material.FrontProperties.Emission.Color:=clrYellow   ;
284
  Superellipsoid.Material.FrontProperties.diffuse.alpha:=0.4 ;
285
  Superellipsoid.Material.PolygonMode:= pmlines; //pmFill;   pmlines  pmpoints
286
    }
287

288
end;
289

290
procedure TFormEllips.FormShow(Sender: TObject);
291
var    I,J,K,SphereNumber:integer;
292
       deltaX,deltaY,deltaZ:real;
293
        ptPos:TGLVector;
294

295
begin
296
  TestClick(self);
297
  ShowCameraLocation;
298
{ focallength: right mouse drag up/down }
299
  ShowFocalLength;
300
{ displace origin: x axis: ctrl/left mouse drag left/right
301
                   y axis: ctrl/left mouse drag up/down }
302
  ShowDisplacement;
303
{ move light: x axis: ctrl right mouse drag left/right
304
              y axis: ctrl right mouse drag up/down
305
              z axis: shift right mouse drag up/down }
306

307
  ShowSuperellipsoid;
308

309
end;
310

311
procedure TFormEllips.HelpAbout1Execute(Sender: TObject);
312
begin
313
  AboutBox.ShowModal;
314
end;
315

316

317
procedure TFormEllips.FileExit1Execute(Sender: TObject);
318
begin
319
  Close;
320
end;
321

322
procedure TFormEllips.ArrowsCheckBoxClick(Sender: TObject);
323
begin
324
  ArrowX.Visible := not ArrowsCheckBox.Checked;
325
  ArrowY.Visible := ArrowX.Visible;
326
  ArrowZ.Visible := ArrowX.Visible;
327
end;
328

329
procedure TFormEllips.GLSceneViewer1MouseDown(Sender: TObject;
330
          Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
331

332
begin
333
  MousePoint.X := X;
334
  MousePoint.Y := Y;
335
  if ssShift in Shift then
336
  begin
337
    if ssLeft in Shift then Screen.Cursor := crZoom
338
    else
339
    if ssRight in Shift then Screen.Cursor := crLightxz;
340
  end
341
  else if ssCtrl in Shift then
342
  begin
343
    if ssLeft in Shift then Screen.Cursor := crSlidexy
344
    else
345
    if ssRight in Shift then Screen.Cursor := crLightxy;
346
  end
347
  else { no shift or ctrl key }
348
  begin
349
    if Shift = [ssLeft] then Screen.Cursor := crRotate
350
    else
351
    if Shift = [ssRight] then Screen.Cursor := crZoom;
352
  end;
353
end;
354

355
procedure TFormEllips.GLSceneViewer1MouseMove(Sender: TObject; Shift: TShiftState;
356
  X, Y: Integer);
357
var
358
  dx, dy: integer;
359
  nx, nz, d: TGLFloat;
360

361
begin  // refer GLScene\Demos\interface\camera\Camera.dpr
362
  dx := MousePoint.X - X;
363
  dy := MousePoint.Y - Y;
364
  if ssShift in Shift then  // shift key down
365
  begin
366
    if ssLeft in Shift then  // left mouse button
367
    begin
368
  { dy = a step which adjusts target distance by 1.25%; zoom in or out }
369
      with Camera do	AdjustDistanceToTarget(Power(1.0125, dy));
370
      ShowCameraLocation;
371
    end
372
  end
373
  else if ssCtrl in Shift then  { Ctrl key down }
374
  begin
375
    if ssLeft in Shift then  { left mouse button }
376
    begin
377
      nz := Camera.Position.Z*dy;
378
      nx := Camera.Position.Z*dx;
379
      d := 5*Camera.FocalLength;
380
      with CameraCube.Position do
381
      begin
382
        Z := Z - nz/d;
383
        X := X - nx/d;
384
      end;
385
      ShowDisplacement;
386
    end
387
  end
388
  else  { no shift key }
389
  begin
390
    if Shift = [ssLeft] then
391
  { Left mouse button changes camera angle by moving around target }
392
    begin
393
      Camera.MoveAroundTarget(dy, dx);
394
      ShowCameraLocation;
395
    end;
396
    if Shift = [ssRight] then
397
    begin
398
  { Right mouse button alters the camera's focal length;
399
    zoom out or in by moving cursor up or down }
400
      with Camera do
401
      begin
402
        FocalLength  := FocalLength - dy;
403
        if FocalLength > 1000 then FocalLength := 1000;   { max focal length }
404
        if FocalLength < 20 then FocalLength := 20;       { min focal length }
405
      end;
406
      ShowFocalLength;  { display in statusbar palel }
407
    end;
408
  end;
409
  MousePoint.X := X;  { update mouse position }
410
  MousePoint.Y := Y;
411
end;
412

413
procedure TFormEllips.GLSceneViewer1MouseUp(Sender: TObject; Button: TMouseButton;
414
  Shift: TShiftState; X, Y: Integer);
415
begin
416
  Screen.Cursor := crDefault;
417
end;
418

419
procedure TFormEllips.GridCheckBoxClick(Sender: TObject);
420
begin
421
  GlXYZGridXZ.Visible := not GridCheckBox.Checked;
422
end;
423

424
procedure TFormEllips.xdirectiontrackbarChange(Sender: TObject);
425
begin
426
  ShowSuperellipsoid;
427
end;
428

429
procedure TFormEllips.xRadiusTrackBarChange(Sender: TObject);
430
begin
431
  ShowSuperellipsoid;
432
end;
433

434
procedure TFormEllips.ydirectiontrackbarChange(Sender: TObject);
435
begin
436
  ShowSuperellipsoid;
437
end;
438

439
procedure TFormEllips.yPositionTrackBarChange(Sender: TObject);
440
begin
441
   ShowSuperellipsoid;
442
end;
443

444
procedure TFormEllips.yRadiusTrackBarChange(Sender: TObject);
445
begin
446
  ShowSuperellipsoid;
447
end;
448

449
procedure TFormEllips.zdirectiontrackbarChange(Sender: TObject);
450
begin
451
   ShowSuperellipsoid;
452
end;
453

454
procedure TFormEllips.zPositionTrackBarChange(Sender: TObject);
455
begin
456
   ShowSuperellipsoid;
457
end;
458
procedure TFormEllips.zRadiusTrackBarChange(Sender: TObject);
459
begin
460
   ShowSuperellipsoid;
461
end;
462

463
procedure TFormEllips.L0trackbarChange(Sender: TObject);
464
begin
465
    ShowSuperellipsoid;
466
end;
467

468
procedure TFormEllips.L1trackbarChange(Sender: TObject);
469
begin
470
    ShowSuperellipsoid;
471
end;
472

473

474
procedure TFormEllips.L2trackbarChange(Sender: TObject);
475
begin
476
   ShowSuperellipsoid;
477
end;
478

479
procedure TFormEllips.ShowCameraLocation;
480
begin
481
  with Camera.Position do
482
  StatusBar.Panels[0].Text := 'Camera: '+FloatToStrF(X, ffNumber, 5, 2)+', '+
483
  FloatToStrF(Y, ffNumber, 5, 2)+', '+FloatToStrF(Z, ffNumber, 5, 2);
484
end;
485

486
procedure TFormEllips.ShowFocalLength;
487
begin
488
  with Camera do
489
  StatusBar.Panels[1].Text := 'f = '+FloatToStrF(FocalLength, ffnumber, 5, 2);
490
end;
491

492
procedure TFormEllips.ShowDisplacement;
493
begin
494
  with CameraCube.Position do
495
  StatusBar.Panels[2].Text := 'Displaced: '+
496
  FloatToStrF(-X, ffNumber, 5, 2)+', '+FloatToStrF(-Y, ffNumber, 5, 2);
497
end;
498

499
procedure TFormEllips.ShowSuperellipsoid;
500

501
var     multip: double;
502

503
begin
504
 case RGdimensionsMultiplier.ItemIndex of
505
    0: multip:=0.1;
506
    1: multip:=1;
507
    2: multip:=10;
508
  end;
509
//Superellipsoid.NormalDirection := ndInside;
510
//Superellipsoid.Normals :=
511
{ Determines how and if normals are smoothed.   
512
    - nsFlat : facetted look   
513
    - nsSmooth : smooth look   
514
    - nsNone : unlighted rendering, usefull for decla texturing }
515
  GLSuperellipsoid1.Scale.SetVector(multip*(xRadiusTrackBar.Position-1),
516
                                 multip*(yRadiusTrackBar.Position-1),
517
                                 multip*(zRadiusTrackBar.Position-1));
518

519
  GLSuperellipsoid1.Position.SetPoint(multip*(xPositionTrackBar.Position-1),
520
                                    multip*(yPositionTrackBar.Position-1),
521
                                    multip*(zPositionTrackBar.Position-1));
522

523
  EllipsDir:= VectorMake(multip*(xDirectionTrackBar.Position-1),
524
                                     multip*(yDirectionTrackBar.Position-1),
525
                                     multip*(zDirectionTrackBar.Position-1));
526
  GLSuperellipsoid1.Direction.SetVector(multip*(xDirectionTrackBar.Position-1),
527
                                     multip*(yDirectionTrackBar.Position-1),
528
                                     multip*(zDirectionTrackBar.Position-1));
529

530
  L0:=   multip*(L0TrackBar.Position-1)  ;
531
  L1:=   multip*(L1TrackBar.Position-1)  ;
532
  L2:=   multip*(L2TrackBar.Position-1)  ;
533
  R1:=   multip*(R1TrackBar.Position-1)  ;
534

535
  GLSuperellipsoid1.Slices := SlicesTrackBar.Position;
536
  GLSuperellipsoid1.Stacks := StacksTrackBar.Position;
537
  GLSuperellipsoid1.Top := TopTrackBar.Position;
538

539
  case TopCapRadioGroup.ItemIndex of
540
  0:GLSuperellipsoid1.TopCap := ctNone;
541
  1:GLSuperellipsoid1.TopCap := ctCenter;
542
  2:GLSuperellipsoid1.TopCap := ctFlat;
543
  end;
544

545
//  GLSuperellipsoid1.Bottom := -BottomTrackBar.Position;
546

547
  case BottomCapRadioGroup.ItemIndex of
548
  0:GLSuperellipsoid1.BottomCap := ctNone;
549
  1:GLSuperellipsoid1.BottomCap := ctCenter;
550
  2:GLSuperellipsoid1.BottomCap := ctFlat;
551
  end;
552

553
  if (StartTrackBar.Position <= StopTrackBar.Position) and
554
     (StartTrackBar.Position < 360) then
555
  begin
556
    GLSuperellipsoid1.Start := StartTrackBar.Position;
557
    GLSuperellipsoid1.Stop := StopTrackBar.Position;
558
  end;
559
 // Superellipsoid.VCheck := VCheckBox.Checked;
560
//  Superellipsoid.HCheck := HCheckBox.Checked;
561
//Superellipsoid.Normals := nsNone;
562
  GLHudText1.Text := 'Axis dimensions x_A  y_B  z_C :'+
563

564
               FloatToStrF(multip*(xRadiusTrackBar.Position-1), ffNumber, 6, 2)+', '+
565
               FloatToStrF(multip*(yRadiusTrackBar.Position-1), ffNumber, 6, 2)+', '+
566
               FloatToStrF(multip*(ZRadiusTrackBar.Position-1), ffNumber, 6, 2)+', '+
567
               #13#10'Position:'+
568
               FloatToStrF(multip*(xPositionTrackBar.Position-1), ffNumber, 6, 2)+', '+
569
               FloatToStrF(multip*(yPositionTrackBar.Position-1), ffNumber, 6, 2)+', '+
570
               FloatToStrF(multip*(zPositionTrackBar.Position-1), ffNumber, 6, 2)+
571
               #13#10'Direction:'+
572
               FloatToStrF(multip*(xDirectionTrackBar.Position-1), ffNumber, 6, 2)+', '+
573
               FloatToStrF(multip*(yDirectionTrackBar.Position-1), ffNumber, 6, 2)+', '+
574
               FloatToStrF(multip*(zDirectionTrackBar.Position-1), ffNumber, 6, 2)+
575
               #13#10'Box x_L0  y_L1   z_L2   R1 :'+
576
               FloatToStrF(L0, ffNumber, 6, 2)+', '+
577
               FloatToStrF(L1, ffNumber, 6, 2)+', '+
578
               FloatToStrF(L2, ffNumber, 6, 2)+', '+
579
               FloatToStrF(R1, ffNumber, 6, 2)+
580
               #13#10'VCurve:'+
581
                  FloatToStrF(VCurveTrackBar.Position/10, ffNumber, 6, 2)+
582
               #13#10'HCurve:'+
583
                  FloatToStrF(HCurveTrackBar.Position/10, ffNumber, 6, 2)+
584
               #13#10'Slices:'+
585
                  IntToStr(SlicesTrackBar.Position)+
586
               #13#10'Stacks:'+
587
                  IntToStr(StacksTrackBar.Position)+
588
               #13#10'Top:'+
589
                  IntToStr(TopTrackBar.Position)+'�'+
590
     //          #13#10'Bottom:'+
591
     //             IntToStr(BottomTrackBar.Position)+'�'+
592
               #13#10'Start:'+
593
                  IntToStr(StartTrackBar.Position)+'�'+
594
               #13#10'Stop:'+
595
                  IntToStr(StopTrackBar.Position)+'�'   ;
596
     GLSuperellipsoid1.StructureChanged ;
597
end;
598

599
procedure TFormEllips.SlicesTrackBarChange(Sender: TObject);
600
begin
601
  ShowSuperellipsoid;
602
end;
603

604
procedure TFormEllips.StacksTrackBarChange(Sender: TObject);
605
begin
606
  ShowSuperellipsoid;
607
end;
608

609
procedure TFormEllips.StartTrackBarChange(Sender: TObject);
610
begin
611
  if (StartTrackBar.Position >= StopTrackBar.Position)
612
  then StartTrackBar.Position := StopTrackBar.Position;
613
  ShowSuperellipsoid;
614
end;
615

616

617
procedure TFormEllips.TopCapRadioGroupClick(Sender: TObject);
618
begin
619
  ShowSuperellipsoid;
620
end;
621

622
procedure TFormEllips.TopTrackBarChange(Sender: TObject);
623
begin
624
  ShowSuperellipsoid;
625
end;
626

627
procedure TFormEllips.StopTrackBarChange(Sender: TObject);
628
begin
629
  if (StopTrackBar.Position <= StartTrackBar.Position)
630
  then StopTrackBar.Position := StartTrackBar.Position;
631
  ShowSuperellipsoid;
632
end;
633

634
procedure TFormEllips.BottomCapRadioGroupClick(Sender: TObject);
635
begin
636
  ShowSuperellipsoid;
637
end;
638

639
procedure TFormEllips.BottomTrackBarChange(Sender: TObject);
640
begin
641
  ShowSuperellipsoid;
642
end;
643

644
procedure TFormEllips.TestClick(Sender: TObject);
645
begin
646
//  SetCurrentDir(AssetPath);
647

648
  with GLSuperellipsoid1.Material.Texture do
649
  begin
650
    // We need a CubeMapImage, which unlike the "regular Images" stores
651
    // multiple images.
652
    ImageClassName := TGLCubeMapImage.ClassName;
653
    with Image as TGLCubeMapImage do
654
    begin
655
      // Load all 6 texture map components of the cube map
656
      // The 'PX', 'NX', etc. refer to 'positive X', 'negative X', etc.
657
      // and follow the RenderMan specs/conventions
658
      Picture[cmtPX].LoadFromFile('cm_left.png');
659
      Picture[cmtNX].LoadFromFile('cm_right.png');
660
      Picture[cmtPY].LoadFromFile('cm_top.png');
661
      Picture[cmtNY].LoadFromFile('cm_bottom.png');
662
      Picture[cmtPZ].LoadFromFile('cm_back.png');
663
      Picture[cmtNZ].LoadFromFile('cm_front.png');
664
    end;
665
    // Select reflection cube map environment mapping
666
    // This is the mode you'll most commonly use with cube maps, normal cube
667
    // map generation is also supported (used for diffuse environment lighting)
668
    MappingMode := tmmCubeMapReflection;
669
    // That's all folks, let us see the thing!
670
    Disabled := False;
671
  end;
672
  Cube_Map.Visible := False;
673
end;
674
  {
675
procedure TMainForm.checkclick(Sender: TObject);
676
begin
677
  ShowSuperellipsoid;
678
end;
679

680
procedure TMainForm.RadiusTrackBarChange(Sender: TObject);
681
begin
682
  ShowSuperellipsoid;
683
end;
684
    }
685

686
procedure TFormEllips.ResetClick(Sender: TObject);
687
var I,J,K:integer;
688
begin
689
   GLSuperellipsoid1.free;
690

691
  GLsceneViewer1.ResetPerformanceMonitor;
692
  FormEllips.Close;
693
   FormCreate(self) ;
694
   FormShow (self);
695
  GLSuperellipsoid1.StructureChanged ;
696
 GLsceneViewer1.Update;
697

698
end;
699

700
procedure TFormEllips.R1trackbarChange(Sender: TObject);
701
begin
702
   ShowSuperellipsoid;
703
end;
704

705
procedure TFormEllips.VCurveTrackBarChange(Sender: TObject);
706
var
707
  n: TGLFloat;
708
begin
709
  n := VCurveTrackBar.Position/10;
710
  GLSuperellipsoid1.VCurve := n;      // ex Vcurve  not xy
711
  ShowSuperellipsoid;
712
end;
713

714

715
procedure TFormEllips.HCurveTrackBarChange(Sender: TObject);
716
var
717
  n: TGLFloat;
718

719
begin
720
  n := HCurveTrackBar.Position/10;
721
  GLSuperellipsoid1.HCurve := n;             // ex H curve
722
  ShowSuperellipsoid;
723
end;
724

725

726
end.
727

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

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

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

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