Class Skybox
Axis-aligned sky cube. XZ follows the camera; Y sits on the ground
so the map is the floor. Six ordinary 2D textures,
NegY optional. Depth-write off, drawn first
inside BeginMode3D. See docs/architecture/skybox.md.
public sealed class Skybox : IDisposable
- Inheritance
-
Skybox
- Implements
- Inherited Members
Fields
Extent
Half-width of the cube in XZ. Height is 2 * Extent, sitting on
the ground — the map is the floor. Far clip must clear the ceiling
corners (~2.5 × Extent from a camera near the floor).
public const float Extent = 120
Field Value
GroundY
World Y of the cube floor. The map occupies this plane; −Y is omitted.
public const float GroundY = 0
Field Value
RecommendedFaceSize
Intended shipping face size. Author here; do not ship 2048 RGBA8.
public const int RecommendedFaceSize = 1024
Field Value
ShippingBc1Bytes
5 × 1024 BC1/DXT1. The format to ship once the pipeline compresses.
public const int ShippingBc1Bytes = 2621440
Field Value
WorstCaseRgba8Bytes
5 × 1024 RGBA8, the authoring worst case. Shipping is BC1 (~2.5 MB).
public const int WorstCaseRgba8Bytes = 20971520
Field Value
Methods
CreateTestDay()
Tiny in-memory day sky for samples. Sun is a disk on +Y — world up — so it cannot appear below the ground. Not shipping art; size is 64.
public static Skybox CreateTestDay()
Returns
CreateTestNight()
Tiny in-memory night sky. Moon on +Y. Same swap path a game uses for a real night set — replace the faces, no engine change.
public static Skybox CreateTestNight()
Returns
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Draw(Vector3)
Draw inside BeginMode3D, first, before world geometry. XZ
follows the camera so you never walk into a wall. Y sits on
GroundY — the map is the cube floor, the sun on +Y
is the ceiling.
public void Draw(Vector3 cameraPosition)
Parameters
cameraPositionVector3
FaceTexture(SkyboxFace)
public Texture2D? FaceTexture(SkyboxFace face)
Parameters
faceSkyboxFace
Returns
- Texture2D?
HasFace(SkyboxFace)
public bool HasFace(SkyboxFace face)
Parameters
faceSkyboxFace
Returns
LoadFace(SkyboxFace, string)
Load a png (or any raylib texture) for one face. This instance owns it.
public void LoadFace(SkyboxFace face, string path)
Parameters
faceSkyboxFacepathstring
SetFace(SkyboxFace, Texture2D?, bool)
Assign a face. Pass takeOwnership when this
instance should UnloadTexture it on Dispose().
public void SetFace(SkyboxFace face, Texture2D? texture, bool takeOwnership = false)
Parameters
faceSkyboxFacetextureTexture2D?takeOwnershipbool
SetFaces(Texture2D?, Texture2D?, Texture2D?, Texture2D?, Texture2D?, Texture2D?, bool)
Replace every face. The game swaps day/night by calling this (or LoadFace(SkyboxFace, string)) again — the engine has no time-of-day.
public void SetFaces(Texture2D? posX, Texture2D? negX, Texture2D? posY, Texture2D? negY, Texture2D? posZ, Texture2D? negZ, bool takeOwnership = false)
Parameters
posXTexture2D?negXTexture2D?posYTexture2D?negYTexture2D?posZTexture2D?negZTexture2D?takeOwnershipbool