Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
skybox [2019/03/12 13:03] – [Creating a skybox at runtime] adminskybox [2020/01/27 08:43] – [Creating a skybox at runtime] admin
Line 26: Line 26:
 uses uses
   FMX.UITypes,   FMX.UITypes,
-  Gorilla.Viewport;+  Gorilla.Viewport
 +  Gorilla.Context.Texturing;
  
 // in our form (TForm1) we added a field named "FGorilla" // in our form (TForm1) we added a field named "FGorilla"
Line 45: Line 46:
   LBmp := TBitmap.CreateFromFile(LCMPath + 'negz.jpg');   LBmp := TBitmap.CreateFromFile(LCMPath + 'negz.jpg');
   try   try
-    FSkyBox.Textures[TGorillaSkyBoxTexturePart.Front := LBmp;+    FSkyBox.Textures[TGorillaCubeMapFace.NegativeZ] := LBmp;
     LBmp.LoadFromFile(LCMPath + 'posz.jpg');     LBmp.LoadFromFile(LCMPath + 'posz.jpg');
-    FSkyBox.Textures[TGorillaSkyBoxTexturePart.Back  := LBmp; +    FSkyBox.Textures[TGorillaCubeMapFace.PositiveZ] := LBmp;
-    LBmp.LoadFromFile(LCMPath + 'posy.jpg'); +
-    FSkyBox.Textures[TGorillaSkyBoxTexturePart.Top]    := LBmp;+
     LBmp.LoadFromFile(LCMPath + 'negy.jpg');     LBmp.LoadFromFile(LCMPath + 'negy.jpg');
-    FSkyBox.Textures[TGorillaSkyBoxTexturePart.Bottom] := LBmp;+    FSkyBox.Textures[TGorillaCubeMapFace.NegativeY] := LBmp; 
 +    LBmp.LoadFromFile(LCMPath + 'posy.jpg'); 
 +    FSkyBox.Textures[TGorillaCubeMapFace.PositiveY] := LBmp;
     LBmp.LoadFromFile(LCMPath + 'negx.jpg');     LBmp.LoadFromFile(LCMPath + 'negx.jpg');
-    FSkyBox.Textures[TGorillaSkyBoxTexturePart.Left  := LBmp;+    FSkyBox.Textures[TGorillaCubeMapFace.NegativeX] := LBmp;
     LBmp.LoadFromFile(LCMPath + 'posx.jpg');     LBmp.LoadFromFile(LCMPath + 'posx.jpg');
-    FSkyBox.Textures[TGorillaSkyBoxTexturePart.Right := LBmp;+    FSkyBox.Textures[TGorillaCubeMapFace.PositiveX] := LBmp;
   finally   finally
     FreeAndNil(LBmp);     FreeAndNil(LBmp);
Line 61: Line 62:
 end; end;
 </file> </file>
-  +  
-**Due to complications in combining FMX and Gorilla3D on lower texture level, skybox implementation do not support real cubemap rendering at the moment.+Since v0.8.1.2510 skyboxes are rendered as 3D box with a real cubemap texture. 
 +(before only by 6 planes with simple 2D textures) 
 + 
 +===== DesignTime ===== 
 + 
 +Drag and drop the TGorillaSkyBox component onto your viewport and start by uploading 
 +the cubemap texture. This is done by loading all 6 faces of a box.
  
 +When downloading a precomputed skybox texture set, you will get 6 textures, which can be associated the following way:
  
-Skybox rendering is solved by six planes, which leads to tiny leaks at the border of each plane.**+^Property^Face^Common TextureName^ 
 +|FrontSide|TGorillaCubeMapFace.NegativeZ|negz.jpg| 
 +|BackSide|TGorillaCubeMapFace.PositiveZ|posz.jpg| 
 +|TopSide|TGorillaCubeMapFace.NegativeY|negy.jpg| 
 +|BottomSide|TGorillaCubeMapFace.PositiveY|posy.jpg| 
 +|LeftSide|TGorillaCubeMapFace.NegativeX|negx.jpg| 
 +|RightSide|TGorillaCubeMapFace.PositiveX|posx.jpg|
  
 Next step: [[particles|Particles]] Next step: [[particles|Particles]]