fcHeightmap.cpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //---------------------------------------------------------------------------
  2. #include <fmx.h>
  3. #pragma hdrstop
  4. #include "fcHeightmap.h"
  5. //---------------------------------------------------------------------------
  6. #pragma package(smart_init)
  7. #pragma link "GBE.Heightmap"
  8. #pragma resource "*.fmx"
  9. TFormHeightmap *FormHeightmap;
  10. //---------------------------------------------------------------------------
  11. __fastcall TFormHeightmap::TFormHeightmap(TComponent* Owner)
  12. : TForm(Owner)
  13. {
  14. }
  15. //---------------------------------------------------------------------------
  16. void __fastcall TFormHeightmap::FormCreate(TObject *Sender)
  17. {
  18. TMemoryStream *Stream;
  19. Stream = new TMemoryStream();
  20. Image1->Bitmap->SaveToStream(Stream);
  21. GBEHeightmap1->LoadHeightmapFromStream(Stream);
  22. Stream->Free();
  23. }
  24. //---------------------------------------------------------------------------
  25. void __fastcall TFormHeightmap::FloatAnimation2Process(TObject *Sender)
  26. {
  27. Cylinder1->Position->Y = GBEHeightmap1->GetHeight(Cylinder1->Position->Point);
  28. }
  29. //---------------------------------------------------------------------------
  30. void __fastcall TFormHeightmap::SwitchToLinesSwitch(TObject *Sender)
  31. {
  32. GBEHeightmap1->ShowLines = SwitchToLines->IsChecked;
  33. }
  34. //---------------------------------------------------------------------------
  35. void __fastcall TFormHeightmap::SwitchToRampSwitch(TObject *Sender)
  36. {
  37. if (SwitchToRamp->IsChecked)
  38. GBEHeightmap1->MaterialSource = LightMaterialSource3;
  39. else
  40. GBEHeightmap1->MaterialSource = LightMaterialSource1;
  41. GBEHeightmap1->UseRamp = SwitchToRamp->IsChecked;
  42. }
  43. //---------------------------------------------------------------------------
  44. void __fastcall TFormHeightmap::SpinBoxBlurChange(TObject *Sender)
  45. {
  46. GBEHeightmap1->Flou = trunc(SpinBoxBlur->Value);
  47. }
  48. //---------------------------------------------------------------------------