Class ParticleSystemState
Namespace: ValveResourceFormat.Particles
Assembly: ValveResourceFormat.dll
Represents an entire particle system.
public class ParticleSystemStateInheritance
object ← ParticleSystemState
Constructors
ParticleSystemState(ParticleSystemState?)
Creates the state for one system.
public ParticleSystemState(ParticleSystemState? parentSystem = null)Parameters
parentSystem ParticleSystemState?
The state of the system running this one as a child.
Fields
ControlPointCount
How many control points a system holds. Functions clamp control point parameters to it, so the top of that range reads an unbound point.
public const int ControlPointCount = 64Field Value
int
Default
A state with no system behind it, read by functions evaluated outside a running system.
public static readonly ParticleSystemState DefaultField Value
MaxControlPoint
The highest control point index a system holds.
public const int MaxControlPoint = 63Field Value
int
Properties
Age
The system's clock, in seconds. It starts below zero for a delayed child, and sits at float.MinValue for an endcap child until its parent's endcap starts it.
public float Age { get; set; }Property Value
float
CameraPosition
World-space position of the render camera, updated once per simulation step.
public Vector3 CameraPosition { get; set; }Property Value
Collision
The world geometry the system's collision and ground placement trace against.
public IParticleCollision Collision { get; set; }Property Value
Data
The system this state belongs to. Null for ParticleSystemState.Default.
public ParticleSystemSimulation? Data { get; init; }Property Value
DetailLevel
Active particle detail tier, used by PF_TYPE_PARTICLE_DETAIL_LEVEL inputs and by the child systems' own m_nDetailLevel; child systems inherit the root system's tier.
public ParticleDetailLevel DetailLevel { get; set; }Property Value
EmissionStopped
Whether the system was told to stop emitting.
public bool EmissionStopped { get; }Property Value
bool
EndCapAge
How long the endcap has been running, or 0 outside it.
public float EndCapAge { get; }Property Value
float
EndCapStartAge
System age at which the endcap began, or float.MinValue when the system was stopped without one.
public float EndCapStartAge { get; }Property Value
float
Frozen
Whether simulation is held in place, with every system below it. Set by Operators.EndCapTimedFreeze and once the system outlives m_flStopSimulationAfterTime; a stop clears it.
public bool Frozen { get; set; }Property Value
bool
HighestControlPoint
The highest control point index any write has reached; some emitters scale their rate by it.
public int HighestControlPoint { get; }Property Value
int
InEndCap
Whether the system is playing its endcap, the phase an effect runs once it has been told to stop. Only functions whose m_nOpEndCapState allows it run in each phase, so an endcap swaps part of the operator list for another.
public bool InEndCap { get; }Property Value
bool
Lighting
The scene lighting
public IParticleLighting Lighting { get; set; }Property Value
ParentSystem
The state of the system running this one as a child, or null for a root system.
public ParticleSystemState? ParentSystem { get; }Property Value
ParticleCount
How many particles the system currently holds.
public long ParticleCount { get; set; }Property Value
long
Player
The local player, or null where there is none to find.
public IParticlePlayer? Player { get; set; }Property Value
RequestedAge
The real time the system has been asked to simulate, summed over its frames. A minimum time step makes ParticleSystemState.Age run ahead of it, and frames are skipped until it catches up.
public float RequestedAge { get; }Property Value
float
Root
The top of the tree this system belongs to.
public ParticleSystemState Root { get; }Property Value
SequenceDurations
Length in frames of each sequence of the sheet that animates this system's particles, indexed by sequence number. 0 for a number with no sequence, null when nothing the system draws carries a sheet. Set by whatever draws the system; C_INIT_SequenceLifeTime measures a particle's life against it.
public float[]? SequenceDurations { get; set; }Property Value
float[]?
StartedAge
Gets ParticleSystemState.Age, or 0 for an endcap child that has not started.
public float StartedAge { get; }Property Value
float
TimeScale
Multiplies every frame time handed to ParticleSystemSimulation.Update(float, float), 1 by default.
public float TimeScale { get; set; }Property Value
float
WorldTime
The renderer's clock, in seconds, as fed to the shaders' g_flTime. Unlike ParticleSystemState.Age it is shared by every system and survives a restart, so operators that use it to decorrelate repeat plays of an effect actually get a different sample each time. Child systems read the root's value.
public float WorldTime { get; set; }Property Value
float
Methods
GetControlPoint(int)
Gets one of this system's control points, creating it at its default on first use. An index outside 0 to ParticleSystemState.MaxControlPoint gives a detached point that nothing reads back.
public ControlPoint GetControlPoint(int cp)Parameters
cp int
The control point index.
Returns
GetControlPointModel(int)
Gets the model bound to a control point, or null when none is.
public Model? GetControlPointModel(int cp)Parameters
cp int
Returns
GetControlPointSnapshot(int)
Gets the snapshot bound to a control point, or null when none is.
public ParticleSnapshot? GetControlPointSnapshot(int cp)Parameters
cp int
Returns
SetControlPoint(int, ControlPoint)
Copies the position and orientation of point to control point cp of this system and every system below it. The attachment is copied to this system only.
public void SetControlPoint(int cp, ControlPoint point)Parameters
cp int
The control point index.
point ControlPoint
The control point to copy.
SetControlPointOrientation(int, Vector3)
Set the orientation of a control point from a forward direction alone; left and up are built around it.
public void SetControlPointOrientation(int cp, Vector3 orientation)Parameters
cp int
Control point index.
orientation Vector3
Forward direction to assign.
SetControlPointOrientation(int, Vector3, Vector3, Vector3)
Set the full orientation of a control point.
public void SetControlPointOrientation(int cp, Vector3 forward, Vector3 left, Vector3 up)Parameters
cp int
Control point index.
forward Vector3
The forward axis.
left Vector3
The left axis.
up Vector3
The up axis.
SetControlPointRotation(int, Quaternion)
Set the full rotation of a control point.
public void SetControlPointRotation(int cp, Quaternion rotation)Parameters
cp int
Control point index.
rotation Quaternion
Full rotation to assign.
SetControlPointValue(int, Vector3)
Set the value/position of a control point in the particle system.
public void SetControlPointValue(int cp, Vector3 position)Parameters
cp int
Control point index.
position Vector3
World-space position to assign.
SetControlPointValueComponent(int, int, float)
Writes one component of a control point's position.
public void SetControlPointValueComponent(int cp, int component, float value)Parameters
cp int
The control point index.
component int
Which of the three position components to write.
value float
The value to write.

