fPointto.pas 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. unit fPointto;
  2. interface
  3. uses
  4. System.SysUtils,
  5. System.Classes,
  6. System.Math,
  7. Vcl.Graphics,
  8. Vcl.Controls,
  9. Vcl.Forms,
  10. Vcl.Dialogs,
  11. Vcl.StdCtrls,
  12. GLS.Objects,
  13. GLS.Scene,
  14. GLS.VectorTypes,
  15. GLS.VectorGeometry,
  16. GLS.Cadencer,
  17. GLS.SceneViewer,
  18. GLS.GeomObjects,
  19. GLS.Coordinates,
  20. GLS.BaseClasses;
  21. type
  22. TFormPointto = class(TForm)
  23. GLSceneViewer1: TGLSceneViewer;
  24. GLScene1: TGLScene;
  25. GLCamera1: TGLCamera;
  26. DCSphere: TGLDummyCube;
  27. ArrowLine: TGLArrowLine;
  28. GLLightSource1: TGLLightSource;
  29. Sphere: TGLSphere;
  30. DCArrow: TGLDummyCube;
  31. GLCadencer1: TGLCadencer;
  32. Disk1: TGLDisk;
  33. Disk2: TGLDisk;
  34. Lines1: TGLLines;
  35. Plane1: TGLPlane;
  36. Lines2: TGLLines;
  37. procedure GLCadencer1Progress(Sender: TObject; const deltaTime,
  38. newTime: Double);
  39. private
  40. end;
  41. var
  42. FormPointto: TFormPointto;
  43. implementation
  44. {$R *.DFM}
  45. procedure TFormPointto.GLCadencer1Progress(Sender: TObject; const deltaTime,
  46. newTime: Double);
  47. begin
  48. // Make the blue sphere turn and ride a sin
  49. DCSphere.Turn(deltaTime*30);
  50. Sphere.Position.Y := Sin(DegToRad(newTime*50))*3;
  51. // Make the arrow turn
  52. DCArrow.Turn(-deltaTime*15);
  53. // Make the arrow point toward the sphere, using Y as up reference
  54. ArrowLine.PointTo(Sphere, YHmgVector);
  55. end;
  56. end.