Unit1.cpp 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include "Unit1.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.Graph"
  11. #pragma link "GLS.Objects"
  12. #pragma link "GLS.Scene"
  13. #pragma link "GLS.SimpleNavigation"
  14. #pragma link "GLS.SkyDome"
  15. #pragma link "GLS.ThorFX"
  16. #pragma link "GLS.SceneViewer"
  17. #pragma resource "*.dfm"
  18. TForm1 *Form1;
  19. //---------------------------------------------------------------------------
  20. __fastcall TForm1::TForm1(TComponent* Owner)
  21. : TForm(Owner)
  22. {
  23. }
  24. //---------------------------------------------------------------------------
  25. void __fastcall TForm1::FormCreate(TObject *Sender)
  26. {
  27. SetGLSceneMediaDir();
  28. }
  29. //---------------------------------------------------------------------------
  30. void __fastcall TForm1::GSbarChange(TObject *Sender)
  31. {
  32. GLThorFXManager1->GlowSize = (float) GSbar->Position/50;
  33. }
  34. //---------------------------------------------------------------------------
  35. void __fastcall TForm1::GAbarChange(TObject *Sender)
  36. {
  37. GLThorFXManager1->InnerColor->Alpha = (float) GAbar->Position/50;
  38. }
  39. //---------------------------------------------------------------------------
  40. void __fastcall TForm1::WildBarChange(TObject *Sender)
  41. {
  42. GLThorFXManager1->Wildness = (float) WildBar->Position/5;
  43. }
  44. //---------------------------------------------------------------------------
  45. void __fastcall TForm1::VibBarChange(TObject *Sender)
  46. {
  47. GLThorFXManager1->Vibrate = (float) VibBar->Position/10;
  48. }
  49. //---------------------------------------------------------------------------
  50. void __fastcall TForm1::DistanceBarChange(TObject *Sender)
  51. {
  52. float Dist = GLCamera1->DistanceToTarget();
  53. float cx = GLCamera1->Position->X;
  54. float cy = GLCamera1->Position->Y;
  55. float cz = GLCamera1->Position->Z;
  56. float NewDist = DistanceBar->Position;
  57. GLCamera1->Position->X = (float) cx/Dist*NewDist;
  58. GLCamera1->Position->Y = (float) cy/Dist*NewDist;
  59. GLCamera1->Position->Z = (float) cz/Dist*NewDist;
  60. }
  61. //---------------------------------------------------------------------------
  62. void __fastcall TForm1::CoreBoxClick(TObject *Sender)
  63. {
  64. GLThorFXManager1->Core = CoreBox->Checked;
  65. }
  66. //---------------------------------------------------------------------------
  67. void __fastcall TForm1::GLThorFXManager1CalcPoint(TObject *Sender, int PointNo, float &x,
  68. float &y, float &z)
  69. {
  70. //---------------Add user-definable formula to individual points in thor-object-------------
  71. if (SpinBox->Checked)
  72. {
  73. float Place = (float) PointNo/GLThorFXManager1->Maxpoints;
  74. float Spin = (Place*M_PI)*10+(GLCadencer1->CurrentTime*20);
  75. float Scale = (float) Sin(Place*M_PI)/2;
  76. y = y+Sin(Spin)*Scale;
  77. x = x+Cos(Spin)*Scale;
  78. }
  79. }
  80. //---------------------------------------------------------------------------
  81. void __fastcall TForm1::PauseBoxClick(TObject *Sender)
  82. {
  83. GLThorFXManager1->Disabled = PauseBox->Checked;
  84. }
  85. //---------------------------------------------------------------------------
  86. void __fastcall TForm1::HeightField1GetHeight(const float x, const float y, float &z,
  87. TVector4f &Color, TTexPoint &TexPoint)
  88. {
  89. z = 2;
  90. }
  91. //---------------------------------------------------------------------------