2
0

fManualC.cpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include "fManualC.h"
  5. //---------------------------------------------------------------------------
  6. #pragma package(smart_init)
  7. #pragma link "GLS.BaseClasses"
  8. #pragma link "GLS.Cadencer"
  9. #pragma link "GLS.Coordinates"
  10. #pragma link "GLS.Objects"
  11. #pragma link "GLS.Scene"
  12. #pragma link "GLS.SceneViewer"
  13. #pragma resource "*.dfm"
  14. TForm1 *Form1;
  15. //---------------------------------------------------------------------------
  16. __fastcall TForm1::TForm1(TComponent* Owner)
  17. : TForm(Owner)
  18. {
  19. }
  20. //---------------------------------------------------------------------------
  21. void __fastcall TForm1::TrackBarChange(TObject *Sender)
  22. {
  23. int t;
  24. t = TrackBar->Position;
  25. // the "sun" turns slowly around Y axis
  26. Cube1->TurnAngle = t/4;
  27. // "earth" rotates around the sun on the Y axis
  28. Cube2->Position->X =3*cos(DegToRad((float)t));
  29. Cube2->Position->Z =3*sin(DegToRad((float)t));
  30. // "moon" rotates around earth on the X axis
  31. Cube3->Position->X = Cube2->Position->X;
  32. Cube3->Position->Y = Cube2->Position->Y+1*cos(DegToRad((float)3*t));
  33. Cube3->Position->Z = Cube2->Position->Z+1*sin(DegToRad((float)3*t));
  34. // update FPS count
  35. StaticText1->Caption = IntToStr(int64_t(GLSceneViewer1->FramesPerSecond()))+" FPS";
  36. }
  37. //---------------------------------------------------------------------------
  38. void __fastcall TForm1::GLCadencer1Progress(TObject *Sender, const double deltaTime,
  39. const double newTime)
  40. {
  41. if (CBPlay->Checked && Visible)
  42. // simulate a user action on the trackbar...
  43. TrackBar->Position = ((TrackBar->Position+1) % 360);
  44. }
  45. //---------------------------------------------------------------------------
  46. void __fastcall TForm1::FormResize(TObject *Sender)
  47. {
  48. GLSceneViewer1->ResetPerformanceMonitor();
  49. }
  50. //---------------------------------------------------------------------------