Table of Contents

Class ParticlePool

Namespace
PopcorningGuineaPig.Engine.Rendering
Assembly
PopcorningGuineaPig.Engine.dll

Fixed CPU billboard pool. Technique from Banqi CaptureVfx and Sven ParticlePool. No per-particle heap, no Box3D, no PGPSCN nodes.

public sealed class ParticlePool
Inheritance
ParticlePool
Inherited Members

Constructors

ParticlePool(int, int?)

public ParticlePool(int capacity = 384, int? seed = null)

Parameters

capacity int
seed int?

Fields

DefaultCapacity

public const int DefaultCapacity = 384

Field Value

int

Properties

ActiveCount

public int ActiveCount { get; }

Property Value

int

Capacity

public int Capacity { get; }

Property Value

int

Methods

Clear()

public void Clear()

CreateHardTexture(int)

Hard disc with ~1.5 px AA rim — for blood droplets / gib chunks that must not read as smoke (soft radial). White RGB so tint carries the color.

public static Texture2D CreateHardTexture(int size = 64)

Parameters

size int

Returns

Texture2D

CreateSoftTexture()

Runtime 64² radial falloff. Games with their own sprites skip this.

public static Texture2D CreateSoftTexture()

Returns

Texture2D

Draw(Camera3D)

public void Draw(Camera3D camera)

Parameters

camera Camera3D

Emit(in Particle)

One fully-specified mote. Games use this for their own recipes.

public void Emit(in Particle particle)

Parameters

particle Particle

Emit(int, Vector3, in ParticleConfig)

Burst. Each mote samples config independently.

public void Emit(int count, Vector3 at, in ParticleConfig config)

Parameters

count int
at Vector3
config ParticleConfig

EmitPerSecond(ref float, float, float, Vector3, in ParticleConfig)

Rate emitter. Caller owns accumulator so many emitters can share one pool without the pool allocating a list of rates.

public void EmitPerSecond(ref float accumulator, float dt, float perSecond, Vector3 at, in ParticleConfig config)

Parameters

accumulator float
dt float
perSecond float
at Vector3
config ParticleConfig

RemoveTagged(byte)

Drop every mote whose Tag equals tag.

public void RemoveTagged(byte tag)

Parameters

tag byte

Update(float)

public void Update(float dt)

Parameters

dt float