Class ParticleMaterial
Base class for the particle materials which uses a dynamic effect compiler to generate shaders at runtime
[DataContract("ParticleMaterial")]
public abstract class ParticleMaterial
- Inheritance
-
ParticleMaterial
- Derived
Fields
Parameters
public readonly ParameterCollection Parameters
Field Value
Properties
EffectName
Sets the name of the effect or shader which the material will use
public abstract string EffectName { get; protected set; }
Property Value
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
IsInitialized
True if InitializeCore(RenderContext) has been called
protected bool IsInitialized { get; }
Property Value
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
context
RenderContextThe 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
bufferState
ParticleBufferStateThe particle buffer state which is used to build the assigned vertex buffer
invViewX
Vector3Unit vector X (right) in camera space, extracted from the inverse view matrix
invViewY
Vector3Unit vector Y (up) in camera space, extracted from the inverse view matrix
sortedList
ParticleList
PrepareVertexLayout(ParticlePoolFieldsList)
Prepares the material for drawing the current frame with the current ParticleVertexBuilder and ParticleList
public virtual void PrepareVertexLayout(ParticlePoolFieldsList fieldsList)
Parameters
fieldsList
ParticlePoolFieldsListA 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
context
RenderContext
SetupPipeline(RenderContext, PipelineStateDescription)
Setup the pipeline state object.
public virtual void SetupPipeline(RenderContext renderContext, PipelineStateDescription pipelineState)
Parameters
renderContext
RenderContextpipelineState
PipelineStateDescription
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
vertexBuilder
ParticleVertexBuilderThe target vertex buffer builder
ValidateEffect(RenderContext, ref EffectValidator)
public virtual void ValidateEffect(RenderContext context, ref EffectValidator effectValidator)
Parameters
context
RenderContexteffectValidator
EffectValidator