#include <xsi_particlecloudprimitive.h>
This class provides access to the collection of particles that make up a ParticleCloud.
using namespace XSI; Application app ; CValueArray args(2) ; CValue outArg; args[0] = (LONG) siSphereType ; app.ExecuteCommand( L"CreateParticleType", args, outArg ) ; Property myParType = args[1] ; myParType.PutName( CString(L"CustomParType") ) ; CRefArray particleTypeArray ; particleTypeArray.Add( myParType ) ; // Create a particle cloud. This has no emittor, and no particle operator // so the simulation is completely the responsibility of the plug-in ParticleCloud myParticleCloud ; app.GetActiveSceneRoot().AddParticleCloud( particleTypeArray, L"CustomSimulation", myParticleCloud ) ; // Particles are accessed via the Primitive ParticleCloudPrimitive myParticlePrim = myParticleCloud.GetActivePrimitive() ; myParticlePrim.AddParticles( 31, myParType ) ; // Position the particles based on the quadradic formula f(x)=.5x^2 - 6 for ( LONG i = 0 ; i < myParticlePrim.GetCount() ; i++ ) { Particle particle = myParticlePrim.GetParticle(i) ; double xval = (i/3.0)-5 ; particle.PutPosition( MATH::CVector3( xval, (0.5 * xval * xval)-6, 0 ) ) ; }
Default constructor.
Default destructor.
ParticleCloudPrimitive | ( | const CRef & | in_ref | ) |
Constructor.
in_ref | constant reference object. |
ParticleCloudPrimitive | ( | const ParticleCloudPrimitive & | in_obj | ) |
Copy constructor.
in_obj | constant class object. |
bool IsA | ( | siClassID | in_ClassID | ) | const [virtual] |
Returns true if a given class type is compatible with this API class.
in_ClassID | class type. |
Reimplemented from Primitive.
siClassID GetClassID | ( | ) | const [virtual] |
ParticleCloudPrimitive& operator= | ( | const ParticleCloudPrimitive & | in_obj | ) |
Creates an object from another object. The newly created object is set to empty if the input object is not compatible.
in_obj | constant class object. |
ParticleCloudPrimitive& operator= | ( | const CRef & | in_ref | ) |
Creates an object from a reference object. The newly created object is set to empty if the input reference object is not compatible.
in_ref | constant class object. |
Reimplemented from Primitive.
Adds particles to a cloud. This function can only be called from custom operators or on clouds with no Operator. For example, this function will fail on a cloud created with the deprecated CreateParticleCloud command unless the cloud is frozen.
in_NbParticles | Number of new particles to add. |
in_ParType | Reference to an existing particle type object. |
CStatus RemoveParticles | ( | const CLongArray & | in_IndexArray | ) |
Removes particles by index. This function can only be called from custom operators or on clouds with no Operator.
in_IndexArray | Array with the indices of the particles to remove. |
CStatus RemoveParticlesWithIDs | ( | const CLongArray & | in_IDArray | ) |
Removes particles by their IDs. This function can only be called from custom operators or on clouds with no Operator.
in_IDArray | Array with the particle IDs of the particles to remove. |
LONG GetCount | ( | ) | const |
Returns the number of particles in the cloud.
Particle GetParticle | ( | LONG | in_index | ) | const |
Returns the Particle object at the specified index.
in_index | Index of the particle. Particles always have an index between 0 and Particle::GetCount - 1. |
CRefArray GetParticleTypes | ( | ) | const |
Returns an array of the particle types associated with the particle cloud. A particle cloud might have particles with different types on the same cloud. An associated particle type is created automatically when the deprecated CreateParticleCloud command is called. A particle type can also be created by calling the deprecated CreateParticleType command and associated with a cloud when X3DObject::AddParticleCloud is called.
Particle FindParticle | ( | LONG | in_ID | ) | const |
Searches for a particle by its ID. Because the index of a particle may change during a simulation but its ID will not, it is sometimes convenient to lookup a particle by its ID. However finding particles by this mechanism is moderately less efficient than using Particle::GetParticle.
in_ID | The particle ID |
CStatus PutPositionArray | ( | const CDoubleArray & | in_values | ) |
Sets the positions for all the particles in the cloud with a single API call. This approach is more efficient than calling Particle::PutPosition on every single particle.
in_values | Array with new X,Y,Z values for each particle, ordered as
X(0), Y(0), Z(0)... X(n-1), Y(n-1), Z(n-1) |
CStatus GetPositionArray | ( | CDoubleArray & | out_values | ) |
Returns the positions for all the particles in the cloud with a single API call. This approach is more efficient than calling Particle::GetPosition on every single particle.
out_values | Returned array contains the X,Y,Z values for each particle,
ordered as
X(0), Y(0), Z(0)... X(n-1), Y(n-1), Z(n-1) |
CStatus PutVelocityArray | ( | const CDoubleArray & | in_values | ) |
Sets the velocities for all the particles in the cloud with a single API call. This approach is more efficient than calling Particle::PutVelocity on every single particle.
in_values | Array with X,Y,Z values for each particle, ordered as
X(0), Y(0), Z(0)... X(n-1), Y(n-1), Z(n-1) |
CStatus GetVelocityArray | ( | CDoubleArray & | out_values | ) |
Returns the velocities for all the particles in the cloud with a single API call. This approach is more efficient than calling Particle::GetVelocity on every single particle.
out_values | Returned array will contain the X,Y,Z values for each particle,
ordered as
X(0), Y(0), Z(0)... X(n-1), Y(n-1), Z(n-1) |
CStatus PutRotationArray | ( | const CDoubleArray & | in_values | ) |
Sets the rotation for all the particles in the cloud with a single API call. This approach is more efficient than calling Particle::PutRotation on every single particle.
in_values | Array with new X,Y,Z values (in radians) for each particle,
ordered as
X(0), Y(0), Z(0)... X(n-1), Y(n-1), Z(n-1) |
CStatus GetRotationArray | ( | CDoubleArray & | out_values | ) |
Returns the rotation vectors for all the particles in the cloud with a single API call. This approach is more efficient than calling Particle::GetRotation on every single particle.
out_values | Returned array will contain the X,Y,Z values (in radians) for
each particle, ordered as
X(0), Y(0), Z(0)... X(n-1), Y(n-1), Z(n-1) |
CStatus PutAngularVelocityArray | ( | const CDoubleArray & | in_values | ) |
Sets the angular velocities for all the particles in the cloud with a single API call.This approach is more efficient than calling Particle::PutAngularVelocity on every single particle.
in_values | Array with new X,Y,Z Euler angle values (in radians) for each
particle, ordered as
X(0), Y(0), Z(0)... X(n-1), Y(n-1), Z(n-1) |
CStatus GetAngularVelocityArray | ( | CDoubleArray & | out_values | ) |
Returns the angular velocities for all the particles in the cloud with a single API call. This approach is more efficient than calling Particle::GetAngularVelocity on every single particle.
out_values | Returned array will contain the X,Y,Z Euler angles (in radians)
for each particle, ordered as
X(0), Y(0), Z(0)... X(n-1), Y(n-1), Z(n-1) |
CStatus PutUVWArray | ( | const CDoubleArray & | in_values | ) |
Sets the emission position in UVW coordinates for all the particles in the cloud with a single API call. This approach is more efficient than calling Particle::PutUVW on every single particle.
in_values | Array with new U,V,W position values for each particle, ordered
as
U(0), V(0), W(0)... U(n-1), V(n-1), W(n-1) |
CStatus GetUVWArray | ( | CDoubleArray & | out_values | ) |
Returns the emission position in UVW coordinates for all the particles in the cloud with a single API call. This approach is more efficient than calling Particle::GetUVW on every single particle.
out_values | Returned array will contain the U,V,W values for each particle,
ordered as
U(0), V(0), W(0)... U(n-1), V(n-1), W(n-1) |
CStatus PutColorArray | ( | const CDoubleArray & | in_values | ) |
Sets the color of all particles in the cloud with a single API call. This approach is more efficient than calling Particle::PutColor on every single particle.
in_values | Array with R,G,B,A color values for each particle, ordered as
R(0), G(0), B(0), A(0)... R(n-1), G(n-1), B(n-1), A(n-1) |
CStatus GetColorArray | ( | CDoubleArray & | out_values | ) |
Returns the colors of all the particles in the cloud with a single API call. This approach is more efficient than calling Particle::GetColor on every single particle.
out_values | Returned array will contain the R,G,B,A values for each
particle, ordered as
R(0), G(0), B(0), A(0)... R(n-1), G(n-1), B(n-1), A(n-1) |
CStatus PutSizeArray | ( | const CDoubleArray & | in_values | ) |
Sets the size of each particle in the cloud with a single API call. This approach is more efficient than calling Particle::PutSize on every single particle.
in_values | Array with new size values for each particle. |
CStatus GetSizeArray | ( | CDoubleArray & | out_values | ) |
Returns the size of each particle in the cloud with a single API call. This approach is more efficient than calling Particle::GetSize on every single particle.
out_values | Returned array will contain the size of each particle |
CStatus PutSpriteAngleArray | ( | const CDoubleArray & | in_values | ) |
Sets the sprite angle of each particle in the cloud with a single API call. This approach is more efficient than calling Particle::PutSpriteAngle on every single particle.
in_values | Array with new sprite angle values for each particle. |
CStatus GetSpriteAngleArray | ( | CDoubleArray & | out_values | ) |
Returns the sprite angle for all the particles in the cloud with a single API call. This approach is more efficient than calling Particle::GetSpriteAngle on every single particle.
out_values | Returned array will contain the sprite angle of each particle |
CStatus PutMassArray | ( | const CDoubleArray & | in_values | ) |
Sets the mass of each particle in the cloud with a single API call. This approach is more efficient than calling Particle::PutMass on every single particle.
in_values | Array with new mass values for each particle. |
CStatus GetMassArray | ( | CDoubleArray & | out_values | ) |
Returns the mass of each particle in the cloud with a single API call. This approach is more efficient than calling Particle::GetMass on every single particle.
out_values | Returned array will contain the mass of each particle |
CStatus GetDensityArray | ( | CDoubleArray & | out_values | ) |
Returns the density of each particle in the cloud with a single API call. This approach is more efficient than calling Particle::GetDensity on every single particle.
out_values | Returned array will contain the density of each particle |
CStatus GetPressureArray | ( | CDoubleArray & | out_values | ) |
Returns the pressure on each particle in the cloud with a single API call. This approach is more efficient than calling Particle::GetPressure on every single particle.
out_values | Returned array will contain the pressure of each particle |
CStatus GetPathLengthArray | ( | CDoubleArray & | out_values | ) |
Returns the length of the path travelled by each particles in the cloud with a single API call. This approach is more efficient than calling Particle::GetPathLength on every single particle.
out_values | Returned array will contain the path length of each particle |
CStatus PutAgeArray | ( | const CLongArray & | in_values | ) |
Sets the age of each particle in the cloud with a single API call. This approach is more efficient than calling Particle::PutAge on every single particle.
in_values | Array with new age values for each particle. |
CStatus GetAgeArray | ( | CLongArray & | out_values | ) |
Returns the age of each particle in the cloud with a single API call. This approach is more efficient than calling Particle::GetAge on every single particle.
out_values | Returned array will contain the age of each particle |
CStatus PutSeedArray | ( | const CLongArray & | in_values | ) |
Sets the random number generation seed of each particle in the cloud with a single API call. This approach is more efficient than calling Particle::PutSeed on every single particle.
in_values | Array with new seed values for each particle. |
CStatus GetSeedArray | ( | CLongArray & | out_values | ) |
Returns the random number generation seed of each particle in the cloud with a single API call. This approach is more efficient than calling Particle::GetSeed on every single particle.
out_values | Returned array will contain the seed of each particle |
CStatus PutAgeLimitArray | ( | const CLongArray & | in_values | ) |
Sets the life span of each particle in the cloud with a single API call. This approach is more efficient than calling Particle::PutAgeLimit on every single particle.
in_values | Array with new age limit values for each particle. |
CStatus GetAgeLimitArray | ( | CLongArray & | out_values | ) |
Returns the life span of each particle in the cloud with a single API call. This approach is more efficient than calling Particle::GetAgeLimit on every single particle.
out_values | Returned array will contain the age limit of each particle |
CStatus PutSpriteIndexArray | ( | const CLongArray & | in_values | ) |
Sets the sprite index of each particle in the cloud with a single API call. This approach is more efficient than calling Particle::PutSpriteIndex on every single particle.
in_values | Array with new sprite index values for each particle. |
CStatus GetSpriteIndexArray | ( | CLongArray & | out_values | ) |
Returns the sprite index of each particle in the cloud with a single API call. This approach is more efficient than calling Particle::GetSpriteIndex on every single particle.
out_values | Returned array will contain the sprite index of each particle |
CStatus PutTypeIDArray | ( | const CLongArray & | in_values | ) |
Sets the particle type ID of each particle in the cloud with a single API call. This approach is more efficient than calling Particle::PutTypeID on every single particle.
in_values | Array with new particle type IDs for each particle. |
CStatus GetTypeIDArray | ( | CLongArray & | out_values | ) |
Returns the particle type ID of each particle in the cloud with a single API call. This approach is more efficient than calling Particle::GetTypeID on every single particle.
out_values | Returned array will contain the type ID of each particle |
CStatus GetIDArray | ( | CLongArray & | in_values | ) |
Returns the ID of each particle in the cloud with a single API call. This approach is more efficient than calling Particle::GetID on every single particle.
in_values | Returned array will contain the ID of each particle |