fPhongC.cpp 1.8 KB

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