fHierarchC.cpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include "fHierarchC.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. TFormHierarch* FormHierarch;
  15. //---------------------------------------------------------------------------
  16. __fastcall TFormHierarch::TFormHierarch(TComponent* Owner) : TForm(Owner) {}
  17. //---------------------------------------------------------------------------
  18. void __fastcall TFormHierarch::TrackBarChange(TObject* Sender)
  19. {
  20. int t;
  21. t = TrackBar->Position;
  22. // the "sun" spins slowly
  23. Cube1->TurnAngle = t / 4;
  24. // "earth" rotates around the sun and spins
  25. DummyCube1->TurnAngle = -t;
  26. Cube2->TurnAngle = t * 2;
  27. // "moon" rotates around earth and spins
  28. DummyCube2->RollAngle = 3 * t;
  29. Cube3->TurnAngle = 4 * t;
  30. }
  31. //---------------------------------------------------------------------------
  32. void __fastcall TFormHierarch::GLCadencer1Progress(
  33. TObject* Sender, const double deltaTime, const double newTime)
  34. {
  35. if (CBPlay->Checked && Visible)
  36. // simulate a user action on the trackbar...
  37. TrackBar->Position = ((TrackBar->Position + 1) % 360);
  38. }
  39. //---------------------------------------------------------------------------
  40. void __fastcall TFormHierarch::FormResize(TObject* Sender)
  41. {
  42. GLSceneViewer1->ResetPerformanceMonitor();
  43. }
  44. //---------------------------------------------------------------------------
  45. void __fastcall TFormHierarch::FormCloseQuery(TObject* Sender, bool &CanClose)
  46. {
  47. // We need to stop playing here :
  48. // since the timer is asynchronous, if we don't stop play,
  49. // it may get triggered during the form's destruction
  50. CBPlay->Checked = false;
  51. }
  52. //---------------------------------------------------------------------------