Unit1.cpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include "Unit1.h"
  5. //---------------------------------------------------------------------------
  6. #pragma package(smart_init)
  7. #pragma resource "*.dfm"
  8. TForm1 *Form1;
  9. //---------------------------------------------------------------------------
  10. __fastcall TForm1::TForm1(TComponent* Owner)
  11. : TForm(Owner)
  12. {
  13. }
  14. //---------------------------------------------------------------------------
  15. void __fastcall TForm1::GLSceneViewer1MouseDown(TObject *Sender,
  16. TMouseButton Button, TShiftState Shift, int X, int Y)
  17. {
  18. mx = X;
  19. my = Y;
  20. }
  21. //---------------------------------------------------------------------------
  22. void __fastcall TForm1::GLSceneViewer1MouseMove(TObject *Sender,
  23. TShiftState Shift, int X, int Y)
  24. {
  25. if (Shift.Contains(ssLeft))
  26. {
  27. GLCamera1->MoveAroundTarget(my-Y, mx-X);
  28. mx = X;
  29. my = Y;
  30. }
  31. }
  32. //---------------------------------------------------------------------------
  33. void __fastcall TForm1::AsyncTimer1Timer(TObject *Sender)
  34. {
  35. Form1->Caption = "Phong Shader - " + GLSceneViewer1->FramesPerSecondText(1);
  36. GLSceneViewer1->ResetPerformanceMonitor();
  37. }
  38. //---------------------------------------------------------------------------
  39. void __fastcall TForm1::CheckBox1Click(TObject *Sender)
  40. {
  41. GLPhongShader1->Enabled = CheckBox1->Checked;
  42. }
  43. //---------------------------------------------------------------------------
  44. void __fastcall TForm1::GLCadencer1Progress(TObject *Sender,
  45. const double deltaTime, const double newTime)
  46. {
  47. CheckBox1->Checked = GLPhongShader1->Enabled;
  48. GLSceneViewer1->Invalidate();
  49. }
  50. //---------------------------------------------------------------------------