Table of Contents

Class Skybox

Namespace
LibGFX.Graphics.Enviroment
Assembly
LibGFX.dll

Represents a skybox environment that renders a surrounding cubemap in a 3D scene.

public class Skybox : IEnviroment, IGraphicsResource, ISerialization
Inheritance
Skybox
Implements
Inherited Members

Remarks

A skybox is typically used to simulate distant backgrounds such as skies or space by rendering a textured cube around the camera. The Skybox class manages the cubemap texture and its transformation, and provides methods to initialize, render, and dispose of the skybox resources. The skybox automatically follows the camera's position to maintain the illusion of an infinitely distant environment.

Constructors

Skybox(Cubemap)

Initializes a new instance of the Skybox class using the specified cubemap texture.

public Skybox(Cubemap cubemap)

Parameters

cubemap Cubemap

The cubemap texture to use for rendering the skybox. Cannot be null.

Properties

Cubemap

Gets or sets the cubemap texture used for rendering or environment mapping.

public Cubemap Cubemap { get; set; }

Property Value

Cubemap

IsInitialized

Gets a value indicating whether the object has been initialized.

public bool IsInitialized { get; }

Property Value

bool

Transform

Gets or sets the transformation applied to the object, including position, rotation, and scale.

public Transform Transform { get; set; }

Property Value

Transform

Methods

Deserialize(JObject, SerializationContext, Func<JObject, bool>)

Populates the current object with values from the specified JSON object.

public void Deserialize(JObject obj, SerializationContext serializationContext, Func<JObject, bool> callback = null)

Parameters

obj JObject
serializationContext SerializationContext
callback Func<JObject, bool>

Dispose(IRenderDevice)

Releases all resources used by the cubemap using the specified render device.

public void Dispose(IRenderDevice renderer)

Parameters

renderer IRenderDevice

The render device to use when disposing of the cubemap resources. Cannot be null.

FreeCPUResources()

Releases any CPU resources that are currently allocated by the component.

public void FreeCPUResources()

Remarks

Call this method when the component no longer needs to perform CPU-intensive operations to allow the system to reclaim resources. After calling this method, the component may not be able to perform certain operations until resources are reallocated.

Init(IRenderDevice)

Initializes the cubemap resources using the specified render device.

public void Init(IRenderDevice renderer)

Parameters

renderer IRenderDevice

The render device to use for initializing cubemap resources. Cannot be null.

Render(IRenderDevice, Camera, Viewport)

Renders the environment cubemap using the specified renderer, camera, and viewport.

public void Render(IRenderDevice renderer, Camera camera, Viewport viewport)

Parameters

renderer IRenderDevice

The rendering device used to draw the cubemap. Must not be null.

camera Camera

The camera that defines the viewpoint and position for rendering. Must not be null.

viewport Viewport

The viewport that specifies the area of the render target to draw to.

Serialize(JsonWriter, SerializationContext, Action<JsonWriter>)

Serializes the current object to a JSON representation using the specified serialization context.

public void Serialize(JsonWriter writer, SerializationContext serializationContext, Action<JsonWriter> callback = null)

Parameters

writer JsonWriter
serializationContext SerializationContext

The context to use during serialization, which may provide settings or state required for the serialization process.

callback Action<JsonWriter>