Unit1.cpp 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #include <vcl.h>
  2. #pragma hdrstop
  3. #include "Unit1.h"
  4. #include <math.h>
  5. //---------------------------------------------------------------------------
  6. #pragma package(smart_init)
  7. #pragma link "GLS.Cadencer"
  8. #pragma link "GLS.GeomObjects"
  9. #pragma link "GLS.Objects"
  10. #pragma link "GLS.Scene"
  11. #pragma link "GLS.SceneViewer"
  12. #pragma link "GLS.BaseClasses"
  13. #pragma link "GLS.Coordinates"
  14. #pragma resource "*.dfm"
  15. TForm1 *Form1;
  16. //---------------------------------------------------------------------------
  17. __fastcall TForm1::TForm1(TComponent* Owner)
  18. : TForm(Owner)
  19. {
  20. }
  21. //---------------------------------------------------------------------------
  22. void __fastcall TForm1::RBSTCClick(TObject *Sender)
  23. {
  24. // we have 3 objects, move up twice and we're on the top !
  25. CentralSphere->MoveUp();
  26. CentralSphere->MoveUp();
  27. }
  28. //---------------------------------------------------------------------------
  29. void __fastcall TForm1::RBTSCClick(TObject *Sender)
  30. {
  31. // we have 3 objects, move down twice and we're on the top,
  32. // then once down, we're in the middle !
  33. CentralSphere->MoveUp();
  34. CentralSphere->MoveUp();
  35. CentralSphere->MoveDown();
  36. }
  37. //---------------------------------------------------------------------------
  38. void __fastcall TForm1::RBTCSClick(TObject *Sender)
  39. {
  40. // we have 3 objects, move down twice and we're on the bottom !
  41. CentralSphere->MoveDown();
  42. CentralSphere->MoveDown();
  43. }
  44. //---------------------------------------------------------------------------
  45. void __fastcall TForm1::CBAdditiveClick(TObject *Sender)
  46. {
  47. // adjust blending mode for both orbiting spheres
  48. if (CBAdditive->Checked)
  49. OrbitingSphere1->Material->BlendingMode = bmAdditive;
  50. else OrbitingSphere1->Material->BlendingMode = bmTransparency;
  51. OrbitingSphere2->Material->BlendingMode = OrbitingSphere1->Material->BlendingMode;
  52. }
  53. //---------------------------------------------------------------------------
  54. void __fastcall TForm1::CBSortingClick(TObject *Sender)
  55. {
  56. // adjust sorting on the parent object
  57. if (CBSorting->Checked)
  58. BaseDummyCube->ObjectsSorting = osRenderFarthestFirst;
  59. else BaseDummyCube->ObjectsSorting = osNone;
  60. }
  61. //---------------------------------------------------------------------------
  62. void __fastcall TForm1::GLCadencer1Progress(TObject *Sender,
  63. const double deltaTime, const double newTime)
  64. {
  65. double alpha;
  66. // move the spheres
  67. alpha = DegToRad(newTime*60);
  68. OrbitingSphere1->Position->SetPoint(1.5*cos(alpha), 1.5*sin(alpha), 1.5*sin(alpha));
  69. alpha = alpha+M_PI/2;
  70. OrbitingSphere2->Position->SetPoint(1.5*cos(alpha), 1.5*sin(alpha), 1.5*sin(alpha));
  71. }
  72. //---------------------------------------------------------------------------