Table of Contents

Class Skybox

Namespace
PopcorningGuineaPig.Engine.Rendering
Assembly
PopcorningGuineaPig.Engine.dll

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

float

GroundY

World Y of the cube floor. The map occupies this plane; −Y is omitted.

public const float GroundY = 0

Field Value

float

RecommendedFaceSize

Intended shipping face size. Author here; do not ship 2048 RGBA8.

public const int RecommendedFaceSize = 1024

Field Value

int

ShippingBc1Bytes

5 × 1024 BC1/DXT1. The format to ship once the pipeline compresses.

public const int ShippingBc1Bytes = 2621440

Field Value

int

WorstCaseRgba8Bytes

5 × 1024 RGBA8, the authoring worst case. Shipping is BC1 (~2.5 MB).

public const int WorstCaseRgba8Bytes = 20971520

Field Value

int

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

Skybox

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

Skybox

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

cameraPosition Vector3

FaceTexture(SkyboxFace)

public Texture2D? FaceTexture(SkyboxFace face)

Parameters

face SkyboxFace

Returns

Texture2D?

HasFace(SkyboxFace)

public bool HasFace(SkyboxFace face)

Parameters

face SkyboxFace

Returns

bool

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

face SkyboxFace
path string

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

face SkyboxFace
texture Texture2D?
takeOwnership bool

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

posX Texture2D?
negX Texture2D?
posY Texture2D?
negY Texture2D?
posZ Texture2D?
negZ Texture2D?
takeOwnership bool