fSplines.pas 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. unit fSplines;
  2. interface
  3. uses
  4. Winapi.OpenGL,
  5. System.SysUtils,
  6. System.Classes,
  7. Vcl.Graphics,
  8. Vcl.Controls,
  9. Vcl.Forms,
  10. Vcl.Dialogs,
  11. GLS.Scene,
  12. GLS.Objects,
  13. GLS.SceneViewer,
  14. GLS.Coordinates,
  15. GLS.BaseClasses,
  16. GLS.VectorGeometry;
  17. type
  18. TForm1 = class(TForm)
  19. GLScene1: TGLScene;
  20. GLSceneViewer1: TGLSceneViewer;
  21. GLCamera1: TGLCamera;
  22. Lines1: TGLLines;
  23. procedure GLSceneViewer1MouseDown(Sender: TObject;
  24. Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  25. procedure GLSceneViewer1MouseMove(Sender: TObject; Shift: TShiftState;
  26. X, Y: Integer);
  27. private
  28. public
  29. procedure MoveCenterNodeTo(x, y : Integer);
  30. end;
  31. var
  32. Form1: TForm1;
  33. implementation
  34. {$R *.DFM}
  35. procedure TForm1.MoveCenterNodeTo(x, y : Integer);
  36. begin
  37. Lines1.Nodes[1].AsAffineVector:=GLSceneViewer1.Buffer.ScreenToWorld(x, y);
  38. end;
  39. procedure TForm1.GLSceneViewer1MouseDown(Sender: TObject;
  40. Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  41. begin
  42. MoveCenterNodeTo(x, y);
  43. end;
  44. procedure TForm1.GLSceneViewer1MouseMove(Sender: TObject;
  45. Shift: TShiftState; X, Y: Integer);
  46. begin
  47. if Shift<>[] then
  48. MoveCenterNodeTo(x, y);
  49. end;
  50. end.