Unit1.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include <math.h>
  4. #pragma hdrstop
  5. #include "Unit1.h"
  6. //---------------------------------------------------------------------------
  7. #pragma package(smart_init)
  8. #pragma link "GLGeomObjects"
  9. #pragma link "GLWin32Viewer"
  10. #pragma link "GLCadencer"
  11. #pragma link "GLVectorGeometry"
  12. #pragma link "GLScene"
  13. #pragma link "GLObjects"
  14. #pragma link "GLBaseClasses"
  15. #pragma link "GLCoordinates"
  16. #pragma link "GLCrossPlatform"
  17. #pragma resource "*.dfm"
  18. TForm1 *Form1;
  19. //---------------------------------------------------------------------------
  20. __fastcall TForm1::TForm1(TComponent * Owner):TForm(Owner)
  21. {
  22. }
  23. //---------------------------------------------------------------------------
  24. void __fastcall TForm1::GLCadencer1Progress(TObject * Sender,
  25. const double deltaTime,
  26. const double newTime)
  27. {
  28. // Make the blue sphere turn and ride a sin
  29. DCSphere->Turn(deltaTime * 30);
  30. Sphere->Position->Y = sin(DegToRad(newTime * 50)) * 3;
  31. // Make the arrow turn
  32. DCArrow->Turn(-deltaTime * 15);
  33. // Make the arrow point toward the sphere, using Y as up reference
  34. ArrowLine->PointTo(Sphere, YHmgVector);
  35. }
  36. //---------------------------------------------------------------------------