fBeerC.cpp 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include "fBeerC.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.Objects"
  12. #pragma link "GLS.ParticleFX"
  13. #pragma link "GLS.PerlinPFX"
  14. #pragma link "GLS.Scene"
  15. #pragma link "GLS.ShadowPlane"
  16. #pragma link "GLS.VectorFileObjects"
  17. #pragma link "GLS.SceneViewer"
  18. #pragma link "GLS.File3DS"
  19. #pragma link "GLS.FileJPEG"
  20. #pragma link "Stage.Utils"
  21. #pragma resource "*.dfm"
  22. TForm1 *Form1;
  23. int mx, my;
  24. //---------------------------------------------------------------------------
  25. __fastcall TForm1::TForm1(TComponent* Owner)
  26. : TForm(Owner)
  27. {
  28. }
  29. //---------------------------------------------------------------------------
  30. void __fastcall TForm1::FormActivate(TObject *Sender)
  31. {
  32. TFileName Path = GetCurrentAssetPath();
  33. SetCurrentDir(Path + "\\model");
  34. GLFreeForm1->LoadFromFile("beer.3ds");
  35. SetCurrentDir(Path + "\\texture");
  36. GLFreeForm1->Material->Texture->Image->LoadFromFile("clouds.jpg");
  37. GLShadowPlane1->Material->Texture->Image->LoadFromFile("ashwood.jpg");
  38. GetOrCreateSourcePFX(GLDummyCube3)->Burst(0, 150);
  39. }
  40. //---------------------------------------------------------------------------
  41. void __fastcall TForm1::GLSceneViewer1DblClick(TObject *Sender)
  42. {
  43. GLCadencer1->Enabled = !GLCadencer1->Enabled;
  44. }
  45. //---------------------------------------------------------------------------
  46. void __fastcall TForm1::GLSceneViewer1MouseMove(TObject *Sender, TShiftState Shift,
  47. int X, int Y)
  48. {
  49. if (Shift.Contains(ssShift))
  50. GLCamera1->MoveAroundTarget(my-Y, mx-X);
  51. mx = X;
  52. my = Y;
  53. }
  54. //---------------------------------------------------------------------------
  55. void __fastcall TForm1::GLCadencer1Progress(TObject *Sender, const double deltaTime,
  56. const double newTime)
  57. {
  58. GLCamera1->MoveAroundTarget(0, 10*deltaTime);
  59. }
  60. //---------------------------------------------------------------------------