Table of Contents

Class Cubemap

Namespace
LibGFX.Graphics
Assembly
LibGFX.dll

Represents a cubemap texture

public class Cubemap : IGraphicsResource, ISerialization
Inheritance
Cubemap
Implements
Inherited Members

Constructors

Cubemap()

Creates a new cubemap

public Cubemap()

Properties

Faces

The faces of the cubemap

public List<byte[]> Faces { get; set; }

Property Value

List<byte[]>

Height

The height of the cubemap

public int Height { get; set; }

Property Value

int

IsInitialized

Gets a value indicating whether the object has been initialized and is ready for use.

public bool IsInitialized { get; }

Property Value

bool

TextureId

The OpenGL texture ID of the cubemap

public int TextureId { get; set; }

Property Value

int

Width

The width of the cubemap

public int Width { get; set; }

Property Value

int

Methods

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

Deserializes the object from a JSON representation.

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

Parameters

obj JObject
serializationContext SerializationContext
callback Func<JObject, bool>

Exceptions

InvalidOperationException

Dispose(IRenderDevice)

Releases resources associated with this cubemap using the specified render device.

public void Dispose(IRenderDevice renderer)

Parameters

renderer IRenderDevice

The render device used to dispose of the cubemap resources. Cannot be null.

Remarks

After calling this method, the cubemap is no longer initialized and should not be used in rendering operations.

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 by loading it into the specified render device.

public void Init(IRenderDevice renderer)

Parameters

renderer IRenderDevice

The render device used to load the cubemap. Cannot be null.

LoadCubemap(string, bool)

Loads a cubemap from a JSON file

public static Cubemap LoadCubemap(string file, bool swapYAxisFaces = true)

Parameters

file string
swapYAxisFaces bool

Returns

Cubemap

Exceptions

ArgumentException

LoadCubemap(string[], bool)

Loads a cubemap from the specified paths

public static Cubemap LoadCubemap(string[] paths, bool swapYAxisFaces = true)

Parameters

paths string[]
swapYAxisFaces bool

Returns

Cubemap

Exceptions

FileNotFoundException

Serialize(JsonWriter, SerializationContext, Action<JsonWriter>)

Serializes the current object to a JSON representation suitable for storage or transmission.

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

Parameters

writer JsonWriter
serializationContext SerializationContext

The context that provides information required for serialization. This parameter can be used to customize serialization behavior.

callback Action<JsonWriter>

Remarks

The returned JSON object includes the object's type, width, height, and an array of faces. Each face is represented as a Base64-encoded string. The structure of the output is intended for interoperability and persistence scenarios.