Table of Contents

Class ShapeBuilderCommon

Namespace
Stride.Particles.ShapeBuilders
Assembly
Stride.Particles.dll

The common shape builder provides additive animation for the particle's position and size fields, assuming that all derived shape builders will have position and size fields

[DataContract("ShapeBuilderCommon")]
public abstract class ShapeBuilderCommon : ShapeBuilder
Inheritance
ShapeBuilderCommon
Derived
Inherited Members

Properties

SamplerPosition

Additive animation for the particle position. If present, particle's own position will be added to the sampled curve value

[DataMember(100)]
[Display("Additive Position Animation", null)]
public ComputeCurveSampler<Vector3> SamplerPosition { get; set; }

Property Value

ComputeCurveSampler<Vector3>

SamplerSize

Additive animation for the particle size. If present, particle's own size will be multiplied with the sampled curve value

[DataMember(200)]
[Display("Additive Size Animation", null)]
public ComputeCurveSampler<float> SamplerSize { get; set; }

Property Value

ComputeCurveSampler<float>

Methods

BuildVertexBuffer(ref ParticleBufferState, Vector3, Vector3, ref Vector3, ref Quaternion, float, ref ParticleList, ref Matrix)

Builds the actual vertex buffer for the current frame using the particle data

public override int BuildVertexBuffer(ref ParticleBufferState bufferState, Vector3 invViewX, Vector3 invViewY, ref Vector3 spaceTranslation, ref Quaternion spaceRotation, float spaceScale, ref ParticleList sorter, ref Matrix viewProj)

Parameters

bufferState ParticleBufferState

Target particle buffer state, used to populate the assigned vertex buffer

invViewX Vector3

Unit vector X (right) in camera space, extracted from the inverse view matrix

invViewY Vector3

Unit vector Y (up) in camera space, extracted from the inverse view matrix

spaceTranslation Vector3

Translation of the target draw space in regard to the particle data (world or local)

spaceRotation Quaternion

Rotation of the target draw space in regard to the particle data (world or local)

spaceScale float

Uniform scale of the target draw space in regard to the particle data (world or local)

sorter ParticleList

Particle enumerator which can be iterated and returns sported particles

viewProj Matrix

The View-Projection matrix which is used for some shape builders

Returns

int

GetParticlePosition(Particle, ParticleFieldAccessor<Vector3>, ParticleFieldAccessor<float>)

Gets the combined position for the particle, adding its field value (if any) to its sampled value from the curve

protected Vector3 GetParticlePosition(Particle particle, ParticleFieldAccessor<Vector3> positionField, ParticleFieldAccessor<float> lifeField)

Parameters

particle Particle
positionField ParticleFieldAccessor<Vector3>
lifeField ParticleFieldAccessor<float>

Normalized life for sampling

Returns

Vector3

Particle's current 3D position

GetParticleSize(Particle, ParticleFieldAccessor<float>, ParticleFieldAccessor<float>)

Gets the combined size for the particle, adding its field value (if any) to its sampled value from the curve

protected float GetParticleSize(Particle particle, ParticleFieldAccessor<float> sizeField, ParticleFieldAccessor<float> lifeField)

Parameters

particle Particle

Target particle

sizeField ParticleFieldAccessor<float>

Size field accessor

lifeField ParticleFieldAccessor<float>

Normalized life for sampling

Returns

float

Particle's current uniform size

PreUpdate()

public override void PreUpdate()