Unit1.cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include <tchar.h>
  4. #pragma hdrstop
  5. #include "Unit1.h"
  6. //---------------------------------------------------------------------------
  7. #pragma package(smart_init)
  8. #pragma link "GLS.BaseClasses"
  9. #pragma link "GLS.Coordinates"
  10. #pragma link "GLS.Extrusion"
  11. #pragma link "GLS.GeomObjects"
  12. #pragma link "GLS.Objects"
  13. #pragma link "GLS.Scene"
  14. #pragma link "GLS.SceneViewer"
  15. #pragma resource "*.dfm"
  16. TForm1 *Form1;
  17. //---------------------------------------------------------------------------
  18. __fastcall TForm1::TForm1(TComponent* Owner)
  19. : TForm(Owner)
  20. {
  21. }
  22. //---------------------------------------------------------------------------
  23. void __fastcall TForm1::FormMouseWheel(TObject *Sender, TShiftState Shift, int WheelDelta,
  24. TPoint &MousePos, bool &Handled)
  25. {
  26. GLCamera1->AdjustDistanceToTarget(Power(1.05, WheelDelta / 120));
  27. }
  28. //---------------------------------------------------------------------------
  29. void __fastcall TForm1::GLSceneViewer1MouseDown(TObject *Sender, TMouseButton Button,
  30. TShiftState Shift, int X, int Y)
  31. {
  32. mx = X; my = Y;
  33. }
  34. //---------------------------------------------------------------------------
  35. void __fastcall TForm1::GLSceneViewer1MouseMove(TObject *Sender, TShiftState Shift,
  36. int X, int Y)
  37. {
  38. if (Shift.Contains(ssLeft))
  39. GLCamera1->MoveAroundTarget(my-Y, mx-X);
  40. mx = X; my = Y;
  41. }
  42. //---------------------------------------------------------------------------