fCameraControllerC.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. //---------------------------------------------------------------------------
  2. #ifndef fCameraControllerCH
  3. #define fCameraControllerCH
  4. //---------------------------------------------------------------------------
  5. #include <System.Classes.hpp>
  6. #include <Vcl.Controls.hpp>
  7. #include <Vcl.StdCtrls.hpp>
  8. #include <Vcl.Forms.hpp>
  9. #include "GLS.BaseClasses.hpp"
  10. #include "GLS.Cadencer.hpp"
  11. #include "GLS.CameraController.hpp"
  12. #include "GLS.Coordinates.hpp"
  13. #include "GLS.GeomObjects.hpp"
  14. #include "GLS.Graph.hpp"
  15. #include "GLS.Material.hpp"
  16. #include "GLS.Navigator.hpp"
  17. #include "GLS.Objects.hpp"
  18. #include "GLS.Scene.hpp"
  19. #include "GLS.SmoothNavigator.hpp"
  20. #include "GLS.SceneViewer.hpp"
  21. #include <Vcl.ExtCtrls.hpp>
  22. #include <Vcl.Graphics.hpp>
  23. //---------------------------------------------------------------------------
  24. class TForm1 : public TForm
  25. {
  26. __published: // IDE-managed Components
  27. TPanel *Panel1;
  28. TPanel *Panel2;
  29. TLabel *Label1;
  30. TLabel *Label2;
  31. TLabel *Label3;
  32. TLabel *Label5;
  33. TEdit *eDestX;
  34. TEdit *eDestY;
  35. TEdit *eDestZ;
  36. TPanel *Panel3;
  37. TLabel *Label6;
  38. TLabel *Label9;
  39. TEdit *eDistance;
  40. TPanel *Panel4;
  41. TLabel *Label7;
  42. TLabel *Label8;
  43. TLabel *Label10;
  44. TLabel *Label11;
  45. TLabel *Label12;
  46. TEdit *eSafeDistance;
  47. TEdit *eTimeToSafePlacement;
  48. TEdit *eTimeToOrbit;
  49. TEdit *eTimeToZoomBackIn;
  50. TPanel *Panel5;
  51. TLabel *Label13;
  52. TLabel *Label14;
  53. TEdit *eTime;
  54. TButton *btnMoveToPos;
  55. TButton *btnZoomToDistance;
  56. TButton *btnOrbitToPos;
  57. TButton *btnSafeOrbitAndZoomToPos;
  58. TButton *btnOrbitToPosAdv;
  59. TPanel *Panel8;
  60. TLabel *Label20;
  61. TPanel *Panel7;
  62. TLabel *Label16;
  63. TLabel *Label17;
  64. TLabel *Label18;
  65. TLabel *Label19;
  66. TEdit *camDirY;
  67. TEdit *camDirZ;
  68. TPanel *Panel9;
  69. TLabel *Label21;
  70. TLabel *Label22;
  71. TLabel *Label23;
  72. TLabel *Label24;
  73. TEdit *camUpX;
  74. TEdit *camUpY;
  75. TEdit *camUpZ;
  76. TCheckBox *UpAxis;
  77. TCheckBox *cbMoveParent;
  78. TButton *btSmoothOrbit;
  79. TButton *btSmoothOrbitToPosAdv;
  80. TButton *btSmoothOrbitAndZoom;
  81. TGLSceneViewer *GLSceneViewer1;
  82. TPanel *pImg;
  83. TImage *Image1;
  84. TLabel *Label4;
  85. TPanel *Panel6;
  86. TLabel *Label15;
  87. TGLScene *GLScene1;
  88. TGLDummyCube *dcMovingParent;
  89. TGLCamera *GLCamera;
  90. TGLLightSource *GLLightSource1;
  91. TGLDummyCube *dcSphere;
  92. TGLSphere *GLSphere1;
  93. TGLCylinder *GLCylinder1;
  94. TGLSphere *GLSphere2;
  95. TGLSphere *GLSphere3;
  96. TGLDummyCube *dcDebugGUI;
  97. TGLArrowLine *ArrowLine;
  98. TGLXYZGrid *XYZGrid;
  99. TGLPlane *GLPlane1;
  100. TGLMaterialLibrary *GLMaterialLibrary1;
  101. TGLCadencer *GLCadencer1;
  102. TTimer *Timer1;
  103. TGLCameraController *GLCameraController1;
  104. TGLSmoothNavigator *GLSmoothNavigator;
  105. TEdit *camDirX;
  106. void __fastcall btnMoveToPosClick(TObject *Sender);
  107. void __fastcall btnZoomToDistanceClick(TObject *Sender);
  108. void __fastcall btnOrbitToPosClick(TObject *Sender);
  109. void __fastcall btnSafeOrbitAndZoomToPosClick(TObject *Sender);
  110. void __fastcall btSmoothOrbitClick(TObject *Sender);
  111. void __fastcall btSmoothOrbitAndZoomClick(TObject *Sender);
  112. void __fastcall btSmoothOrbitToPosAdvClick(TObject *Sender);
  113. void __fastcall btnOrbitToPosAdvClick(TObject *Sender);
  114. void __fastcall FormMouseWheel(TObject *Sender, TShiftState Shift, int WheelDelta,
  115. TPoint &MousePos, bool &Handled);
  116. void __fastcall GLCadencer1Progress(TObject *Sender, const double deltaTime, const double newTime);
  117. void __fastcall GLSceneViewer1MouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift,
  118. int X, int Y);
  119. void __fastcall GLSceneViewer1MouseMove(TObject *Sender, TShiftState Shift, int X,
  120. int Y);
  121. void __fastcall GLSceneViewer1MouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift,
  122. int X, int Y);
  123. void __fastcall Timer1Timer(TObject *Sender);
  124. void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
  125. void __fastcall FormCreate(TObject *Sender);
  126. private: // User declarations
  127. int mx, my;
  128. double DextX, DextY, DextZ, Time, ZoomDistance;
  129. TGLCameraController *FGLCameraController;
  130. TGLNavigatorSmoothChangeVector *FCameraSmoothAnimator_AbsPos;
  131. TGLNavigatorSmoothChangeVector *FCameraSmoothAnimator_RelPos;
  132. void __fastcall GetInput(TButton *Sender);
  133. TVector4f __fastcall(__closure *TGLNavigatorSmoothChangeVectorGetEvent)
  134. (TGLNavigatorSmoothChangeVector* const ASender);
  135. TGLVector __fastcall OnGetCameraPosition(
  136. TGLNavigatorSmoothChangeVector* const ASender);
  137. void __fastcall OnSetCameraPosition(TGLNavigatorSmoothChangeVector* const ASender,
  138. const TVector4f &AValue);
  139. public: // User declarations
  140. __fastcall TForm1(TComponent* Owner);
  141. };
  142. //---------------------------------------------------------------------------
  143. extern PACKAGE TForm1 *Form1;
  144. //---------------------------------------------------------------------------
  145. #endif