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 "GLBaseClasses"
  9. #pragma link "GLCoordinates"
  10. #pragma link "GLCrossPlatform"
  11. #pragma link "GLExtrusion"
  12. #pragma link "GLGeomObjects"
  13. #pragma link "GLObjects"
  14. #pragma link "GLScene"
  15. #pragma link "GLWin32Viewer"
  16. #pragma resource "*.dfm"
  17. TForm1 *Form1;
  18. //---------------------------------------------------------------------------
  19. __fastcall TForm1::TForm1(TComponent* Owner)
  20. : TForm(Owner)
  21. {
  22. }
  23. //---------------------------------------------------------------------------
  24. void __fastcall TForm1::FormMouseWheel(TObject *Sender, TShiftState Shift, int WheelDelta,
  25. TPoint &MousePos, bool &Handled)
  26. {
  27. GLCamera1->AdjustDistanceToTarget(Power(1.05, WheelDelta / 120));
  28. }
  29. //---------------------------------------------------------------------------
  30. void __fastcall TForm1::GLSceneViewer1MouseDown(TObject *Sender, TMouseButton Button,
  31. TShiftState Shift, int X, int Y)
  32. {
  33. mx = X; my = Y;
  34. }
  35. //---------------------------------------------------------------------------
  36. void __fastcall TForm1::GLSceneViewer1MouseMove(TObject *Sender, TShiftState Shift,
  37. int X, int Y)
  38. {
  39. if (Shift.Contains(ssLeft))
  40. GLCamera1->MoveAroundTarget(my-Y, mx-X);
  41. mx = X; my = Y;
  42. }
  43. //---------------------------------------------------------------------------