ParticleMaterial Class
Namespace: Stride.Particles.MaterialsAssembly: Stride.Particles.dll
Base class for the particle materials which uses a dynamic effect compiler to generate shaders at runtime
[DataContract("ParticleMaterial")]
public abstract class ParticleMaterial
Name | Description | |
---|---|---|
Fields | ||
Parameters | ||
Properties | ||
EffectName | Sets the name of the effect or shader which the material will use |
|
HasVertexLayoutChanged | Indicates if the vertex layout required by this material has changed since the last time UpdateVertexBuilder(ParticleVertexBuilder) was called |
|
IsInitialized | True if InitializeCore(RenderContext) has been called |
|
Methods | ||
ForceUpdate() | Forces the material update, potentionally recreating the effect |
|
InitializeCore(RenderContext) | Initializes the core of the material, such as the shader generator and the parameter collection |
|
PatchVertexBuffer(ref ParticleBufferState, Vector3, Vector3, ref ParticleList) | Patch the particle's vertex buffer which was already built by the ShapeBuilder This involes animating hte uv coordinates and filling per-particle fields, such as the color field |
|
PrepareVertexLayout(ParticlePoolFieldsList) | Prepares the material for drawing the current frame with the current ParticleVertexBuilder and |
|
Setup(RenderContext) | Setups the current material using the graphics device. |
|
SetupPipeline(RenderContext, PipelineStateDescription) | Setup the pipeline state object. |
|
UpdateVertexBuilder(ParticleVertexBuilder) | Updates the required fields for this frame in the vertex buffer builder. If nothing has changed since the last frame and the vertex layout is the same, do not add any new required fields |
|
ValidateEffect(RenderContext, ref EffectValidator) |
Fields
Parameters
public readonly ParameterCollection Parameters
Field Value
Type | Description |
---|---|
ParameterCollection |
Properties
EffectName
Sets the name of the effect or shader which the material will use
public abstract string EffectName { get; protected set; }
Property Value
Type | Description |
---|---|
System.String |
HasVertexLayoutChanged
Indicates if the vertex layout required by this material has changed since the last time UpdateVertexBuilder(ParticleVertexBuilder) was called
public bool HasVertexLayoutChanged { get; protected set; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsInitialized
True if InitializeCore(RenderContext) has been called
protected bool IsInitialized { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
ForceUpdate()
Forces the material update, potentionally recreating the effect
public virtual void ForceUpdate()
InitializeCore(RenderContext)
Initializes the core of the material, such as the shader generator and the parameter collection
protected virtual void InitializeCore(RenderContext context)
Parameters
Type | Name | Description |
---|---|---|
RenderContext | context | The current RenderContext |
PatchVertexBuffer(ref ParticleBufferState, Vector3, Vector3, ref ParticleList)
Patch the particle's vertex buffer which was already built by the ShapeBuilder This involes animating hte uv coordinates and filling per-particle fields, such as the color field
public virtual void PatchVertexBuffer(ref ParticleBufferState bufferState, Vector3 invViewX, Vector3 invViewY, ref ParticleList sortedList)
Parameters
Type | Name | Description |
---|---|---|
ParticleBufferState | bufferState | The particle buffer state which is used to build the assigned vertex buffer |
Vector3 | invViewX | Unit vector X (right) in camera space, extracted from the inverse view matrix |
Vector3 | invViewY | Unit vector Y (up) in camera space, extracted from the inverse view matrix |
ParticleList | sortedList |
PrepareVertexLayout(ParticlePoolFieldsList)
Prepares the material for drawing the current frame with the current ParticleVertexBuilder and
public virtual void PrepareVertexLayout(ParticlePoolFieldsList fieldsList)
Parameters
Type | Name | Description |
---|---|---|
ParticlePoolFieldsList | fieldsList | A container for the ParticlePool which can poll if a certain field exists as an attribute |
Setup(RenderContext)
Setups the current material using the graphics device.
public virtual void Setup(RenderContext context)
Parameters
Type | Name | Description |
---|---|---|
RenderContext | context |
SetupPipeline(RenderContext, PipelineStateDescription)
Setup the pipeline state object.
public virtual void SetupPipeline(RenderContext renderContext, PipelineStateDescription pipelineState)
Parameters
Type | Name | Description |
---|---|---|
RenderContext | renderContext | |
PipelineStateDescription | pipelineState |
UpdateVertexBuilder(ParticleVertexBuilder)
Updates the required fields for this frame in the vertex buffer builder. If nothing has changed since the last frame and the vertex layout is the same, do not add any new required fields
public virtual void UpdateVertexBuilder(ParticleVertexBuilder vertexBuilder)
Parameters
Type | Name | Description |
---|---|---|
ParticleVertexBuilder | vertexBuilder | The target vertex buffer builder |
ValidateEffect(RenderContext, ref EffectValidator)
public virtual void ValidateEffect(RenderContext context, ref EffectValidator effectValidator)
Parameters
Type | Name | Description |
---|---|---|
RenderContext | context | |
EffectValidator | effectValidator |