Unit1.cpp 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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.Extrusion"
  11. #pragma link "GLS.FireFX"
  12. #pragma link "GLS.GeomObjects"
  13. #pragma link "GLS.Objects"
  14. #pragma link "GLS.Scene"
  15. #pragma link "GLS.SceneViewer"
  16. #pragma resource "*.dfm"
  17. TForm1 *Form1;
  18. int mx,my;
  19. //---------------------------------------------------------------------------
  20. __fastcall TForm1::TForm1(TComponent* Owner)
  21. : TForm(Owner)
  22. {
  23. }
  24. //---------------------------------------------------------------------------
  25. void __fastcall TForm1::FormResize(TObject *Sender)
  26. {
  27. GLCamera1->FocalLength = Height/3;
  28. }
  29. //---------------------------------------------------------------------------
  30. void __fastcall TForm1::GLSceneViewer1MouseDown(TObject *Sender, TMouseButton Button,
  31. TShiftState Shift, int X, int Y)
  32. {
  33. mx = X; my = Y;
  34. }
  35. //---------------------------------------------------------------------------
  36. void __fastcall TForm1::TrackBar1Change(TObject *Sender)
  37. {
  38. GLFireFXManager1->FireDir->Z = -TrackBar1->Position*0.1;
  39. }
  40. //---------------------------------------------------------------------------
  41. void __fastcall TForm1::GLSceneViewer1MouseMove(TObject *Sender, TShiftState Shift,
  42. int X, int Y)
  43. {
  44. if (Shift.Contains(ssLeft) || Shift.Contains(ssRight)) // if (Shift <> [])
  45. {
  46. GLCamera1->MoveAroundTarget(my-Y, mx-X);
  47. GLCadencer1->Progress();
  48. mx = X; my = Y;
  49. }
  50. }
  51. //---------------------------------------------------------------------------
  52. void __fastcall TForm1::Timer1Timer(TObject *Sender)
  53. {
  54. int n;
  55. Caption = "GLS.Scene Candles - "+ Format("%.1f FPS", ARRAYOFCONST((GLSceneViewer1->FramesPerSecond())));
  56. GLSceneViewer1->ResetPerformanceMonitor();
  57. if (TrackBar1->Position==0)
  58. GLFireFXManager1->Disabled = False;
  59. else {
  60. n = abs(TrackBar1->Position)-15;
  61. if (n>0)
  62. if (Random()/n<0.15) GLFireFXManager1->Disabled = True;
  63. }
  64. }
  65. //---------------------------------------------------------------------------