Class BaseMaterial
Base Material class.
Implements
Inherited Members
Namespace: Evergine.Framework.Graphics
Assembly: Evergine.Framework.dll
Syntax
public abstract class BaseMaterial : DisposableObject, IDisposable
  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 cbuffers with None policy.
Declaration
public ConstantBuffer[] CBuffersPerMaterial
  Field Value
| Type | Description | 
|---|---|
| ConstantBuffer[] | 
MaterialResourcesCache
Dictionary with ResourceLayout and ResourceSet pairs.
Declaration
public Dictionary<int, MaterialPassResources> MaterialResourcesCache
  Field Value
| Type | Description | 
|---|---|
| Dictionary<int, MaterialPassResources> | 
SamplerSlots
The texture slots array.
Declaration
public SamplerSlot[] SamplerSlots
  Field Value
| Type | Description | 
|---|---|
| SamplerSlot[] | 
TextureSlots
The texture slots array.
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 active directive names.
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 destroying.
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()
Destroy all resources of this instance.
Declaration
protected override void Destroy()
  Overrides
FireMaterialStateChanged()
Material need to be updated.
Declaration
protected void FireMaterialStateChanged()
  FireRenderLayerStateChanged(object, EventArgs)
Render layer was changed so Material need 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 to the specified pass name. If the specified passName does not exist in the material effect, return null. (Optional) IfRequired add a more restrictive condition, it indicates whether the pass exists and it is necessary.
Declaration
public MaterialPassResources GetMaterialPassResources(string passName, bool ifRequired = false)
  Parameters
| Type | Name | Description | 
|---|---|---|
| string | passName | Pass Name.  | 
      
| bool | ifRequired | 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 doens't exist.  | 
      
GetMaterialResources(string[], string, bool)
Gets the material resources associated to the specified pass name. If the specified passName does not exist in the material effect, return null. (Optional) IfRequired add a more restrictive condition, it indicates whether the pass exists and it is necessary.
Declaration
public MaterialPassResources GetMaterialResources(string[] activeDirectiveNames, string passName, bool ifRequired = false)
  Parameters
| Type | Name | Description | 
|---|---|---|
| string[] | activeDirectiveNames | The active directive names.  | 
      
| string | passName | Pass Name.  | 
      
| bool | ifRequired | 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 doens't exist.  | 
      
InitilizeEffect(Effect)
Initialize 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 | If the pass is required.  | 
      
Prepare(CommandBuffer)
Prepare 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 | Parameter name.  | 
      
| Type | parameterType | Parameter type.  | 
      
| byte[] | valueByteArray | Parameter value (byteArray).  | 
      
SetSBuffer(Buffer, int)
Set 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 structuredBuffer value.
Declaration
public void SetSBufferValue(Buffer sbufferValue, string sbufferName)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Buffer | sbufferValue | StructuredBuffer instance.  | 
      
| string | sbufferName | StructuredBuffer Name.  | 
      
SetSampler(SamplerState, int)
Set 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 slot.  | 
      
SetTextureValue(Texture, string)
Sets the texture value.
Declaration
public void SetTextureValue(Texture textureValue, string textureName)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Texture | textureValue | Texture instance.  | 
      
| string | textureName | Texture Name.  | 
      
SetUABuffer(Buffer, int)
Set 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 | UABuffer value.  | 
      
| string | uaBufferName | UABuffer name.  | 
      
SetUATexture(Texture, int)
Set 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 material state is changed.
Declaration
public event EventHandler MaterialStateChanged
  Event Type
| Type | Description | 
|---|---|
| EventHandler |