Nuke binary plugins 15.1.5
 
Loading...
Searching...
No Matches
DD::Image::ParticleSystem Class Reference

#include <ParticleOp.h>

Classes

struct  Source
 the Source of a particle representation (a Node, and its input) More...
 

Public Types

enum  CollisionFlags : unsigned char { eCollided , eKillParticle }
 Information about particle collisions which is filled in by the ParticleBounce node. More...
 
enum  ReadResult { eReadNotFound , eReadCorrupt , eReadOK , eReadOutOfDate }
 

Public Member Functions

 ParticleSystem (int maxParticles=1000000)
 
 ParticleSystem (const ParticleSystem &particleSystem)=delete
 
void operator= (const ParticleSystem &other)
 
unsigned int numParticles () const
 The number of particles in the system.
 
unsigned int maxParticles () const
 The maximum number of particles which can be created in the system.
 
int allocNewParticle (Vector3 position, float startTime, unsigned pathMask)
 
void expireParticle (unsigned int i)
 Kill a particles. This will never invalidate the attribute pointers.
 
void reset ()
 Reset the whole system back to an empty state.
 
void setSystemTime (float time)
 Set the system time. This is the time at the end of the current time step.
 
float systemTime () const
 Return the system time. This is the time at the end of the current time step.
 
void write (const DD::Image::Hash &h, Op *node)
 
void write (const std::string &filename, const DD::Image::Hash &hash, Op *node)
 
void doWrite (ImageCacheWriteI *f, const DD::Image::Hash &hash, Op *node)
 
ReadResult read (const DD::Image::Hash &h, Op *node)
 
ReadResult read (const std::string &filename, const DD::Image::Hash &hash, Op *node)
 
ReadResult doRead (ImageCacheReadI *f, const DD::Image::Hash &hash, Op *node)
 
ParticleNodeStatenodeState (Node *node, ParticleNodeStateFactory *factory)
 
Vector3particleInitialPosition ()
 The position at which each particle was initially created.
 
const Vector3 *const particleInitialPosition () const
 
Vector3particleInitialPosition (unsigned idx)
 
const Vector3particleInitialPosition (unsigned idx) const
 
Vector3particlePosition ()
 The current position of the particles.
 
const Vector3 *const particlePosition () const
 
Vector3particlePosition (unsigned idx)
 
const Vector3particlePosition (unsigned idx) const
 
Vector3particleLastPosition ()
 The previous position of the particles.
 
const Vector3 *const particleLastPosition () const
 
Vector3particleLastPosition (unsigned idx)
 
const Vector3particleLastPosition (unsigned idx) const
 
Vector3particleVelocity ()
 The current velocity of the particles (in units/frame)
 
const Vector3 *const particleVelocity () const
 
Vector3particleVelocity (unsigned idx)
 
const Vector3particleVelocity (unsigned idx) const
 
Vector3particleSize ()
 The size of the particle (the same units as the position)
 
const Vector3 *const particleSize () const
 
Vector3particleSize (unsigned idx)
 
const Vector3particleSize (unsigned idx) const
 
Vector4particleColor ()
 The color of the particles, RGBA.
 
const Vector4 *const particleColor () const
 
Vector4particleColor (unsigned idx)
 
const Vector4particleColor (unsigned idx) const
 
Quaternion4fparticleOrientation ()
 The orientation of each particle.
 
const Quaternion4f *const particleOrientation () const
 
Quaternion4fparticleOrientation (unsigned idx)
 
const Quaternion4fparticleOrientation (unsigned idx) const
 
Vector3particleRotationAxis ()
 The rotation axis of each particle.
 
const Vector3 *const particleRotationAxis () const
 
Vector3particleRotationAxis (unsigned idx)
 
const Vector3particleRotationAxis (unsigned idx) const
 
float * particleRotationAngle ()
 The rotation angle of each particle around its axis.
 
const float *const particleRotationAngle () const
 
float & particleRotationAngle (unsigned idx)
 
const float & particleRotationAngle (unsigned idx) const
 
float * particleRotationVelocity ()
 The rotation velocity of each particle around its axis.
 
const float *const particleRotationVelocity () const
 
float & particleRotationVelocity (unsigned idx)
 
const float & particleRotationVelocity (unsigned idx) const
 
float * particleMass ()
 The mass of each particle. Defaults to 1.
 
const float *const particleMass () const
 
float & particleMass (unsigned idx)
 
const float & particleMass (unsigned idx) const
 
float * particleLife ()
 The total number of frames that each particle is expected to live for.
 
const float *const particleLife () const
 
float & particleLife (unsigned idx)
 
const float & particleLife (unsigned idx) const
 
float * particleExpirationChance ()
 The chance that each particle will die each frame (applied separately from _life)
 
const float *const particleExpirationChance () const
 
float & particleExpirationChance (unsigned idx)
 
const float & particleExpirationChance (unsigned idx) const
 
float * particleStartTime ()
 The time at which each particle came alive.
 
const float *const particleStartTime () const
 
float & particleStartTime (unsigned idx)
 
const float & particleStartTime (unsigned idx) const
 
int * particleId ()
 A unique particle-ID. Consistent within the lifetime of the particle, and not re-used.
 
const int *const particleId () const
 
int & particleId (unsigned idx)
 
const int & particleId (unsigned idx) const
 
ParticleChannelSet * particleChannels ()
 The "channels" on which this particle exist (ie the sets it is part of)
 
const ParticleChannelSet *const particleChannels () const
 
ParticleChannelSet & particleChannels (unsigned idx)
 
const ParticleChannelSet & particleChannels (unsigned idx) const
 
unsigned int * particlePathMask ()
 Internal, used to implement ParticleMerge.
 
const unsigned int *const particlePathMask () const
 
unsigned int & particlePathMask (unsigned idx)
 
const unsigned int & particlePathMask (unsigned idx) const
 
bool * particleActive ()
 Whether or not this particle exists.
 
const bool *const particleActive () const
 
bool & particleActive (unsigned idx)
 
const bool & particleActive (unsigned idx) const
 
SourceparticleSource ()
 
const Source *const particleSource () const
 
SourceparticleSource (unsigned idx)
 
Source const & particleSource (unsigned idx) const
 
float * particleRepresentationFrame ()
 The frame to use from the representation.
 
const float *const particleRepresentationFrame () const
 
float & particleRepresentationFrame (unsigned idx)
 
const float & particleRepresentationFrame (unsigned idx) const
 
FrameAdvanceparticleFrameAdvance ()
 The advancement mode for the representation frame.
 
const FrameAdvance *const particleFrameAdvance () const
 
FrameAdvanceparticleFrameAdvance (unsigned idx)
 
const FrameAdvanceparticleFrameAdvance (unsigned idx) const
 
int * particleRepresentationFirstFrame ()
 The first frame for which the representation is available.
 
const int *const particleRepresentationFirstFrame () const
 
int & particleRepresentationFirstFrame (unsigned idx)
 
const int & particleRepresentationFirstFrame (unsigned idx) const
 
int * particleRepresentationLastFrame ()
 The last frame for which the representation is available.
 
const int *const particleRepresentationLastFrame () const
 
int & particleRepresentationLastFrame (unsigned idx)
 
const int & particleRepresentationLastFrame (unsigned idx) const
 
BounceInfo * particleBounceInfo ()
 information about the first bounce for each particle
 
const BounceInfo *const particleBounceInfo () const
 
BounceInfo & particleBounceInfo (unsigned idx)
 
const BounceInfo & particleBounceInfo (unsigned idx) const
 
float * particleDeltaT ()
 The time remaining on this frame.
 
const float *const particleDeltaT () const
 
float & particleDeltaT (unsigned idx)
 
const float & particleDeltaT (unsigned idx) const
 
Vector3 particleMomentum (unsigned idx) const
 The momentum of a particle.
 
Op *& particleRepresentation (unsigned idx)
 The representation of each particle (ie a GeoOp or an Iop)
 
Op *const & particleRepresentation (unsigned idx) const
 

Static Public Member Functions

static void MakeNodeOpMap (Op *op, std::map< Node *, Op * > &out)
 

Detailed Description

A particle system consisting of a number of particles, each with a set of attributes such as position, velocity, color etc. The attributes are guaranteed to be stored as consecutive arrays for efficiency. When iterating through the particles, it is far faster to use the methods which return a pointer to the start of the attribute array, than to make a call for every element. e.g. do this: const Vector3* position = particleSystem->particlePosition(); for ( int i : particleSystem ) doSomethingWith( position[i] ); and not this: for ( int i : particleSystem ) doSomethingWith( particleSystem->particlePosition(i) );

Member Enumeration Documentation

◆ CollisionFlags

Information about particle collisions which is filled in by the ParticleBounce node.

Enumerator
eKillParticle 

particle has collided this frame

Member Function Documentation

◆ allocNewParticle()

int DD::Image::ParticleSystem::allocNewParticle ( Vector3  position,
float  startTime,
unsigned  pathMask 
)

Create a new particle. Be aware that this may cause internal arrays to be reallocated and so invalidate any attribute pointers you are holding.

◆ write() [1/2]

void DD::Image::ParticleSystem::write ( const DD::Image::Hash h,
Op node 
)

Write the entire state of the particle system to the cache.

◆ write() [2/2]

void DD::Image::ParticleSystem::write ( const std::string &  filename,
const DD::Image::Hash hash,
Op node 
)

Write the entire state of the particle system to disk.

◆ read() [1/2]

ParticleSystem::ReadResult DD::Image::ParticleSystem::read ( const DD::Image::Hash h,
Op node 
)

Read the particle system from the cache.

If no cache is found, it returns eReadNodeFound, in which case the particle system has been left in the state it was originally. If all is ok, it returns eReadOK. If the file was corrupt in some way which means that the particle system is now in a potentially invalid state, then it will return eReadCorrupt.

◆ read() [2/2]

ParticleSystem::ReadResult DD::Image::ParticleSystem::read ( const std::string &  filename,
const DD::Image::Hash hash,
Op node 
)

Read the entire state of the particle system to disk.

◆ nodeState()

ParticleNodeState * DD::Image::ParticleSystem::nodeState ( Node *  node,
ParticleNodeStateFactory factory 
)

Find a NodeState for the given node. If one cannot be find, it uses the factory to make one

◆ particleSource()

Source * DD::Image::ParticleSystem::particleSource ( )

The source of each particle (ie a ParticleEmitter or ParticleSpawn) and the input number from that that is used for the representation.



©2024 The Foundry Visionmongers, Ltd. All Rights Reserved.
www.foundry.com