/
MikeLight
/
Lab
Обзор
Документация
Войти
/
MikeLight
/
Lab
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
lab4/fL4.cpp
74 строки
2 KB
MikeLight
upload files
25 ноя 2025, 20:19
25 ноя 2025, 20:19
fa45b3a
Код
Авторство
О чём код?
#include <fmx.h> #include <System.IOUtils.hpp> #pragma hdrstop #include "fL4.h" #pragma package(smart_init) #pragma resource "*.fmx" TForm1 *Form1; __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { AnimationsRunning = true; } void __fastcall TForm1::LoadEarthTextureClick(TObject *Sender) { if (OpenDialog1->Execute()) { try { TextureMaterialEarth->Texture->LoadFromFile(OpenDialog1->FileName); } catch (Exception &e) { ShowMessage("������ �������� ��������: " + e.Message); } } } void __fastcall TForm1::LoadSunTextureClick(TObject *Sender) { if (OpenDialog1->Execute()) { try { TTextureMaterialSource *tempMaterial = new TTextureMaterialSource(this); tempMaterial->Texture->LoadFromFile(OpenDialog1->FileName); SphereSun->MaterialSource = tempMaterial; } catch (Exception &e) { ShowMessage("������ �������� ��������: " + e.Message); } } } void __fastcall TForm1::ToggleAnimationClick(TObject *Sender) { AnimationsRunning = !AnimationsRunning; FloatAnimationSun->Enabled = AnimationsRunning; FloatAnimationEarth->Enabled = AnimationsRunning; FloatAnimationOrbit->Enabled = AnimationsRunning; if (AnimationsRunning) { ToggleAnimation->Text = "���������� ��������"; } else { ToggleAnimation->Text = "��������� ��������"; } } void __fastcall TForm1::Viewport3D1MouseWheel(TObject *Sender, TShiftState Shift, int WheelDelta, bool &Handled) { float scale = 1.0f + (WheelDelta / 1200.0f); Camera1->Position->Z = Camera1->Position->Z * scale; Handled = true; } void __fastcall TForm1::FormCreate(TObject *Sender) { Caption = "��������� ������� - ������ � �����"; OpenDialog1->Filter = "�����������|*.jpg;*.jpeg;*.png;*.bmp"; String defaultEarthTexture = "earth_texture.jpg"; if (FileExists(defaultEarthTexture)) { TextureMaterialEarth->Texture->LoadFromFile(defaultEarthTexture); } String defaultSunTexture = "sun_texture.jpg"; if (FileExists(defaultSunTexture)) { TextureMaterialSource1->Texture->LoadFromFile(defaultSunTexture); } } //---------------------------------------------------------------------------