Table of Contents

Class SpriteMaterial

Namespace
LibGFX.Graphics.Materials
Assembly
LibGFX.dll

Represents a material used in rendering.

public class SpriteMaterial : IMaterial, IGraphicsResource, IIdentifier, ISerialization
Inheritance
SpriteMaterial
Implements
Inherited Members

Constructors

SpriteMaterial()

Default constructor for the SpriteMaterial class.

public SpriteMaterial()

SpriteMaterial(Texture)

Creates a new SpriteMaterial with the specified texture and shader.

public SpriteMaterial(Texture texture)

Parameters

texture Texture

Properties

ID

The unique identifier of the material.

public Guid ID { get; }

Property Value

Guid

IsInitialized

Gets a value indicating whether the object has been initialized.

public bool IsInitialized { get; }

Property Value

bool

IsTransparent

Gets a value indicating whether the object is transparent. TODO: If this get changed it need to get an setter and also update serialization for this property in all materials.

public bool IsTransparent { get; }

Property Value

bool

Name

The name of the material.

public string Name { get; set; }

Property Value

string

Texture

The texture of the material.

public Texture Texture { get; set; }

Property Value

Texture

Methods

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

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

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

Parameters

obj JObject
context SerializationContext
callback Func<JObject, bool>

Disable(IRenderDevice)

Disables the specified render device, releasing any resources or state associated with it.

public void Disable(IRenderDevice renderDevice)

Parameters

renderDevice IRenderDevice

The render device to disable. Cannot be null.

Dispose(IRenderDevice)

Disposes the material and releases any resources used by it.

public void Dispose(IRenderDevice renderDevice)

Parameters

renderDevice IRenderDevice

FreeCPUResources()

Frees any CPU resources used by the material.

public void FreeCPUResources()

Init(IRenderDevice)

Initializes the material and loads its resources.

public void Init(IRenderDevice renderDevice)

Parameters

renderDevice IRenderDevice

LoadMaterial(Material, string)

Throws an exception to indicate that loading materials from Assimp materials is not supported for SpriteMaterials.

public void LoadMaterial(Material asmat, string directory)

Parameters

asmat Material

The Assimp material to attempt to load. This parameter is not supported and will always cause the method to throw.

directory string

The directory path associated with the material. This parameter is not used.

Exceptions

NotSupportedException

Thrown in all cases to indicate that loading SpriteMaterials from Assimp materials is not supported.

Serialize(JsonWriter, SerializationContext, Action<JsonWriter>)

Serializes the current object to a Newtonsoft.Json.Linq.JObject representation suitable for JSON output.

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

Parameters

writer JsonWriter
context SerializationContext

The serialization context that provides settings and state for the serialization process.

callback Action<JsonWriter>

Use(IRenderDevice)

Sets the material as the current material for rendering. No-op for SpriteMaterial.

public void Use(IRenderDevice renderDevice)

Parameters

renderDevice IRenderDevice