Class SpriteMaterial
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
textureTexture
Properties
ID
The unique identifier of the material.
public Guid ID { get; }
Property Value
IsInitialized
Gets a value indicating whether the object has been initialized.
public bool IsInitialized { get; }
Property Value
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
Name
The name of the material.
public string Name { get; set; }
Property Value
Texture
The texture of the material.
public Texture Texture { get; set; }
Property Value
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
objJObjectcontextSerializationContextcallbackFunc<JObject, bool>
Disable(IRenderDevice)
Disables the specified render device, releasing any resources or state associated with it.
public void Disable(IRenderDevice renderDevice)
Parameters
renderDeviceIRenderDeviceThe 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
renderDeviceIRenderDevice
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
renderDeviceIRenderDevice
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
asmatMaterialThe Assimp material to attempt to load. This parameter is not supported and will always cause the method to throw.
directorystringThe 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
writerJsonWritercontextSerializationContextThe serialization context that provides settings and state for the serialization process.
callbackAction<JsonWriter>
Use(IRenderDevice)
Sets the material as the current material for rendering. No-op for SpriteMaterial.
public void Use(IRenderDevice renderDevice)
Parameters
renderDeviceIRenderDevice