/
daryadevx
/
KMiVVR
Обзор
Документация
Войти
/
daryadevx
/
KMiVVR
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Lab4/fL4.cpp
77 строк
2 KB
daryadevx
fix
24 дек 2024, 21:14
24 дек 2024, 21:14
5d0eeb2
Код
Авторство
О чём код?
//--------------------------------------------------------------------------- #include <vcl.h> #include <tchar.h> #include <math.h> #pragma hdrstop #include "jpeg.hpp" #include "fL4.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma link "GLS.SceneViewer" #pragma link "GLS.Coordinates" #pragma link "GLS.GeomObjects" #pragma link "GLS.Objects" #pragma link "GLS.SceneViewer" #pragma link "GLS.SpaceText" #pragma resource "*.dfm" TForm1* Form1; int mx; int my; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) {} //--------------------------------------------------------------------------- void __fastcall TForm1::FormMouseWheel(TObject* Sender, TShiftState Shift, int WheelDelta, TPoint &MousePos, bool &Handled) { if (GLSceneViewer1->MouseInControl == true) GLCamera1->AdjustDistanceToTarget(pow(1.1, -WheelDelta / 120)); } //--------------------------------------------------------------------------- void __fastcall TForm1::N2Click(TObject* Sender) { if (OpenDialog1->Execute()) { GLTeapot1->Material->Texture->Image->LoadFromFile( OpenDialog1->FileName); } } //--------------------------------------------------------------------------- void __fastcall TForm1::FormKeyDown( TObject* Sender, WORD &Key, TShiftState Shift) { if (Key == 37) { GLTeapot1->Position->X = GLTeapot1->Position->X + 1; } if (Key == 39) { GLTeapot1->Position->X = GLTeapot1->Position->X - 1; } if (Key == 40) { GLTeapot1->Position->Y = GLTeapot1->Position->Y + 1; } if (Key == 38) { GLTeapot1->Position->Y = GLTeapot1->Position->Y - 1; } if (Key == 33) { GLTeapot1->Position->Z = GLTeapot1->Position->Z + 1; } if (Key == 34) { GLTeapot1->Position->Z = GLTeapot1->Position->Z - 1; } } //--------------------------------------------------------------------------- void __fastcall TForm1::GLSceneViewer1MouseMove( TObject* Sender, TShiftState Shift, int X, int Y) { if (Shift.Contains(ssLeft)) GLCamera1->MoveAroundTarget(my - Y, mx - X); else if (Shift.Contains(ssRight)) GLCamera1->RotateTarget(my - Y, mx - X, 0); mx = X; my = Y; } //---------------------------------------------------------------------------