fShadowPlaneC.cpp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include "fShadowPlaneC.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.GeomObjects"
  11. #pragma link "GLS.Material"
  12. #pragma link "GLS.Objects"
  13. #pragma link "GLS.Scene"
  14. #pragma link "GLS.ShadowPlane"
  15. #pragma link "GLS.SceneViewer"
  16. #pragma resource "*.dfm"
  17. TForm1 *Form1;
  18. //---------------------------------------------------------------------------
  19. __fastcall TForm1::TForm1(TComponent* Owner)
  20. : TForm(Owner)
  21. {
  22. }
  23. //---------------------------------------------------------------------------
  24. void __fastcall TForm1::FormCreate(TObject *Sender)
  25. {
  26. TFileName Path = GetCurrentAssetPath() + "\\texture\\";
  27. SetCurrentDir(Path); //!!!
  28. GLMaterialLibrary->TexturePaths = Path;
  29. GLMaterialLibrary->Materials->Items[0]->Material->Texture->Image->LoadFromFile("beigemarble.jpg");
  30. }
  31. //---------------------------------------------------------------------------
  32. void __fastcall TForm1::GLCadencer1Progress(TObject *Sender, const double deltaTime,
  33. const double newTime)
  34. {
  35. DCLight->PitchAngle = Sin(newTime)*60;
  36. DCShadowing->TurnAngle = newTime*10;
  37. }
  38. //---------------------------------------------------------------------------
  39. void __fastcall TForm1::CBShadowsClick(TObject *Sender)
  40. {
  41. if (CBShadows->Checked)
  42. GLShadowPlane1->ShadowedLight = GLLightSource1;
  43. else
  44. GLShadowPlane1->ShadowedLight = NULL;
  45. GLShadowPlane2->ShadowedLight = GLShadowPlane1->ShadowedLight;
  46. GLShadowPlane3->ShadowedLight = GLShadowPlane1->ShadowedLight;
  47. }
  48. //---------------------------------------------------------------------------
  49. void __fastcall TForm1::CBStencilClick(TObject *Sender)
  50. {
  51. if (CBStencil->Checked)
  52. GLShadowPlane1->ShadowOptions = GLShadowPlane1->ShadowOptions << spoUseStencil, spoScissor;
  53. else
  54. GLShadowPlane1->ShadowOptions = GLShadowPlane1->ShadowOptions << spoScissor;
  55. GLShadowPlane2->ShadowOptions = GLShadowPlane1->ShadowOptions;
  56. GLShadowPlane3->ShadowOptions = GLShadowPlane1->ShadowOptions;
  57. }
  58. //---------------------------------------------------------------------------
  59. void __fastcall TForm1::Timer1Timer(TObject *Sender)
  60. {
  61. Caption = "Shadow Plane - " + Format("%.1f FPS",
  62. ARRAYOFCONST ((GLSceneViewer1->FramesPerSecond())));
  63. GLSceneViewer1->ResetPerformanceMonitor();
  64. }
  65. //---------------------------------------------------------------------------