MathgeomGLS
726 строк · 20.5 Кб
1unit 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
7interface
8
9uses
10Winapi.Windows,
11Winapi.Messages,
12System.Actions,
13System.SysUtils,
14System.Math,
15System.ImageList,
16System.Classes,
17Vcl.Graphics,
18Vcl.Forms,
19Vcl.Controls,
20Vcl.Menus,
21Vcl.StdCtrls,
22Vcl.Dialogs,
23Vcl.Buttons,
24Vcl.ExtCtrls,
25Vcl.ComCtrls,
26Vcl.StdActns,
27Vcl.ActnList,
28Vcl.ToolWin,
29ButtonGroup,
30Vcl.ImgList,
31
32GLS.OpenGLTokens,
33GLS.BitmapFont,
34GLS.WindowsFont,
35GLS.HUDObjects,
36GLS.Objects,
37GLS.Scene,
38GLS.Graph,
39GLS.GeomObjects,
40GLS.Coordinates,
41GLS.BaseClasses,
42GLS.SceneViewer,
43GLS.Color,
44Vcl.Imaging.Jpeg,
45GLS.Material,
46GLS.Texture,
47GLS.Context,
48GLS.VectorTypes,
49GLS.VectorTypesExt,
50GLS.VectorGeometry,
51GLS.VectorLists;
52
53type
54TFormEllips = class(TForm)
55MainMenu1: TMainMenu;
56File1: TMenuItem;
57FileNewItem: TMenuItem;
58FileOpenItem: TMenuItem;
59FileCloseItem: TMenuItem;
60Window1: TMenuItem;
61Help1: TMenuItem;
62N1: TMenuItem;
63FileExitItem: TMenuItem;
64WindowCascadeItem: TMenuItem;
65WindowTileItem: TMenuItem;
66WindowArrangeItem: TMenuItem;
67HelpAboutItem: TMenuItem;
68OpenDialog: TOpenDialog;
69FileSaveItem: TMenuItem;
70FileSaveAsItem: TMenuItem;
71Edit1: TMenuItem;
72CutItem: TMenuItem;
73CopyItem: TMenuItem;
74PasteItem: TMenuItem;
75WindowMinimizeItem: TMenuItem;
76ActionList1: TActionList;
77EditCut1: TEditCut;
78EditCopy1: TEditCopy;
79EditPaste1: TEditPaste;
80FileNew1: TAction;
81FileSave1: TAction;
82FileExit1: TAction;
83FileOpen1: TAction;
84FileSaveAs1: TAction;
85WindowCascade1: TWindowCascade;
86WindowTileHorizontal1: TWindowTileHorizontal;
87WindowArrangeAll1: TWindowArrange;
88WindowMinimizeAll1: TWindowMinimizeAll;
89HelpAbout1: TAction;
90FileClose1: TWindowClose;
91WindowTileVertical1: TWindowTileVertical;
92WindowTileItem2: TMenuItem;
93ToolBar2: TToolBar;
94ToolButton1: TToolButton;
95ToolButton2: TToolButton;
96ToolButton3: TToolButton;
97ToolButton4: TToolButton;
98ToolButton5: TToolButton;
99ToolButton6: TToolButton;
100ToolButton9: TToolButton;
101ToolButton7: TToolButton;
102ToolButton8: TToolButton;
103ToolButton10: TToolButton;
104ToolButton11: TToolButton;
105ImageList1: TImageList;
106GLScene1: TGLScene;
107CameraCube: TGLDummyCube;
108Camera: TGLCamera;
109GLLightSource1: TGLLightSource;
110ObjectsCube: TGLDummyCube;
111ArrowZ: TGLArrowLine;
112ArrowY: TGLArrowLine;
113ArrowX: TGLArrowLine;
114GLXYZGridXZ: TGLXYZGrid;
115CubeL0L1L2: TGLCube;
116GLRenderPoint1: TGLRenderPoint;
117GLHUDText1: TGLHUDText;
118GLWindowsBitmapFont1: TGLWindowsBitmapFont;
119Panel1: TPanel;
120Label1: TLabel;
121Label2: TLabel;
122Label3: TLabel;
123Label4: TLabel;
124Label6: TLabel;
125Label5: TLabel;
126Label8: TLabel;
127Label14: TLabel;
128Label13: TLabel;
129Label11: TLabel;
130Label19: TLabel;
131Label20: TLabel;
132Label21: TLabel;
133Label15: TLabel;
134Label16: TLabel;
135Label18: TLabel;
136Label22: TLabel;
137xRadiusTrackBar: TTrackBar;
138yRadiusTrackBar: TTrackBar;
139zRadiusTrackBar: TTrackBar;
140VCurveTrackBar: TTrackBar;
141HCurveTrackBar: TTrackBar;
142SlicesTrackBar: TTrackBar;
143StacksTrackBar: TTrackBar;
144xPositionTrackBar: TTrackBar;
145yPositionTrackBar: TTrackBar;
146zPositionTrackBar: TTrackBar;
147xdirectiontrackbar: TTrackBar;
148ydirectiontrackbar: TTrackBar;
149zdirectiontrackbar: TTrackBar;
150L0trackbar: TTrackBar;
151L1trackbar: TTrackBar;
152L2trackbar: TTrackBar;
153R1trackbar: TTrackBar;
154Reset: TButton;
155GLSceneViewer1: TGLSceneViewer;
156Label7: TLabel;
157Label9: TLabel;
158Label10: TLabel;
159Label12: TLabel;
160BottomTrackBar: TTrackBar;
161TopTrackBar: TTrackBar;
162StartTrackBar: TTrackBar;
163StopTrackBar: TTrackBar;
164ArrowsCheckBox: TCheckBox;
165GridCheckBox: TCheckBox;
166BottomCapRadioGroup: TRadioGroup;
167TopCapRadioGroup: TRadioGroup;
168Cube_Map: TButton;
169HCheckBox: TCheckBox;
170VCheckBox: TCheckBox;
171StatusBar: TStatusBar;
172Test: TButton;
173RGdimensionsMultiplier: TRadioGroup;
174GLSuperellipsoid1: TGLSuperellipsoid;
175GLSuperellipsoid2: TGLSuperellipsoid;
176procedure FileNew1Execute(Sender: TObject);
177procedure FileOpen1Execute(Sender: TObject);
178procedure HelpAbout1Execute(Sender: TObject);
179procedure FileExit1Execute(Sender: TObject);
180procedure ArrowsCheckBoxClick(Sender: TObject);
181procedure FormCreate(Sender: TObject);
182procedure FormShow(Sender: TObject);
183procedure ShowCameraLocation;
184procedure ShowFocalLength;
185procedure ShowDisplacement;
186procedure ShowSuperellipsoid;
187procedure GLSceneViewer1MouseDown(Sender: TObject; Button: TMouseButton;
188Shift: TShiftState; X, Y: Integer);
189procedure GLSceneViewer1MouseMove(Sender: TObject; Shift: TShiftState; X,
190Y: Integer);
191procedure GLSceneViewer1MouseUp(Sender: TObject; Button: TMouseButton;
192Shift: TShiftState; X, Y: Integer);
193procedure GridCheckBoxClick(Sender: TObject);
194procedure xdirectiontrackbarChange(Sender: TObject);
195procedure xRadiusTrackBarChange(Sender: TObject);
196procedure ydirectiontrackbarChange(Sender: TObject);
197procedure yPositionTrackBarChange(Sender: TObject);
198procedure yRadiusTrackBarChange(Sender: TObject);
199procedure zdirectiontrackbarChange(Sender: TObject);
200procedure zPositionTrackBarChange(Sender: TObject);
201procedure zRadiusTrackBarChange(Sender: TObject);
202procedure L0trackbarChange(Sender: TObject);
203procedure L1trackbarChange(Sender: TObject);
204procedure L2trackbarChange(Sender: TObject);
205procedure SlicesTrackBarChange(Sender: TObject);
206procedure StacksTrackBarChange(Sender: TObject);
207procedure StartTrackBarChange(Sender: TObject);
208procedure TopTrackBarChange(Sender: TObject);
209procedure TopCapRadioGroupClick(Sender: TObject);
210procedure StopTrackBarChange(Sender: TObject);
211procedure BottomCapRadioGroupClick(Sender: TObject);
212procedure BottomTrackBarChange(Sender: TObject);
213procedure TestClick(Sender: TObject);
214procedure ResetClick(Sender: TObject);
215procedure R1trackbarChange(Sender: TObject);
216procedure VCurveTrackBarChange(Sender: TObject);
217procedure HCurveTrackBarChange(Sender: TObject);
218
219private
220
221procedure CreateMDIChild(const Name: string);
222public
223
224end;
225
226var
227FormEllips: TFormEllips;
228
229
230implementation
231
232{$R *.dfm}
233
234uses
235CHILDWIN, About;
236
237const
238crLightxz = 1; crLightyz = 2; crLightxy = 3;
239crSlidexy = 4; crSlideyz = 5; crSlidexz = 6;
240crRotate = 7; crZoom = 8; crHandMove = 9;
241spheredensity =1000; Surf_Bounce=1.5;
242NXmax= 16; NYmax = 11 ; NZmax = 11 ;
243
244var
245L0,L1, L2,R1: double;
246EllipsDir: TGLVector;
247MousePoint: TPoint;
248
249procedure TFormEllips.CreateMDIChild(const Name: string);
250var
251Child: TMDIChild;
252begin
253{ create a new MDI child window }
254Child := TMDIChild.Create(Application);
255Child.Caption := Name;
256if FileExists(Name) then Child.Memo1.Lines.LoadFromFile(Name);
257end;
258
259procedure TFormEllips.FileNew1Execute(Sender: TObject);
260begin
261CreateMDIChild('NONAME' + IntToStr(MDIChildCount + 1));
262end;
263
264procedure TFormEllips.FileOpen1Execute(Sender: TObject);
265begin
266if OpenDialog.Execute then
267CreateMDIChild(OpenDialog.FileName);
268end;
269
270procedure TFormEllips.FormCreate(Sender: TObject);
271begin
272Screen.Cursors[crSlidexy] := LoadCursor(HInstance, 'SLIDEXY');
273Screen.Cursors[crRotate] := LoadCursor(HInstance, 'ROTATE');
274Screen.Cursors[crZoom] := LoadCursor(HInstance, 'ZOOM');
275
276Randomize;
277{
278Superellipsoid := TGLSuperellipsoid(GLScene1.Objects.AddNewChild(TGLSuperellipsoid));
279Superellipsoid.name:='SuperEllis';
280Superellipsoid.Direction.SetVector(0, 0, 1);
281Superellipsoid.Up.SetVector(0, 1, 0);
282Superellipsoid.Position.SetPoint(0, 1, 0);
283Superellipsoid.Material.FrontProperties.Emission.Color:=clrYellow ;
284Superellipsoid.Material.FrontProperties.diffuse.alpha:=0.4 ;
285Superellipsoid.Material.PolygonMode:= pmlines; //pmFill; pmlines pmpoints
286}
287
288end;
289
290procedure TFormEllips.FormShow(Sender: TObject);
291var I,J,K,SphereNumber:integer;
292deltaX,deltaY,deltaZ:real;
293ptPos:TGLVector;
294
295begin
296TestClick(self);
297ShowCameraLocation;
298{ focallength: right mouse drag up/down }
299ShowFocalLength;
300{ displace origin: x axis: ctrl/left mouse drag left/right
301y axis: ctrl/left mouse drag up/down }
302ShowDisplacement;
303{ move light: x axis: ctrl right mouse drag left/right
304y axis: ctrl right mouse drag up/down
305z axis: shift right mouse drag up/down }
306
307ShowSuperellipsoid;
308
309end;
310
311procedure TFormEllips.HelpAbout1Execute(Sender: TObject);
312begin
313AboutBox.ShowModal;
314end;
315
316
317procedure TFormEllips.FileExit1Execute(Sender: TObject);
318begin
319Close;
320end;
321
322procedure TFormEllips.ArrowsCheckBoxClick(Sender: TObject);
323begin
324ArrowX.Visible := not ArrowsCheckBox.Checked;
325ArrowY.Visible := ArrowX.Visible;
326ArrowZ.Visible := ArrowX.Visible;
327end;
328
329procedure TFormEllips.GLSceneViewer1MouseDown(Sender: TObject;
330Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
331
332begin
333MousePoint.X := X;
334MousePoint.Y := Y;
335if ssShift in Shift then
336begin
337if ssLeft in Shift then Screen.Cursor := crZoom
338else
339if ssRight in Shift then Screen.Cursor := crLightxz;
340end
341else if ssCtrl in Shift then
342begin
343if ssLeft in Shift then Screen.Cursor := crSlidexy
344else
345if ssRight in Shift then Screen.Cursor := crLightxy;
346end
347else { no shift or ctrl key }
348begin
349if Shift = [ssLeft] then Screen.Cursor := crRotate
350else
351if Shift = [ssRight] then Screen.Cursor := crZoom;
352end;
353end;
354
355procedure TFormEllips.GLSceneViewer1MouseMove(Sender: TObject; Shift: TShiftState;
356X, Y: Integer);
357var
358dx, dy: integer;
359nx, nz, d: TGLFloat;
360
361begin // refer GLScene\Demos\interface\camera\Camera.dpr
362dx := MousePoint.X - X;
363dy := MousePoint.Y - Y;
364if ssShift in Shift then // shift key down
365begin
366if ssLeft in Shift then // left mouse button
367begin
368{ dy = a step which adjusts target distance by 1.25%; zoom in or out }
369with Camera do AdjustDistanceToTarget(Power(1.0125, dy));
370ShowCameraLocation;
371end
372end
373else if ssCtrl in Shift then { Ctrl key down }
374begin
375if ssLeft in Shift then { left mouse button }
376begin
377nz := Camera.Position.Z*dy;
378nx := Camera.Position.Z*dx;
379d := 5*Camera.FocalLength;
380with CameraCube.Position do
381begin
382Z := Z - nz/d;
383X := X - nx/d;
384end;
385ShowDisplacement;
386end
387end
388else { no shift key }
389begin
390if Shift = [ssLeft] then
391{ Left mouse button changes camera angle by moving around target }
392begin
393Camera.MoveAroundTarget(dy, dx);
394ShowCameraLocation;
395end;
396if Shift = [ssRight] then
397begin
398{ Right mouse button alters the camera's focal length;
399zoom out or in by moving cursor up or down }
400with Camera do
401begin
402FocalLength := FocalLength - dy;
403if FocalLength > 1000 then FocalLength := 1000; { max focal length }
404if FocalLength < 20 then FocalLength := 20; { min focal length }
405end;
406ShowFocalLength; { display in statusbar palel }
407end;
408end;
409MousePoint.X := X; { update mouse position }
410MousePoint.Y := Y;
411end;
412
413procedure TFormEllips.GLSceneViewer1MouseUp(Sender: TObject; Button: TMouseButton;
414Shift: TShiftState; X, Y: Integer);
415begin
416Screen.Cursor := crDefault;
417end;
418
419procedure TFormEllips.GridCheckBoxClick(Sender: TObject);
420begin
421GlXYZGridXZ.Visible := not GridCheckBox.Checked;
422end;
423
424procedure TFormEllips.xdirectiontrackbarChange(Sender: TObject);
425begin
426ShowSuperellipsoid;
427end;
428
429procedure TFormEllips.xRadiusTrackBarChange(Sender: TObject);
430begin
431ShowSuperellipsoid;
432end;
433
434procedure TFormEllips.ydirectiontrackbarChange(Sender: TObject);
435begin
436ShowSuperellipsoid;
437end;
438
439procedure TFormEllips.yPositionTrackBarChange(Sender: TObject);
440begin
441ShowSuperellipsoid;
442end;
443
444procedure TFormEllips.yRadiusTrackBarChange(Sender: TObject);
445begin
446ShowSuperellipsoid;
447end;
448
449procedure TFormEllips.zdirectiontrackbarChange(Sender: TObject);
450begin
451ShowSuperellipsoid;
452end;
453
454procedure TFormEllips.zPositionTrackBarChange(Sender: TObject);
455begin
456ShowSuperellipsoid;
457end;
458procedure TFormEllips.zRadiusTrackBarChange(Sender: TObject);
459begin
460ShowSuperellipsoid;
461end;
462
463procedure TFormEllips.L0trackbarChange(Sender: TObject);
464begin
465ShowSuperellipsoid;
466end;
467
468procedure TFormEllips.L1trackbarChange(Sender: TObject);
469begin
470ShowSuperellipsoid;
471end;
472
473
474procedure TFormEllips.L2trackbarChange(Sender: TObject);
475begin
476ShowSuperellipsoid;
477end;
478
479procedure TFormEllips.ShowCameraLocation;
480begin
481with Camera.Position do
482StatusBar.Panels[0].Text := 'Camera: '+FloatToStrF(X, ffNumber, 5, 2)+', '+
483FloatToStrF(Y, ffNumber, 5, 2)+', '+FloatToStrF(Z, ffNumber, 5, 2);
484end;
485
486procedure TFormEllips.ShowFocalLength;
487begin
488with Camera do
489StatusBar.Panels[1].Text := 'f = '+FloatToStrF(FocalLength, ffnumber, 5, 2);
490end;
491
492procedure TFormEllips.ShowDisplacement;
493begin
494with CameraCube.Position do
495StatusBar.Panels[2].Text := 'Displaced: '+
496FloatToStrF(-X, ffNumber, 5, 2)+', '+FloatToStrF(-Y, ffNumber, 5, 2);
497end;
498
499procedure TFormEllips.ShowSuperellipsoid;
500
501var multip: double;
502
503begin
504case RGdimensionsMultiplier.ItemIndex of
5050: multip:=0.1;
5061: multip:=1;
5072: multip:=10;
508end;
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 }
515GLSuperellipsoid1.Scale.SetVector(multip*(xRadiusTrackBar.Position-1),
516multip*(yRadiusTrackBar.Position-1),
517multip*(zRadiusTrackBar.Position-1));
518
519GLSuperellipsoid1.Position.SetPoint(multip*(xPositionTrackBar.Position-1),
520multip*(yPositionTrackBar.Position-1),
521multip*(zPositionTrackBar.Position-1));
522
523EllipsDir:= VectorMake(multip*(xDirectionTrackBar.Position-1),
524multip*(yDirectionTrackBar.Position-1),
525multip*(zDirectionTrackBar.Position-1));
526GLSuperellipsoid1.Direction.SetVector(multip*(xDirectionTrackBar.Position-1),
527multip*(yDirectionTrackBar.Position-1),
528multip*(zDirectionTrackBar.Position-1));
529
530L0:= multip*(L0TrackBar.Position-1) ;
531L1:= multip*(L1TrackBar.Position-1) ;
532L2:= multip*(L2TrackBar.Position-1) ;
533R1:= multip*(R1TrackBar.Position-1) ;
534
535GLSuperellipsoid1.Slices := SlicesTrackBar.Position;
536GLSuperellipsoid1.Stacks := StacksTrackBar.Position;
537GLSuperellipsoid1.Top := TopTrackBar.Position;
538
539case TopCapRadioGroup.ItemIndex of
5400:GLSuperellipsoid1.TopCap := ctNone;
5411:GLSuperellipsoid1.TopCap := ctCenter;
5422:GLSuperellipsoid1.TopCap := ctFlat;
543end;
544
545// GLSuperellipsoid1.Bottom := -BottomTrackBar.Position;
546
547case BottomCapRadioGroup.ItemIndex of
5480:GLSuperellipsoid1.BottomCap := ctNone;
5491:GLSuperellipsoid1.BottomCap := ctCenter;
5502:GLSuperellipsoid1.BottomCap := ctFlat;
551end;
552
553if (StartTrackBar.Position <= StopTrackBar.Position) and
554(StartTrackBar.Position < 360) then
555begin
556GLSuperellipsoid1.Start := StartTrackBar.Position;
557GLSuperellipsoid1.Stop := StopTrackBar.Position;
558end;
559// Superellipsoid.VCheck := VCheckBox.Checked;
560// Superellipsoid.HCheck := HCheckBox.Checked;
561//Superellipsoid.Normals := nsNone;
562GLHudText1.Text := 'Axis dimensions x_A y_B z_C :'+
563
564FloatToStrF(multip*(xRadiusTrackBar.Position-1), ffNumber, 6, 2)+', '+
565FloatToStrF(multip*(yRadiusTrackBar.Position-1), ffNumber, 6, 2)+', '+
566FloatToStrF(multip*(ZRadiusTrackBar.Position-1), ffNumber, 6, 2)+', '+
567#13#10'Position:'+
568FloatToStrF(multip*(xPositionTrackBar.Position-1), ffNumber, 6, 2)+', '+
569FloatToStrF(multip*(yPositionTrackBar.Position-1), ffNumber, 6, 2)+', '+
570FloatToStrF(multip*(zPositionTrackBar.Position-1), ffNumber, 6, 2)+
571#13#10'Direction:'+
572FloatToStrF(multip*(xDirectionTrackBar.Position-1), ffNumber, 6, 2)+', '+
573FloatToStrF(multip*(yDirectionTrackBar.Position-1), ffNumber, 6, 2)+', '+
574FloatToStrF(multip*(zDirectionTrackBar.Position-1), ffNumber, 6, 2)+
575#13#10'Box x_L0 y_L1 z_L2 R1 :'+
576FloatToStrF(L0, ffNumber, 6, 2)+', '+
577FloatToStrF(L1, ffNumber, 6, 2)+', '+
578FloatToStrF(L2, ffNumber, 6, 2)+', '+
579FloatToStrF(R1, ffNumber, 6, 2)+
580#13#10'VCurve:'+
581FloatToStrF(VCurveTrackBar.Position/10, ffNumber, 6, 2)+
582#13#10'HCurve:'+
583FloatToStrF(HCurveTrackBar.Position/10, ffNumber, 6, 2)+
584#13#10'Slices:'+
585IntToStr(SlicesTrackBar.Position)+
586#13#10'Stacks:'+
587IntToStr(StacksTrackBar.Position)+
588#13#10'Top:'+
589IntToStr(TopTrackBar.Position)+'�'+
590// #13#10'Bottom:'+
591// IntToStr(BottomTrackBar.Position)+'�'+
592#13#10'Start:'+
593IntToStr(StartTrackBar.Position)+'�'+
594#13#10'Stop:'+
595IntToStr(StopTrackBar.Position)+'�' ;
596GLSuperellipsoid1.StructureChanged ;
597end;
598
599procedure TFormEllips.SlicesTrackBarChange(Sender: TObject);
600begin
601ShowSuperellipsoid;
602end;
603
604procedure TFormEllips.StacksTrackBarChange(Sender: TObject);
605begin
606ShowSuperellipsoid;
607end;
608
609procedure TFormEllips.StartTrackBarChange(Sender: TObject);
610begin
611if (StartTrackBar.Position >= StopTrackBar.Position)
612then StartTrackBar.Position := StopTrackBar.Position;
613ShowSuperellipsoid;
614end;
615
616
617procedure TFormEllips.TopCapRadioGroupClick(Sender: TObject);
618begin
619ShowSuperellipsoid;
620end;
621
622procedure TFormEllips.TopTrackBarChange(Sender: TObject);
623begin
624ShowSuperellipsoid;
625end;
626
627procedure TFormEllips.StopTrackBarChange(Sender: TObject);
628begin
629if (StopTrackBar.Position <= StartTrackBar.Position)
630then StopTrackBar.Position := StartTrackBar.Position;
631ShowSuperellipsoid;
632end;
633
634procedure TFormEllips.BottomCapRadioGroupClick(Sender: TObject);
635begin
636ShowSuperellipsoid;
637end;
638
639procedure TFormEllips.BottomTrackBarChange(Sender: TObject);
640begin
641ShowSuperellipsoid;
642end;
643
644procedure TFormEllips.TestClick(Sender: TObject);
645begin
646// SetCurrentDir(AssetPath);
647
648with GLSuperellipsoid1.Material.Texture do
649begin
650// We need a CubeMapImage, which unlike the "regular Images" stores
651// multiple images.
652ImageClassName := TGLCubeMapImage.ClassName;
653with Image as TGLCubeMapImage do
654begin
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
658Picture[cmtPX].LoadFromFile('cm_left.png');
659Picture[cmtNX].LoadFromFile('cm_right.png');
660Picture[cmtPY].LoadFromFile('cm_top.png');
661Picture[cmtNY].LoadFromFile('cm_bottom.png');
662Picture[cmtPZ].LoadFromFile('cm_back.png');
663Picture[cmtNZ].LoadFromFile('cm_front.png');
664end;
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)
668MappingMode := tmmCubeMapReflection;
669// That's all folks, let us see the thing!
670Disabled := False;
671end;
672Cube_Map.Visible := False;
673end;
674{
675procedure TMainForm.checkclick(Sender: TObject);
676begin
677ShowSuperellipsoid;
678end;
679
680procedure TMainForm.RadiusTrackBarChange(Sender: TObject);
681begin
682ShowSuperellipsoid;
683end;
684}
685
686procedure TFormEllips.ResetClick(Sender: TObject);
687var I,J,K:integer;
688begin
689GLSuperellipsoid1.free;
690
691GLsceneViewer1.ResetPerformanceMonitor;
692FormEllips.Close;
693FormCreate(self) ;
694FormShow (self);
695GLSuperellipsoid1.StructureChanged ;
696GLsceneViewer1.Update;
697
698end;
699
700procedure TFormEllips.R1trackbarChange(Sender: TObject);
701begin
702ShowSuperellipsoid;
703end;
704
705procedure TFormEllips.VCurveTrackBarChange(Sender: TObject);
706var
707n: TGLFloat;
708begin
709n := VCurveTrackBar.Position/10;
710GLSuperellipsoid1.VCurve := n; // ex Vcurve not xy
711ShowSuperellipsoid;
712end;
713
714
715procedure TFormEllips.HCurveTrackBarChange(Sender: TObject);
716var
717n: TGLFloat;
718
719begin
720n := HCurveTrackBar.Position/10;
721GLSuperellipsoid1.HCurve := n; // ex H curve
722ShowSuperellipsoid;
723end;
724
725
726end.
727