Class BaseMaterial
Base material class.
Inherited Members
Namespace: Evergine.Framework.Graphics
Assembly: Evergine.Framework.dll
Syntax
public abstract class BaseMaterial : DisposableObject
Constructors
BaseMaterial(Effect)
Initializes a new instance of the BaseMaterial class.
Declaration
protected BaseMaterial(Effect effect)
Parameters
Type | Name | Description |
---|---|---|
Effect | effect | Effect instance. |
Fields
CBuffers
The constant buffers.
Declaration
public ConstantBuffer[] CBuffers
Field Value
Type | Description |
---|---|
ConstantBuffer[] |
CBuffersPerMaterial
The constant buffers managed by materials. Usually includes all constant buffers with None policy.
Declaration
public ConstantBuffer[] CBuffersPerMaterial
Field Value
Type | Description |
---|---|
ConstantBuffer[] |
MaterialResourcesCache
Dictionary containing ResourceLayout and ResourceSet pairs.
Declaration
public Dictionary<int, MaterialPassResources> MaterialResourcesCache
Field Value
Type | Description |
---|---|
Dictionary<int, MaterialPassResources> |
SamplerSlots
The array of texture slots.
Declaration
public SamplerSlot[] SamplerSlots
Field Value
Type | Description |
---|---|
SamplerSlot[] |
TextureSlots
The array of texture slots.
Declaration
public TextureSlot[] TextureSlots
Field Value
Type | Description |
---|---|
TextureSlot[] |
UABuffers
The unordered access buffers.
Declaration
public UnorderedAccessBuffer[] UABuffers
Field Value
Type | Description |
---|---|
UnorderedAccessBuffer[] |
activeDirectivesNames
The names of the active directives.
Declaration
protected string[] activeDirectivesNames
Field Value
Type | Description |
---|---|
string[] |
effect
The effect.
Declaration
protected Effect effect
Field Value
Type | Description |
---|---|
Effect |
graphicsContext
The graphics context.
Declaration
protected GraphicsContext graphicsContext
Field Value
Type | Description |
---|---|
GraphicsContext |
isDestroying
Indicates whether the material is being destroyed.
Declaration
protected bool isDestroying
Field Value
Type | Description |
---|---|
bool |
Properties
ActiveDirectivesNames
Gets or sets the active directives.
Declaration
public string[] ActiveDirectivesNames { get; set; }
Property Value
Type | Description |
---|---|
string[] |
Effect
Gets the effect.
Declaration
public Effect Effect { get; }
Property Value
Type | Description |
---|---|
Effect |
Methods
Destroy()
Destroys all resources of this instance.
Declaration
protected override void Destroy()
Overrides
FireMaterialStateChanged()
Material needs to be updated.
Declaration
protected void FireMaterialStateChanged()
FireRenderLayerStateChanged(object, EventArgs)
The render layer was changed, so the material needs to be updated.
Declaration
protected void FireRenderLayerStateChanged(object sender, EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
object | sender | Sender object. |
EventArgs | e | Event args. |
GetMaterialPassResources(string, bool)
Gets the material resources associated with the specified pass name. If the specified passName does not exist in the material effect, returns null. (Optional) If required, add a more restrictive condition; it indicates whether the pass exists and is necessary.
Declaration
public MaterialPassResources GetMaterialPassResources(string passName, bool required = false)
Parameters
Type | Name | Description |
---|---|---|
string | passName | Pass name. |
bool | required | If the pass exists and it is required with the current active directives, or only if the pass exists. |
Returns
Type | Description |
---|---|
MaterialPassResources | The material pass resources, or null if the passName doesn't exist. |
GetMaterialResources(string[], string, bool)
Gets the material resources associated with the specified pass name. If the specified passName does not exist in the material effect, returns null. (Optional) If required, add a more restrictive condition that indicates whether the pass exists and is necessary.
Declaration
public MaterialPassResources GetMaterialResources(string[] activeDirectiveNames, string passName, bool required = false)
Parameters
Type | Name | Description |
---|---|---|
string[] | activeDirectiveNames | The active directive names. |
string | passName | Pass name. |
bool | required | If the pass exists and is required with the current active directives or only if the pass exists. |
Returns
Type | Description |
---|---|
MaterialPassResources | The material pass resources, or null if the passName doesn't exist. |
InitilizeEffect(Effect)
Initializes material with effect resources.
Declaration
protected virtual void InitilizeEffect(Effect effect)
Parameters
Type | Name | Description |
---|---|---|
Effect | effect | Effect instance. |
IsPassRequiredWithActiveDirectives(string)
Checks if the pass is required with the current directives.
Declaration
protected bool IsPassRequiredWithActiveDirectives(string passName)
Parameters
Type | Name | Description |
---|---|---|
string | passName | The pass name. |
Returns
Type | Description |
---|---|
bool | Whether the pass is required. |
Prepare(CommandBuffer)
Prepares this material.
Declaration
public void Prepare(CommandBuffer commandBuffer)
Parameters
Type | Name | Description |
---|---|---|
CommandBuffer | commandBuffer | The command buffer. |
SetParameterValue(string, Type, byte[])
Sets the parameter value.
Declaration
public void SetParameterValue(string parameterName, Type parameterType, byte[] valueByteArray)
Parameters
Type | Name | Description |
---|---|---|
string | parameterName | The name of the parameter. |
Type | parameterType | The type of the parameter. |
byte[] | valueByteArray | The parameter value (byte array). |
SetSBuffer(Buffer, int)
Sets the StructuredBuffer to the specified slot.
Declaration
public void SetSBuffer(Buffer sbuffer, int slot)
Parameters
Type | Name | Description |
---|---|---|
Buffer | sbuffer | The StructuredBuffer. |
int | slot | The StructuredBuffer slot. |
SetSBufferValue(Buffer, string)
Sets the structured buffer value.
Declaration
public void SetSBufferValue(Buffer sbufferValue, string sbufferName)
Parameters
Type | Name | Description |
---|---|---|
Buffer | sbufferValue | StructuredBuffer instance. |
string | sbufferName | StructuredBuffer name. |
SetSampler(SamplerState, int)
Sets the sampler to the specified slot.
Declaration
public virtual void SetSampler(SamplerState sampler, int slot)
Parameters
Type | Name | Description |
---|---|---|
SamplerState | sampler | The sampler. |
int | slot | The sampler slot. |
SetSamplerValue(SamplerState, string)
Sets the sampler value.
Declaration
public void SetSamplerValue(SamplerState samplerValue, string samplerName)
Parameters
Type | Name | Description |
---|---|---|
SamplerState | samplerValue | Sampler instance. |
string | samplerName | Sampler name. |
SetTexture(Texture, int)
Sets a texture to the specified slot.
Declaration
public virtual void SetTexture(Texture texture, int slot)
Parameters
Type | Name | Description |
---|---|---|
Texture | texture | The texture. |
int | slot | The texture's slot. |
SetTextureValue(Texture, string)
Sets the texture value.
Declaration
public void SetTextureValue(Texture textureValue, string textureName)
Parameters
Type | Name | Description |
---|---|---|
Texture | textureValue | The texture instance. |
string | textureName | The texture name. |
SetUABuffer(Buffer, int)
Sets the Unordered Access Buffer to the specified slot.
Declaration
public void SetUABuffer(Buffer uabuffer, int slot)
Parameters
Type | Name | Description |
---|---|---|
Buffer | uabuffer | The Unordered Access Buffer. |
int | slot | The Unordered Access Buffer slot. |
SetUABufferValue(Buffer, string)
Sets the UABuffer value.
Declaration
public void SetUABufferValue(Buffer uaBufferValue, string uaBufferName)
Parameters
Type | Name | Description |
---|---|---|
Buffer | uaBufferValue | The UABuffer value. |
string | uaBufferName | The UABuffer name. |
SetUATexture(Texture, int)
Sets Unordered Access Texture to the specified slot.
Declaration
public void SetUATexture(Texture uaTexture, int slot)
Parameters
Type | Name | Description |
---|---|---|
Texture | uaTexture | RWTexture1D, RWTexture1DArray, RWTexture2D, RWTexture2DArray, RWTexture3D. |
int | slot | The unordered access slot. |
Events
MaterialStateChanged
Event fired when the material state changes.
Declaration
public event EventHandler MaterialStateChanged
Event Type
Type | Description |
---|---|
EventHandler |