ArenaZ
702 строки · 19.8 Кб
1unit UMainform;
2
3{$mode objfpc}{$H+}
4
5interface
6
7uses
8Classes, SysUtils,{$ifdef Windwos} Windows,{$endif} FileUtil, Forms, Controls, Graphics, Dialogs, Menus,
9ExtCtrls, ComCtrls, ActnList, Types,
10
11GLLCLViewer, GLScene, GLState, GLMaterial, GLCadencer, GLVectorTypes,
12GLVectorGeometry, GLGraph, GLHiddenLineShader, GLOutlineShader,
13GLTextureSharingShader, GLAsyncTimer, GLObjects, GLVectorFileObjects,
14
15uNavCube, GLBaseClasses;
16
17type
18
19{ TMainForm }
20
21TMainForm = class(TForm)
22acSmoothShading: TAction;
23acFlatShading: TAction;
24acPointShading: TAction;
25acTextureShading: TAction;
26acSceneLighting: TAction;
27acShaderHiddenLines: TAction;
28acShaderOutLines: TAction;
29acShaderNone: TAction;
30actInvertNormals: TAction;
31actOpenModel: TAction;
32acWireFrameShading: TAction;
33DCCamera: TGLDummyCube;
34DCTarget: TGLDummyCube;
35DCGrids: TGLDummyCube;
36DCGridXY: TGLDummyCube;
37DCGridXZ: TGLDummyCube;
38DCGridYZ: TGLDummyCube;
39DCLights: TGLDummyCube;
40DCRoot: TGLDummyCube;
41DCWorld: TGLDummyCube;
42Camera1: TGLCamera;
43DCStaticLights: TGLDummyCube;
44DCDynamicLights: TGLDummyCube;
45DCWorldAxis: TGLDummyCube;
46DCWorldGrid: TGLDummyCube;
47ffObject: TGLFreeForm;
48BBox: TGLCube;
49DCAxis: TGLDummyCube;
50FrontAmbientLight: TGLLightSource;
51backAmbientLight: TGLLightSource;
52KeyAmbientLigth: TGLLightSource;
53HiddenLineShader: TGLHiddenLineShader;
54MenuItem20: TMenuItem;
55MenuItem23: TMenuItem;
56OutlineShader: TGLOutlineShader;
57MenuItem21: TMenuItem;
58MenuItem22: TMenuItem;
59WorldGrid: TGLXYZGrid;
60MainLightSource1: TGLLightSource;
61MainStatusBar: TStatusBar;
62MenuItem10: TMenuItem;
63MenuItem11: TMenuItem;
64MenuItem12: TMenuItem;
65MenuItem13: TMenuItem;
66MenuItem14: TMenuItem;
67MenuItem15: TMenuItem;
68MenuItem16: TMenuItem;
69MenuItem17: TMenuItem;
70MenuItem18: TMenuItem;
71MenuItem19: TMenuItem;
72XZGrid: TGLXYZGrid;
73YZGrid: TGLXYZGrid;
74XYGrid: TGLXYZGrid;
75MainActionList: TActionList;
76ASyncTimer: TGLAsyncTimer;
77Cadencer: TGLCadencer;
78LightMapLib: TGLMaterialLibrary;
79OpenDialog: TOpenDialog;
80SaveDialog: TSaveDialog;
81TextureMatLib: TGLMaterialLibrary;
82GLScene: TGLScene;
83GLSViewer: TGLSceneViewer;
84ImageList: TImageList;
85MainMenu: TMainMenu;
86MenuItem1: TMenuItem;
87MenuItem2: TMenuItem;
88MenuItem3: TMenuItem;
89MenuItem4: TMenuItem;
90MenuItem5: TMenuItem;
91MenuItem6: TMenuItem;
92MenuItem7: TMenuItem;
93MenuItem8: TMenuItem;
94MenuItem9: TMenuItem;
95Panel1: TPanel;
96Panel2: TPanel;
97MainTimer: TTimer;
98ToolBar1: TToolBar;
99procedure acFlatShadingExecute(Sender: TObject);
100procedure acPointShadingExecute(Sender: TObject);
101procedure acSceneLightingExecute(Sender: TObject);
102procedure acShaderHiddenLinesExecute(Sender: TObject);
103procedure acShaderNoneExecute(Sender: TObject);
104procedure acShaderOutLinesExecute(Sender: TObject);
105procedure acSmoothShadingExecute(Sender: TObject);
106procedure acTextureShadingExecute(Sender: TObject);
107procedure actInvertNormalsExecute(Sender: TObject);
108procedure actOpenModelExecute(Sender: TObject);
109procedure acWireFrameShadingExecute(Sender: TObject);
110procedure CadencerProgress(Sender: TObject; const deltaTime, newTime: Double);
111procedure FormCreate(Sender: TObject);
112procedure FormMouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
113procedure FormShow(Sender: TObject);
114procedure GLSViewerAfterRender(Sender: TObject);
115procedure GLSViewerMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
116procedure GLSViewerMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
117procedure GLSViewerMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
118procedure MainTimerTimer(Sender: TObject);
119private
120{ private declarations }
121procedure ShowCameraLocation;
122procedure ShowFocalLength;
123procedure ShowLightLocation;
124procedure ShowTargetLocation;
125
126procedure DoResetCamera;
127procedure SetupFreeFormShading;
128procedure ApplyShadeModeToMaterial(aMaterial: TGLMaterial);
129procedure ApplyObjectShadeMode;
130// procedure ApplyFSAA;
131// procedure ApplyObjectFaceCull;
132procedure ApplyObjectTexturing;
133procedure DoOpen(const FileName: String);
134protected
135MousePoint: TPoint;
136md:Boolean;
137public
138{ public declarations }
139lastFileName: String;
140lastLoadWithTextures: Boolean;
141end;
142
143const
144crLightxz = 1;
145crLightyz = 2;
146crLightxy = 3;
147crSlidexy = 4;
148crSlideyz = 5;
149crSlidexz = 6;
150crRotate = 7;
151crZoom = 8;
152crHandMove = 9;
153crSlidezy = 10;
154
155var
156MainForm: TMainForm;
157NavCube: TGLNavCube;
158
159implementation
160
161{$R *.lfm}
162{$R Cursors.res}
163
164uses
165Math,
166// GLFileQ3BSP
167// GLFileDXF
168// GLFileOCT
169// GLFileGRD
170GLFileOBJ, GLFileSTL, GLFileLWO, GLFileMS3D,
171GLFileNMF, GLFileMD3, GLFile3DS, GLFileMD2, GLFileSMD, GLFilePLY, GLFileGTS,
172GLFileVRML, GLFileMD5, GLFileTIN ;
173
174function LoadCursorFromRes(CursorName:String):THandle;
175var
176Cur: TCursorImage;
177begin
178Cur := TCursorImage.Create;
179Cur.LoadFromResourceName(HInstance,CursorName);
180result := Cur.ReleaseHandle;
181Cur.Free;
182end;
183
184procedure TMainForm.GLSViewerMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
185begin
186Screen.Cursor := crDefault;
187md := False;
188end;
189
190procedure TMainForm.MainTimerTimer(Sender: TObject);
191begin
192ShowCameraLocation;
193ShowFocalLength;
194ShowTargetLocation;
195ShowLightLocation;
196MainStatusBar.Panels[4].Text := Format('%.1f FPS', [GLSViewer.FramesPerSecond]);
197GLSViewer.ResetPerformanceMonitor;
198end;
199
200procedure TMainForm.GLSViewerMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
201begin
202if md and (Shift <> []) then
203begin
204if ssLeft in Shift then
205begin
206if ssShift in Shift then
207begin
208//Showmessage('on the rock');
209//NavCube.ActiveMouse:=True;
210end
211else
212begin
213// NavCube.ActiveMouse:=False;
214Camera1.MoveAroundTarget((MousePoint.y - Y) * 0.1, (MousePoint.x - X) * 0.1)
215end;
216end
217else if ssRight in Shift then
218begin
219if ssShift in Shift then { shift key down }
220begin
221with Camera1 do AdjustDistanceToTarget(Power(1.0125, MousePoint.y - Y));
222end
223else
224begin
225with Camera1 do
226begin
227FocalLength := FocalLength - (MousePoint.y - Y);
228if FocalLength > 3000 then FocalLength := 3000; { max focal length }
229if FocalLength < 10 then FocalLength := 10; { min focal length }
230end; { display in statusbar palel }
231end;
232(* d := Camera.DistanceToTarget * 0.01 * (X - MousePoint.x + Y - MousePoint.y);
233if IsKeyDown('x') then ffObject.Translate(d, 0, 0)
234else if IsKeyDown('y') then ffObject.Translate(0, d, 0)
235else if IsKeyDown('z') then ffObject.Translate(0, 0, d)
236else
237begin
238if ssShift in Shift then
239Camera.RotateObject(ffObject, (MousePoint.y - Y) * 0.1, (MousePoint.x - X) * 0.1)
240else
241Camera.RotateObject(ffObject, MousePoint.y - Y, MousePoint.x - X);
242end; *)
243end;
244MousePoint.X := X; { update mouse position }
245MousePoint.Y := Y;
246end;
247
248end;
249
250procedure TMainForm.GLSViewerMouseDown(Sender: TObject;
251Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
252begin
253MousePoint.X := X;
254MousePoint.Y := Y;
255if Shift = [ssLeft] then
256begin
257Screen.Cursor := crRotate;
258NavCube.ActiveMouse := True;
259end
260else if Shift = [ssRight] then
261begin
262Screen.Cursor := crZoom;
263end;
264md:=true;
265(* if ssShift in Shift then { Shift key down}
266begin
267if ssLeft in Shift then Screen.Cursor := crZoom;
268end
269else if ssCtrl in Shift then { Ctrl key down }
270begin
271//if ssLeft in Shift then Screen.Cursor := crSlidexz
272//else
273// if ssRight in Shift then Screen.Cursor := crLightxz;
274end
275else if ssAlt in Shift then { Alt key down }
276begin
277//if ssLeft in Shift then Screen.Cursor := crSlidezy
278//else
279//if ssRight in Shift then Screen.Cursor := crLightxy;
280end
281else { no shift, ctrl or alt key }
282begin
283if Shift = [ssLeft] then Screen.Cursor := crRotate
284else
285if Shift = [ssRight] then Screen.Cursor := crZoom;
286end; *)
287end;
288
289procedure TMainForm.FormMouseWheel(Sender: TObject; Shift: TShiftState;
290WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
291begin
292if (MousePoint.X >= GLSViewer.Left) and
293(MousePoint.X <= GLSViewer.Left + GLSViewer.Width) and
294(MousePoint.Y >= GLSViewer.Top) and
295(MousePoint.y <= GLSViewer.Top + GLSViewer.Height) then
296begin
297{ a wheel step = WheelDelta/300; each step adjusts target distance by 2.5%
298another method to zoom in or out }
299//GLSViewer.SetFocus;
300if ffObject.MeshObjects.Count > 0 then
301begin
302Camera1.AdjustDistanceToTarget(Power(1.025, WheelDelta / 300));
303Camera1.DepthOfView := 2 * Camera1.DistanceToTarget + 2 * ffObject.BoundingSphereRadius;
304end;
305Handled := True;
306
307//Camera1.AdjustDistanceToTarget(Power(1.025, WheelDelta/300));
308//ShowCameraLocation;
309end;
310end;
311
312procedure TMainForm.FormCreate(Sender: TObject);
313begin
314inherited;
315GetCurrentDir;
316NavCube := TGLNavCube.CreateAsChild(GLScene.Objects);
317NavCube.SceneViewer := GLSViewer;
318NavCube.Camera:=Camera1;
319NavCube.ActiveMouse:=True;
320// NavCube.AutoRotate:=False;
321NavCube.FPS := 30;
322
323// instantiate our specific hidden-lines shader
324// hlShader := THiddenLineShader.Create(Self);
325ffObject.IgnoreMissingTextures := True;
326
327Screen.Cursors[crLightxy] := LoadCursorFromRes('LIGHTXY'); //LoadCursor(HInstance, 'LIGHTXY');
328Screen.Cursors[crLightyz] := LoadCursorFromRes('LIGHTYZ'); //LoadCursor(HInstance, 'LIGHTYZ');
329Screen.Cursors[crLightxz] := LoadCursorFromRes('LIGHTXZ'); //LoadCursor(HInstance, 'LIGHTXZ');
330Screen.Cursors[crSlidexy] := LoadCursorFromRes('SLIDEXY'); //LoadCursor(HInstance, 'SLIDEXY');
331Screen.Cursors[crSlidexz] := LoadCursorFromRes('SLIDEXZ'); //LoadCursor(HInstance, 'SLIDEXZ');
332Screen.Cursors[crSlideyz] := LoadCursorFromRes('SLIDEYZ'); //LoadCursor(HInstance, 'SLIDEYZ');
333Screen.Cursors[crRotate] := LoadCursorFromRes('ROTATE'); //LoadCursor(HInstance, 'ROTATE');
334Screen.Cursors[crZoom] := LoadCursorFromRes('ZOOM'); //LoadCursor(HInstance, 'ZOOM');
335Screen.Cursors[crSlidezy] := LoadCursorFromRes('SLIDEZY'); //LoadCursor(HInstance, 'SLIDEZY');
336end;
337
338procedure TMainForm.CadencerProgress(Sender: TObject; const deltaTime,
339newTime: Double);
340begin
341if NavCube.InactiveTime > 5 then
342begin
343if NavCube.InactiveTime < 8 then
344Camera1.TurnAngle := Camera1.TurnAngle + (NavCube.InactiveTime - 5) * deltaTime * 2
345else
346Camera1.TurnAngle := Camera1.TurnAngle + deltatime * 6;
347end;
348GLSViewer.Refresh;
349if Self.Focused then
350GLSViewer.Invalidate;
351end;
352
353procedure TMainForm.acPointShadingExecute(Sender: TObject);
354begin
355ApplyObjectShadeMode();
356end;
357
358procedure TMainForm.acSceneLightingExecute(Sender: TObject);
359begin
360//acSceneLight.Checked := not(acSceneLight.Checked);
361ApplyObjectShadeMode;
362end;
363
364procedure TMainForm.acShaderHiddenLinesExecute(Sender: TObject);
365begin
366ApplyObjectShadeMode;
367end;
368
369procedure TMainForm.acShaderNoneExecute(Sender: TObject);
370begin
371ApplyObjectShadeMode;
372end;
373
374procedure TMainForm.acShaderOutLinesExecute(Sender: TObject);
375begin
376ApplyObjectShadeMode;
377end;
378
379procedure TMainForm.acSmoothShadingExecute(Sender: TObject);
380begin
381ApplyObjectShadeMode();
382end;
383
384procedure TMainForm.acTextureShadingExecute(Sender: TObject);
385begin
386ApplyObjectTexturing();
387end;
388
389procedure TMainForm.actInvertNormalsExecute(Sender: TObject);
390begin
391if actInvertNormals.Checked then
392ffObject.NormalsOrientation:=mnoInvert
393else
394ffObject.NormalsOrientation:=mnoDefault;
395end;
396
397procedure TMainForm.actOpenModelExecute(Sender: TObject);
398begin
399NavCube.ActiveMouse := False;
400if OpenDialog.Execute then DoOpen(OpenDialog.fileName);
401end;
402
403procedure TMainForm.acFlatShadingExecute(Sender: TObject);
404begin
405ApplyObjectShadeMode();
406end;
407
408procedure TMainForm.acWireFrameShadingExecute(Sender: TObject);
409begin
410ApplyObjectShadeMode();
411end;
412
413procedure TMainForm.FormShow(Sender: TObject);
414begin
415ShowCameraLocation;
416ShowFocalLength;
417ShowTargetLocation;
418ShowLightLocation;
419
420OpenDialog.Filter := VectorFileFormatsFilter;
421SaveDialog.Filter := VectorFileFormatsSaveFilter;
422
423ASyncTimer.Enabled:=true;
424//ApplyFSAA;
425//ApplyFaceCull;
426//ApplyFPS;
427end;
428
429procedure TMainForm.GLSViewerAfterRender(Sender: TObject);
430begin
431//ApplyFSAA;
432//Screen.Cursor := crDefault;
433end;
434
435procedure TMainForm.ShowCameraLocation;
436begin
437with Camera1.Position do
438MainStatusBar.Panels[0].Text := 'Camera: '+FloatToStrF(X, ffNumber, 5, 2)+', '+
439FloatToStrF(Y, ffNumber, 5, 2)+', '+FloatToStrF(Z, ffNumber, 5, 2);
440end;
441
442procedure TMainForm.ShowTargetLocation;
443begin
444with DCTarget.Position do
445MainStatusBar.Panels[2].Text := 'Target: '+
446FloatToStrF(-X, ffNumber, 5, 2)+', '+FloatToStrF(-Y, ffNumber, 5, 2)+', '+
447FloatToStrF(-Z, ffNumber, 5, 2);
448end;
449
450procedure TMainForm.ShowFocalLength;
451begin
452with Camera1 do
453MainStatusBar.Panels[1].Text := 'Focal: '+FloatToStrF(FocalLength, ffnumber, 5, 2);
454end;
455
456procedure TMainForm.ShowLightLocation;
457begin
458with MainLightSource1.Position do
459MainStatusBar.Panels[3].Text := 'Light: '+
460FloatToStrF(X, ffNumber, 5, 2)+', '+FloatToStrF(Y, ffNumber, 5, 2)+', '+
461FloatToStrF(Z, ffNumber, 5, 2);
462end;
463
464procedure TMainForm.ApplyObjectTexturing;
465var
466i: Integer;
467begin
468with TextureMatLib.Materials do
469for i := 0 to Count - 1 do
470begin
471with Items[i].Material.Texture do
472begin
473if Enabled then
474Items[i].Tag := Integer(True);
475Enabled := Boolean(Items[i].Tag) and acTextureShading.Checked;
476end;
477end;
478ffObject.StructureChanged;
479end;
480
481procedure TMainForm.ApplyShadeModeToMaterial(aMaterial: TGLMaterial);
482begin
483if acPointShading.Checked then
484begin
485GLSViewer.Buffer.Lighting := True;
486GLSViewer.Buffer.ShadeModel := smSmooth;
487aMaterial.PolygonMode := pmPoints;
488end
489else
490if acSmoothShading.Checked then
491begin
492GLSViewer.Buffer.Lighting := True;
493GLSViewer.Buffer.ShadeModel := smSmooth;
494aMaterial.PolygonMode := pmFill;
495end
496else if acFlatShading.Checked then
497begin
498GLSViewer.Buffer.Lighting := True;
499GLSViewer.Buffer.ShadeModel := smFlat;
500aMaterial.PolygonMode := pmFill;
501end
502else if acWireframeShading.Checked then
503begin
504GLSViewer.Buffer.Lighting := False;
505GLSViewer.Buffer.ShadeModel := smSmooth;
506aMaterial.PolygonMode := pmLines;
507end;
508end;
509
510procedure TMainForm.ApplyObjectShadeMode;
511var
512i: Integer;
513begin
514with TextureMatLib.Materials do
515for i := 0 to Count - 1 do
516begin
517ApplyShadeModeToMaterial(Items[i].Material);
518if (acShaderHiddenLines.Checked) then
519Items[i].Shader := HiddenLineShader
520else if (acShaderOutLines.Checked) then
521Items[i].Shader := OutLineShader
522else if (acShaderNone.Checked) then
523Items[i].Shader := nil;
524end;
525GLSViewer.Buffer.Lighting := acSceneLighting.Checked;
526ffObject.StructureChanged;
527end;
528
529procedure TMainForm.SetupFreeFormShading;
530var
531i: Integer;
532LibMat: TGLLibMaterial;
533begin
534if TextureMatLib.Materials.Count = 0 then
535begin
536ffObject.Material.MaterialLibrary := TextureMatLib;
537LibMat := TextureMatLib.Materials.Add;
538ffObject.Material.LibMaterialName := LibMat.Name;
539libMat.Material.FrontProperties.Diffuse.Red := 0;
540end;
541for i := 0 to TextureMatLib.Materials.Count - 1 do
542with TextureMatLib.Materials[i].Material do
543BackProperties.Assign(FrontProperties);
544ApplyObjectShadeMode;
545ApplyObjectTexturing;
546end;
547
548procedure TMainForm.DoResetCamera;
549var
550objSize: Single;
551begin
552dcTarget.Position.AsVector := NullHmgPoint;
553Camera1.Position.SetPoint(50, 40, 50);
554ffObject.Position.AsVector := NullHmgPoint;
555ffObject.Up.Assign(DCWorldAxis.Up);
556ffObject.Direction.Assign(DCWorldAxis.Direction);
557
558objSize := ffObject.BoundingSphereRadius;
559if objSize > 0 then
560begin
561if objSize < 1 then
562begin
563Camera1.SceneScale := 1 / objSize;
564objSize := 1;
565end
566else
567Camera1.SceneScale := 1;
568Camera1.AdjustDistanceToTarget(objSize * 0.27);
569Camera1.DepthOfView := 1.5 * Camera1.DistanceToTarget + 2 * objSize;
570end;
571end;
572
573procedure TMainForm.DoOpen(const FileName: String);
574var
575min, max: TAffineVector;
576GridStep, ObjSize : Single;
577begin
578if not FileExists(fileName) then Exit;
579Screen.Cursor := crHourGlass;
580Caption := 'Scene Master - ' + FileName;
581TextureMatLib.Materials.Clear;
582ffObject.MeshObjects.Clear;
583ffObject.LoadFromFile(FileName);
584SetupFreeFormShading;
585// acFileSaveTextures.Enabled := (MaterialLib.Materials.Count > 0);
586// acFileOpenTexLib.Enabled := (MaterialLib.Materials.Count > 0);
587lastFileName := FileName;
588lastLoadWithTextures := acTextureShading.Enabled;
589ffObject.GetExtents(min, max);
590BBox.CubeWidth := (max.X - min.X)/2;
591BBox.CubeHeight := (max.Y - min.Y)/2;
592BBox.CubeDepth := (max.Z - min.Z/2);
593// ffObject.Position.AsAffineVector := VectorLerp(min/2, max/2, 0.5);
594//BBox.Position.AsAffineVector := VectorLerp(min, max, 0.5);
595// ffObject.Translate(0,(BBox.Position.Y*2),0);
596
597// GridStep := 1.0;
598
599
600With WorldGrid do
601begin
602With XSamplingScale do
603begin
604min:=-BBox.CubeWidth+1;
605max:=BBox.CubeWidth+1;
606GridStep :=1.0+ (10*BBox.CubeWidth)/BBox.CubeWidth;
607step:=GridStep;
608end;
609With ZSamplingScale do
610begin
611min:=-BBox.CubeDepth+1;
612max:=BBox.CubeDepth+1;
613GridStep :=1.0+ (10*BBox.CubeDepth)/BBox.CubeDepth;
614step:=GridStep;
615end;
616end;
617
618With XZGrid do
619begin
620With XSamplingScale do
621begin
622min:=-BBox.CubeWidth+1;
623max:=BBox.CubeWidth+1;
624GridStep :=1.0+ (10*BBox.CubeWidth)/BBox.CubeWidth;
625step:=GridStep;
626step:=GridStep;
627end;
628With ZSamplingScale do
629begin
630min:=-BBox.CubeDepth+1;
631max:=BBox.CubeDepth+1;
632GridStep :=1.0+ (10*BBox.CubeDepth)/BBox.CubeDepth;
633step:=GridStep;
634end;
635end;
636
637
638With YZGrid do
639begin
640With YSamplingScale do
641begin
642min:=-BBox.CubeHeight+1;
643max:=BBox.CubeHeight+1;
644GridStep :=1.0+ (10*BBox.CubeHeight)/BBox.CubeHeight;
645step:=GridStep;
646end;
647With ZSamplingScale do
648begin
649min:=-BBox.CubeDepth+1;
650max:=BBox.CubeDepth+1;
651GridStep :=1.0+ (10*BBox.CubeDepth)/BBox.CubeDepth;
652step:=GridStep;
653end;
654end;
655
656
657With XYGrid do
658begin
659With YSamplingScale do
660begin
661min:=-BBox.CubeHeight+1;
662max:=BBox.CubeHeight+1;
663step:=GridStep;
664end;
665With XSamplingScale do
666begin
667min:=-BBox.CubeWidth+1;
668max:=BBox.CubeWidth+1;
669step:=GridStep;
670end;
671end;
672
673With DCGridYZ do
674begin
675position.X:=-(BBox.CubeWidth);
676position.Y:=-1;
677position.Z:=0;
678end;
679With DCGridXZ do
680begin
681position.X:=0;
682position.Y:=-(BBox.CubeHeight);
683position.Z:=0;
684end;
685
686With DCGridXY do
687begin
688position.X:=0;
689position.Y:=-1;
690position.Z:=-(BBox.CubeDepth);
691end;
692
693(* StatusBar.Panels[0].Text := 'X: ' + ' ';
694StatusBar.Panels[1].Text := 'Y: ' + ' ';
695StatusBar.Panels[2].Text := 'Z: ' + ' '; *)
696
697
698DoResetCamera;
699Screen.Cursor := crDefault;
700end;
701
702end.
703
704