Table of Contents

Class ParticleVertexBuilder

Namespace
Stride.Particles.VertexLayouts
Assembly
Stride.Particles.dll

Manager class for the vertex buffer stream which can dynamically change the required vertex layout and rebuild the buffer based on the particle fields

public class ParticleVertexBuilder
Inheritance
ParticleVertexBuilder

Constructors

ParticleVertexBuilder()

Default constructor

public ParticleVertexBuilder()

Fields

IndicesPerQuad

public readonly int IndicesPerQuad

Field Value

int

Properties

DefaultTexCoords

The default texture coordinates will default to the first texture coordinates element added to the list in case there are two or more sets

public AttributeDescription DefaultTexCoords { get; }

Property Value

AttributeDescription

IsBufferDirty

public bool IsBufferDirty { get; }

Property Value

bool

LivingQuads

public int LivingQuads { get; }

Property Value

int

MaxParticles

public int MaxParticles { get; }

Property Value

int

VertexCount

The current number of vertices which have to be drawn

public int VertexCount { get; }

Property Value

int

VertexDeclaration

The current VertexDeclaration of the contained vertex buffer

public VertexDeclaration VertexDeclaration { get; }

Property Value

VertexDeclaration

VerticesPerParticle

public int VerticesPerParticle { get; }

Property Value

int

Methods

AddVertexElement(VertexElement)

Adds a new required element to the list of vertex elements, if it's not in the list already

public void AddVertexElement(VertexElement element)

Parameters

element VertexElement

New element to add

Reset()

Resets the ParticleVertexBuilder to its initial state, freeing any graphics memory used

public void Reset()

ResetVertexElementList()

Resets the list of required vertex elements, setting it to the minimum mandatory length

public void ResetVertexElementList()

SetDirty(bool)

public void SetDirty(bool dirty)

Parameters

dirty bool

SetRequiredQuads(int, int, int)

Sets the required quads per particle and number of particles so that a sufficiently big buffer can be allocated

public void SetRequiredQuads(int quadsPerParticle, int livingParticles, int totalParticles)

Parameters

quadsPerParticle int

Required quads per particle, assuming 1 quad = 4 vertices = 6 indices

livingParticles int

Number of living particles this frame

totalParticles int

Number of total number of possible particles for the parent emitter

UpdateVertexLayout()

Updates the vertex layout with the new list. Should be called only when there have been changes to the list.

public void UpdateVertexLayout()