fPointtoD.pas 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. unit fPointtoD;
  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. Stage.VectorTypes,
  15. Stage.VectorGeometry,
  16. GLS.Cadencer,
  17. GLS.SceneViewer,
  18. GLS.GeomObjects,
  19. GLS.Coordinates,
  20. GLS.BaseClasses, GLS.SimpleNavigation;
  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. GLSimpleNavigation1: TGLSimpleNavigation;
  38. procedure GLCadencer1Progress(Sender: TObject; const deltaTime,
  39. newTime: Double);
  40. private
  41. end;
  42. var
  43. FormPointto: TFormPointto;
  44. implementation
  45. {$R *.DFM}
  46. procedure TFormPointto.GLCadencer1Progress(Sender: TObject; const deltaTime,
  47. newTime: Double);
  48. begin
  49. // Make the blue sphere turn and ride a sin
  50. DCSphere.Turn(deltaTime*30);
  51. Sphere.Position.Y := Sin(DegToRad(newTime*50))*3;
  52. // Make the arrow turn
  53. DCArrow.Turn(-deltaTime*15);
  54. // Make the arrow point toward the sphere, using Y as up reference
  55. ArrowLine.PointTo(Sphere, YHmgVector);
  56. end;
  57. end.