fcSkyShader.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include "fcSkyShader.h"
  5. //---------------------------------------------------------------------------
  6. #pragma package(smart_init)
  7. #pragma link "GLS.BaseClasses"
  8. #pragma link "GLS.Cadencer"
  9. #pragma link "GLS.Coordinates"
  10. #pragma link "GLS.GeomObjects"
  11. #pragma link "GLS.Objects"
  12. #pragma link "GLS.Texture"
  13. #pragma link "GLS.Scene"
  14. #pragma link "GLS.SceneViewer"
  15. #pragma resource "*.dfm"
  16. TFormSkyShader *FormSkyShader;
  17. //---------------------------------------------------------------------------
  18. __fastcall TFormSkyShader::TFormSkyShader(TComponent* Owner)
  19. : TForm(Owner)
  20. {
  21. }
  22. //---------------------------------------------------------------------------
  23. void __fastcall TFormSkyShader::FormCreate(TObject *Sender)
  24. {
  25. Path = GetCurrentAssetPath();
  26. // Loading a cubemap as TGLCompositeImage
  27. SetCurrentDir(Path + "\cubemap");
  28. Cubemap = new TGLTexture(this);
  29. LoadCubemap();
  30. Sky->Radius = Camera->DepthOfView;
  31. Sky->Material->Texture = Cubemap;
  32. Sphere->Material->Texture = Cubemap;
  33. Thor->Material->Texture = Cubemap;
  34. }
  35. //---------------------------------------------------------------------------
  36. void __fastcall TFormSkyShader::LoadCubemap()
  37. {
  38. Cubemap->ImageClassName = "TglCompositeImage";
  39. Cubemap->Image->LoadFromFile("skybox.dds");
  40. Cubemap->TextureWrap = twNone;
  41. Cubemap->FilteringQuality = tfAnisotropic;
  42. Cubemap->Disabled = False;
  43. }