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
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
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
ParticleBufferStateTarget particle buffer state, used to populate 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
spaceTranslation
Vector3Translation of the target draw space in regard to the particle data (world or local)
spaceRotation
QuaternionRotation of the target draw space in regard to the particle data (world or local)
spaceScale
floatUniform scale of the target draw space in regard to the particle data (world or local)
sorter
ParticleListParticle enumerator which can be iterated and returns sported particles
viewProj
MatrixThe View-Projection matrix which is used for some shape builders
Returns
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
ParticlepositionField
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
ParticleTarget 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()