Particle

  • LXsPKG_REPLICATOR

  • LXs_PKG_IS_REPLICATOR

ILxParticleItem

class ILxParticleItem

Public Functions

LxResult Prepare(LXtObjectID self, LXtObjectID eval, unsigned *index)

Any item can potentially act as a particle source. This interface allocates a particle object for a given item.

  • Prepare Given an ILxEvaluation interface, the item selects that channels it needs for input. It can return an index, generally for the first channel it added.

  • Evaluate After prepping, this method is called to allocate the particle source object. The ILxAttributes interface and index are used to read channels selected by the Prepare() method. The particle object doesn’t have a specialized interface, and is instead implemented using a TableauSurface interface to get the point data, and an attributes interface to set the special attributes.

LxResult Evaluate(LXtObjectID self, LXtObjectID attr, unsigned index, void **ppvObj)
bool Alloc(ILxUnknownID attr, unsigned index, CLxLocalizedObject &loc)

User Class Only:


LXsPKG_READPARTICLES

Any item can read particle sources by setting this tag. This allows particle graph connections for the item.

  • LXsITYPE_SINGLEPARTICLE

  • LXsITYPE_MULTIPARTICLE

  • LXsITYPE_ORDEREDPARTICLE


LXsPARTICLEATTR_SEED

The particle object can also support an ILxAttributes interface to provide options that the client can set.

  • SEED integer attribute that is the random seed for the particle ID or other random attributes of the paricle source.

  • USEPOL integer setting that can be set on mesh particle sources. 0 generates particles on all vertices; 1 generates particles at polygon centers rather than on points; and 2 generates particles only at detached vertices.

  • UPAXIS integer channel which defines the up axis as 0, 1 or 2. This is used for point clouds to determine the best way to orient the particles.

  • DEFORM integer boolean that can be set on mesh particle sources. When true particles are on the deformed mesh, on the base mesh if not.

  • SPACING spacing is used to increase the number of particles at render time with the render multiplier

  • LXsPARTICLEATTR_USEPOL

  • LXsPARTICLEATTR_UPAXIS

  • LXsPARTICLEATTR_DEFORM

  • LXsPARTICLEATTR_SPACING


LXiTBLX_PARTICLES

Particle features defined for vertices in the source. For legacy reasons these defines have a tableau prefix.

  • LXsTBLX_PARTICLE_POS

  • LXsTBLX_PARTICLE_XFRM

  • LXsTBLX_PARTICLE_ID

  • LXsTBLX_PARTICLE_SIZE

  • LXsTBLX_PARTICLE_VEL

  • LXsTBLX_PARTICLE_MASS

  • LXsTBLX_PARTICLE_FORCE

  • LXsTBLX_PARTICLE_AGE

  • LXsTBLX_PARTICLE_PATH

  • LXsTBLX_PARTICLE_DISS

  • LXsTBLX_PARTICLE_RATE

  • LXsTBLX_PARTICLE_ITEM

  • LXsTBLX_PARTICLE_ANGVEL

  • LXsTBLX_PARTICLE_TORQUE

  • LXsTBLX_PARTICLE_PPREV

  • LXsTBLX_PARTICLE_LUM

  • LXsTBLX_PARTICLE_RGB

  • LXiTBLX_COLLISION

  • LXsTBLX_COLLISION_VAL

  • LXsTBLX_COLLISION_POS

  • LXsTBLX_COLLISION_NORM

  • LXsTBLX_COLLISION_COUNT

  • LXsTBLX_COLLISION_TIME

ILxReplicatorEnumerator

class ILxReplicatorEnumerator

The ReplicatorEnumerator interface allows traversal of the members of the particle item.

Public Functions

LxResult Enumerate(LXtObjectID self, LXtObjectID visitor, LXtObjectID chan, int localXform)

The Enumerate() method takes a visitor and calls its Evaluate() method for each replicant of a replicator. During each Evaluate() call, the visitor can get information about the member. If ‘localXform’ is true, then the transforms from the Replicator Item & Particle Source are not applied.

LxResult Item(LXtObjectID self, void **ppvObj)
void Position(LXtObjectID self, LXtVector pos)
void Orientation(LXtObjectID self, LXtMatrix mx)
float Id(LXtObjectID self)
float Dissolve(LXtObjectID self)
float GroupId(LXtObjectID self)
LxResult Geometry(LXtObjectID self, void **ppvObj)
LxResult Enum(CLxImpl_AbstractVisitor *visitor, ILxUnknownID chan, bool localXform)

User Class Only: The two Enum() methods correspond to the two ways of acquiring an enumerator. The channel-read object is not needed for enumerators allocated as part of a modifier.

LxResult Enum(CLxImpl_AbstractVisitor *visitor, bool localXform)
bool GetItem(CLxLoc_Item &item)

ILxParticleEvalFrame

class ILxParticleEvalFrame

Public Functions

LXtObjectID VertexDescription(LXtObjectID self)

The particle evaluation frame object maintains the state of the particle simulation. There can be any number of particles, but all of them contain the same information in the form of a vector of floats. This method gets the description of the complete vertex vector for the simulation.

unsigned MaxCount(LXtObjectID self)

MaxCount() returns the number of particle slots, although not all will contain active particles. AliveCount() returns the number of active particles.

unsigned AliveCount(LXtObjectID self)
LxResult AddParticle(LXtObjectID self, const float *state, unsigned *index)

AddParticle() adds a new particle with an initial state given by the vector. After this the tags can be set through the StringTag interface. The index of the particle is returned.

LxResult KillParticle(LXtObjectID self, unsigned index)

This changes an active particle into an inactive one. Inactive particle slots may be reused for new particles.

unsigned IsAlive(LXtObjectID self, unsigned index)

This method tests if a given particle is active.

LxResult GetVector(LXtObjectID self, unsigned index, float *vector)

The state vector for a particle can be read and set using these methods. For GetVector() the client has to pass a sufficient buffer to recieve the requested state vector.

LxResult SetVector(LXtObjectID self, unsigned index, const float *vector)
LxResult AliveRun(LXtObjectID self, unsigned first, const unsigned **alive, unsigned *count)

Particles can also be accessed in runs to improve performance. These methods return runs of ‘alive’ flags and vector values starting from particle index ‘first’ and containing ‘count’ particles.

LxResult VectorRun(LXtObjectID self, unsigned first, float **values, unsigned *count)
LxResult Neighbors(LXtObjectID self, LXtFVector pos, double maxDist, int maxCount, unsigned *index, double *dist, unsigned *count)

Find nearest particles to the given 3D position. The maxDist is the range to search for particles, and can be -1 for searching everywhere. The maxCount is the maximum number to return, and the index and dist arrays should be at least that long. If you are giving an existing particle position you need to ask for one more particle than you want since the particle itself will be first.


LXfFRAME_ALIVE

The ‘alive’ run holds state bits for each particle. Newborn particles are alive+changed, just killed particles are dead+changed. The changed flag is cleared at the start of each timestep.

  • LXfFRAME_CHANGED

ILxParticleFilter

class ILxParticleFilter

Public Functions

LXtObjectID Vertex(LXtObjectID self, LXtObjectID full)

Process layers are filters that are called in sequence to generate the simulation. The filter provides a peek at the vertex features that it wants to read or write. For all operations on the particle state, these are the only features that the filter will see. The particle frame will remap the full state into the state requested by the filter. If ‘full’ is null, then this should return the features required by this filter. If ‘full’ is non-null, then it contains the full set of features in the simulation and the filter can return a second vertex containing any of the features in the full set. Filters that don’t want optional features can just return the same required vertex for both cases.

unsigned Flags(LXtObjectID self)

A filter can have one of several types. These determine which processing method will be used for the filter. Additional flags can be set to select the stage of the process where the filter wants to run.

LxResult Initialize(LXtObjectID self, LXtObjectID vertex, LXtObjectID frame, double time)

Initialize() is called at start of simulation and gets the frame object and start time.

LxResult Step(LXtObjectID self, LXtObjectID other, double dt)

Step() is called for each new time step. The ‘other’ pointer is another instance of this same filters, and contains the evaluation state for this timestep.

void Cleanup(LXtObjectID self)

Cleanup() is called when the simulation is complete.

LxResult Frame(LXtObjectID self, unsigned stage)

Frame() is called for filters of type LXi_PFILT_FRAME and allows the filter to process the entire frame in any manner. This is the only way to add or remove particles, for example.

LxResult Run(LXtObjectID self, unsigned stage, float **values, const unsigned *alive, unsigned base, unsigned count)

Run() is called for filters of type LXi_PFILT_RUN and allows the filter to process a run of particles starting at ‘base’ for ‘count’ particles. The values arrays that are passed in match the description of the requested vertex vector. Some of these particles may be dead, but it may be faster to process them than to test. The alive state can be read by setting the ALIVERUN flag.

LxResult Particle(LXtObjectID self, unsigned stage, float *vertex)

Particle() is called for filters of type LXi_PFILT_PARTICLE or LXi_PFILT_NEW_PARTICLE and allows the filter to process a single particle at a time. Again the vector passed matches the request by the filter. For the ‘NEW’ case this method is only called for particles added by a previous particle filter. This can return LXePARTICLE_KILL to kill the particle.

  • LXiPFILT_FRAME

  • LXiPFILT_RUN

  • LXiPFILT_PARTICLE

  • LXiPFILT_NEW_PARTICLE

  • LXmPFILT_TYPE

  • LXfPFILT_PRESTAGE

  • LXfPFILT_DERIVSTAGE

  • LXfPFILT_POSTSTAGE

  • LXfPFILT_ALIVERUN

  • LXsPKG_PFILT_CHANNEL

  • LXsPFILT_ENABLECHANNEL

  • LXePARTICLE_KILL

ILxParticleCoOperator

class ILxParticleCoOperator

Public Functions

LxResult Initialize(LXtObjectID self, LXtObjectID eval)

A particle co-operator is an item that can be linked to a particle operator. This allows it to be part of the process for a specific operator. Init and cleanup are called at the start and end of the sim.

LxResult Cleanup(LXtObjectID self)
LxResult Step(LXtObjectID self, double dT)

The operator is called at the start of the step with the time, and for each particle.

LxResult Particle(LXtObjectID self)
  • LXsPKG_PCOOP_CHANNEL

  • LXsGRAPH_PARTICLEOP

ILxPointCacheItem

class ILxPointCacheItem

Public Functions

LxResult Prepare(LXtObjectID self, LXtObjectID eval, unsigned *index)

Other items can function as point caches. If they provide a PointCacheItem interface then the particle simulation can store its results into the cache. The cache item will typically also have a ParticleItem interface to allow the cache to be used.

  • Prepare Allow the point cache to attach itself to an evaluation context by adding channels.

  • Initialize This is called to start writing frames into the cache. Any previous contents of the cache should be cleared. This is passed the vertex description for the particle features to be saved, and the attributes for reading added channels. It also gets the start time and sample rate.

  • SaveFrame This saves a single frame of particle data to the cache. The object is a particle object with a TableauSurface interface.

  • Cleanup This is called when writing data to the cache is complete.

LxResult Initialize(LXtObjectID self, LXtObjectID vdesc, LXtObjectID attr, unsigned index, double time, double sample)
LxResult SaveFrame(LXtObjectID self, LXtObjectID pobj, double time)
LxResult Cleanup(LXtObjectID self)
  • LXsGRAPH_POINTCACHE

  • LXsITYPE_PSIM

  • LXsICHAN_PSIM_ENABLE

  • LXsICHAN_PSIM_SAMPLES

  • LXsICHAN_PSIM_ADDAGE

  • LXsICHAN_PSIM_ADDPATH

  • LXsICHAN_PSIM_STOREFORCE

  • LXsICHAN_PSIM_STOREMASS

  • LXsICHAN_PSIM_AGEKILL

  • LXsICHAN_PSIM_AGEMAX

  • LXsICHAN_PSIM_AGEEXTEND

  • LXsICHAN_PSIM_GRAVENABLE

  • LXsICHAN_PSIM_GRAVAXIS

  • LXsICHAN_PSIM_GRAVITY

  • LXsICHAN_PSIM_DRAGENABLE

  • LXsICHAN_PSIM_DRAG

  • LXsICHAN_PSIM_COLOR

  • LXsICHAN_PSIM_TGROUP

  • LXsICHAN_PSIM_PCOUNT

  • LXsICHAN_PSIM_NTHREAD

  • LXsICHAN_PSIM_CACHEMEM

  • LXsGRAPH_PSIM

ILxParticleService

class ILxParticleService

The particle service provides methods for accessing particle-related information.

Public Functions

LxResult ScriptQuery(LXtObjectID self, void **ppvObj)
LxResult GetReplicatorEnumerator(LXtObjectID self, LXtObjectID replicatorItem, void **ppvObj)

Get an enumerator for a replicator. This requires a valid replicator item, and will need an evaluated channel-read object to enumerate.

LxResult EnumParticleFeatures(LXtObjectID self, LXtObjectID item, LXtObjectID visitor)

Enumerate the particle features added to an item. Any item can set the USEFEATURES server tag to allow features to be added. For each feature the visitor can read the ident string and channel offset.

LxResult FeatureIdent(LXtObjectID self, const char **ident)
LxResult FeatureOffset(LXtObjectID self, unsigned *offset)
LxResult TriGroupToParticle(LXtObjectID self, LXtObjectID triGroup, void **ppvObj)

If you have a triGroup object with positional data and other particle features, you can convert it to a particle object with this function.

LxResult TriGroupBlend(LXtObjectID self, LXtObjectID triGroup0, LXtObjectID triGroup1, double blend)

You can also blend two tri-groups representing particle state. Group 0 will be changed based on the amount, with 0.0 being no change and 1.0 being complete replacement.

LxResult EnumeratorPrepare(LXtObjectID self, LXtObjectID eval, LXtObjectID replItem, unsigned *index)

These methods are provided for accessing a replicator enumerator as part of a modifier. The channel-read object in this case should be NULL.

LxResult EnumeratorEvaluate(LXtObjectID self, LXtObjectID attr, unsigned index, void **ppvObj)
LxResult ItemToParticle(LXtObjectID self, LXtObjectID item, LXtObjectID chanRead, void **ppvObj)

Get a particle object from any particle item. Takes an eval channel read object.

LxResult EnumFeatures(ILxUnknownID item, CLxImpl_AbstractVisitor *visitor)

User Class Only:

LXpAnimDeform

struct st_LXpAnimDeform

This packet is used by deformers.

Public Members

LXtFVector dir
float amplitude
  • LXsP_ANIM_DEFORM


LXs_FX_DEFORM_AMP

For now we have one deformer effect: amplitude.

LXpSampleFalloff

struct st_LXpSampleFalloff

This packet is used by deformers.

Public Members

float value
  • LXsP_SAMPLE_FALLOFF