Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    ShapeBuilder Class

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

    The ShapeBuilder base class is responsible for generating shapes (procedural mesh) ready for rendering from the particle data

    System.Object → ShapeBuilder
    Derived from ShapeBuilder: ShapeBuilderCommon ShapeBuilderRibbon ShapeBuilderTrail

    [DataContract("ShapeBuilder")]
    public abstract class ShapeBuilder
    Name Description
    Properties
    QuadsPerParticle

    Returns the number of quads required per particle to draw all particles. Assuming 1 Quad = 4 Vertices = 6 Indices

    VertexLayoutHasChanged

    Indicates that the required vertex layout has changed and UpdateVertexBuilder(ParticleVertexBuilder) should be called

    Methods
    BuildVertexBuffer(ref ParticleBufferState, Vector3, Vector3, ref Vector3, ref Quaternion, Single, ref ParticleList, ref Matrix)

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

    Circumcenter(ref Vector3, ref Vector3, ref Vector3)

    Finds the circumcenter coordinates for triangle ABC

    PrepareVertexLayout(ParticlePoolFieldsList)

    Check if ParticleVertexElements should be changed and set HasVertexLayoutChanged = true; if they do

    PreUpdate()
    SetRequiredQuads(Int32, Int32, Int32)

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

    UpdateVertexBuilder(ParticleVertexBuilder)

    Should be invoked if the VertexLayoutHasChanged was true so that new layout fields can be added to the buffer builder

    | Improve this Doc View Source

    Properties


    QuadsPerParticle

    Returns the number of quads required per particle to draw all particles. Assuming 1 Quad = 4 Vertices = 6 Indices

    public abstract int QuadsPerParticle { get; protected set; }
    Property Value
    Type Description
    System.Int32

    VertexLayoutHasChanged

    Indicates that the required vertex layout has changed and UpdateVertexBuilder(ParticleVertexBuilder) should be called

    public bool VertexLayoutHasChanged { get; protected set; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Methods


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

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

    public abstract int BuildVertexBuffer(ref ParticleBufferState bufferState, Vector3 invViewX, Vector3 invViewY, ref Vector3 spaceTranslation, ref Quaternion spaceRotation, float spaceScale, ref ParticleList sorter, ref Matrix viewProj)
    Parameters
    Type Name Description
    ParticleBufferState bufferState

    Target particle buffer state, used to populate 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

    Vector3 spaceTranslation

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

    Quaternion spaceRotation

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

    System.Single spaceScale

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

    ParticleList sorter

    Particle enumerator which can be iterated and returns sported particles

    Matrix viewProj

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

    Returns
    Type Description
    System.Int32

    Circumcenter(ref Vector3, ref Vector3, ref Vector3)

    Finds the circumcenter coordinates for triangle ABC

    public static Vector3 Circumcenter(ref Vector3 A, ref Vector3 B, ref Vector3 C)
    Parameters
    Type Name Description
    Vector3 A
    Vector3 B
    Vector3 C
    Returns
    Type Description
    Vector3

    PrepareVertexLayout(ParticlePoolFieldsList)

    Check if ParticleVertexElements should be changed and set HasVertexLayoutChanged = true; if they do

    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


    PreUpdate()

    public virtual void PreUpdate()

    SetRequiredQuads(Int32, Int32, Int32)

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

    public virtual void SetRequiredQuads(int quadsPerParticle, int livingParticles, int totalParticles)
    Parameters
    Type Name Description
    System.Int32 quadsPerParticle

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

    System.Int32 livingParticles

    Number of living particles this frame

    System.Int32 totalParticles

    Number of total number of possible particles for the parent emitter


    UpdateVertexBuilder(ParticleVertexBuilder)

    Should be invoked if the VertexLayoutHasChanged was true so that new layout fields can be added to the buffer builder

    public virtual void UpdateVertexBuilder(ParticleVertexBuilder vertexBuilder)
    Parameters
    Type Name Description
    ParticleVertexBuilder vertexBuilder

    Target vertex buffer stream builder which will be used for the current frame


    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation