unit1.pas
来自「delphi 最好的3D控件GLScene_Demos」· PAS 代码 · 共 59 行
PAS
59 行
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, GLScene, GLObjects, GLMisc, GLWin32Viewer, GLTexture, JPeg,
GLGeomObjects;
type
TForm1 = class(TForm)
GLScene1: TGLScene;
GLSceneViewer1: TGLSceneViewer;
GLCamera: TGLCamera;
DCCamera: TGLDummyCube;
PLGround: TGLPlane;
GLLightSource1: TGLLightSource;
GLMaterialLibrary: TGLMaterialLibrary;
GLCube1: TGLCube;
DCPositionInvariant: TGLDummyCube;
GLCylinder1: TGLCylinder;
GLArrowLine1: TGLArrowLine;
DCOrientationInvariant: TGLDummyCube;
procedure GLSceneViewer1MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure GLSceneViewer1MouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
private
{ Private declarations }
public
{ Public declarations }
mx, my : Integer;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.GLSceneViewer1MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
mx:=x; my:=y;
end;
procedure TForm1.GLSceneViewer1MouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
if ssLeft in Shift then
GLCamera.MoveAroundTarget(my-y, mx-x);
if ssRight in Shift then
GLCamera.MoveTargetInEyeSpace((y-my)*0.05, (mx-x)*0.05, 0);
mx:=x; my:=y;
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?