Unit1.cpp 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include <tchar.h>
  4. #pragma hdrstop
  5. #include "Unit1.h"
  6. //---------------------------------------------------------------------------
  7. #pragma package(smart_init)
  8. #pragma link "GLBaseClasses"
  9. #pragma link "GLBehaviours"
  10. #pragma link "GLCadencer"
  11. #pragma link "GLCoordinates"
  12. #pragma link "GLCrossPlatform"
  13. #pragma link "GLObjects"
  14. #pragma link "GLParticleFX"
  15. #pragma link "GLScene"
  16. #pragma link "GLWin32Viewer"
  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. RadioGroup1Click(Sender);
  28. }
  29. //---------------------------------------------------------------------------
  30. void __fastcall TForm1::RadioGroup1Click(TObject *Sender)
  31. {
  32. TGLSourcePFXEffect *source;
  33. source = GetOrCreateSourcePFX(DCVolcano);
  34. switch (RadioGroup1->ItemIndex) {
  35. case 0: source->ParticleInterval =0.1; break;
  36. case 1: source->ParticleInterval =0.5; break;
  37. case 2: source->ParticleInterval =0.02; break;
  38. case 3: source->ParticleInterval =0.01; break;
  39. case 4: source->ParticleInterval =0.005; break;
  40. case 5: source->ParticleInterval =0.001; break;
  41. default:
  42. ;
  43. }
  44. }
  45. //---------------------------------------------------------------------------
  46. void __fastcall TForm1::GLCadencer1Progress(TObject *Sender, const double deltaTime,
  47. const double newTime)
  48. {
  49. GLSceneViewer1->Invalidate();
  50. }
  51. //---------------------------------------------------------------------------
  52. void __fastcall TForm1::Timer1Timer(TObject *Sender)
  53. {
  54. Panel1->Caption = Format("%.1f FPS - %3d Particles - Depth Sort: %.2f msec",
  55. ARRAYOFCONST((GLSceneViewer1->FramesPerSecond(), PFXVolcano->Particles->ItemCount()+PFXBlue->Particles->ItemCount(),
  56. PFXRenderer->LastSortTime)));
  57. GLSceneViewer1->ResetPerformanceMonitor();
  58. }
  59. //---------------------------------------------------------------------------