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