/
Alexandr_mamonov
/
lab
Обзор
Документация
Войти
/
Alexandr_mamonov
/
lab
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Lab3_CubeMap/fTexturing.cpp
74 строки
2 KB
Александр Мамонов
Add visualization lab projects
11 май 2026, 20:15
11 май 2026, 20:15
e92b10e
Код
Авторство
О чём код?
//--------------------------------------------------------------------------- #include <vcl.h> #pragma hdrstop #include "fTexturing.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma link "GLS.BaseClasses" #pragma link "GLS.Coordinates" #pragma link "GLS.GeomObjects" #pragma link "GLS.Scene" #pragma link "GLS.SceneViewer" #pragma link "GLS.Objects" #pragma resource "*.dfm" TForm1 *Form1; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { GLTeapot1->Material->BlendingMode = bmTransparency; GLTeapot1->Material->FrontProperties->Diffuse->Alpha = 0.8; GLTeapot1->Material->Texture->ImageClassName = "TGLCubeMapImage"; GLTeapot1->Material->Texture->MappingMode = tmmCubeMapReflection; GLTeapot1->Material->Texture->Disabled = false; } //--------------------------------------------------------------------------- void __fastcall TForm1::GLSceneViewer1MouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { mx = X; my = Y; } //--------------------------------------------------------------------------- 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; } //--------------------------------------------------------------------------- void __fastcall TForm1::GLSceneViewer1MouseWheel(TObject *Sender, TShiftState Shift, int WheelDelta, TPoint &MousePos, bool &Handled) { GLCamera1->AdjustDistanceToTarget(Power(1.1, -WheelDelta / 120)); } //--------------------------------------------------------------------------- void __fastcall TForm1::Button1Click(TObject *Sender) { TGLCubeMapImage *Image = (TGLCubeMapImage *)GLTeapot1->Material->Texture->Image; AnsiString str[size_mas] = {"Load \"left\" image", "Load \"right\" image", "Load \"top\" image", "Load \"bottom\" image", "Load \"back\" image", "Load \"front\" image"}; int ind[size_mas] = {CmtPX, CmtNX, CmtPY, CmtNY, CmtPZ, CmtNZ}; for (int i = 0; i < size_mas; i++) { OpenDialog1->Title = str[i]; if (OpenDialog1->Execute()) { Image->Picture[ind[i]]->LoadFromFile(OpenDialog1->FileName); } } } //---------------------------------------------------------------------------