Detailed Description
Represents one particle in a particle cloud.
Particles are accessible via ParticleCloudPrimitive::GetParticle.
- See also:
- ParticleCloud, ParticleCloudPrimitive, X3DObject::AddParticleCloud
- Deprecated:
- 8.0 (2010) Legacy particles are kept for backward compatibility.
- Example:
- Creates the initial state for a particle simulation
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 ) ;
ParticleCloud myParticleCloud ;
app.GetActiveSceneRoot().AddParticleCloud(
particleTypeArray,
L"MyCloud",
myParticleCloud ) ;
ParticleCloudPrimitive myParticlePrim = myParticleCloud.GetActivePrimitive() ;
myParticlePrim.AddParticles( 1000, CRef() ) ;
for ( LONG i = 0 ; i < 10 ; i++ )
{
for ( LONG j = 0 ; j < 10 ; j++ )
{
for ( LONG k = 0 ; k < 10 ; k++ )
{
LONG index = i*100 + j*10 + k ;
Particle oParticle = myParticlePrim.GetParticle(index) ;
oParticle.PutPosition( MATH::CVector3(-5 + i, -3 +j, k)) ;
oParticle.PutAge( 1 + j * 10 ) ;
oParticle.PutAgeLimit( 100 ) ;
}
}
}
args[0] = myParticleCloud ;
args[1] = CValue() ;
app.ExecuteCommand( L"CreateParticleCloud", args, outArg ) ;
CValueArray & NewParticleClouds = outArg ;
ParticleCloud myNewCloud = NewParticleClouds[0] ;
ParticleCloudPrimitive myNewCloudPrim = myNewCloud.GetActivePrimitive() ;
Property myNewCloudParType = myNewCloudPrim.GetParticleTypes().GetItem(0) ;
myNewCloudParType.PutParameterValue( L"Size", 0.3 ) ;
myNewCloudParType.PutParameterValue( L"Red", 0.99 ) ;
myNewCloudParType.PutParameterValue( L"Green", 0.00 ) ;
myNewCloudParType.PutParameterValue( L"Blue", 0.10 ) ;
myNewCloudParType.PutParameterValue( L"Alpha", 0.50 ) ;
args.Resize(1) ;
args[0] = myParticleCloud ;
app.ExecuteCommand( L"ToggleVisibility", args, outArg ) ;
args.Resize(0) ;
app.ExecuteCommand( L"PlayForwardsFromStart", args, outArg ) ;
#include <xsi_particle.h>
List of all members.
Constructor & Destructor Documentation
Constructor.
- Parameters:
-
in_ref | constant reference object. |
Copy constructor.
- Parameters:
-
in_obj | constant class object. |
Member Function Documentation
bool IsA |
( |
siClassID |
in_ClassID | ) |
const [virtual] |
Returns true if a given class type is compatible with this API class.
- Parameters:
-
- Returns:
- true if the class is compatible, false otherwise.
Reimplemented from SIObject.
Returns the type of the API class.
- Returns:
- The class type.
Reimplemented from SIObject.
Creates an object from another object. The newly created object is set to empty if the input object is not compatible.
- Parameters:
-
in_obj | constant class object. |
- Returns:
- The new Particle object.
Creates an object from a reference object. The newly created object is set to empty if the input reference object is not compatible.
- Parameters:
-
in_ref | constant class object. |
- Returns:
- The new Particle object.
Reimplemented from SIObject.
Returns the index of the particle in the particle collection. A particle's index can change throughout a simulation when particles are added or removed from the cloud.
- Returns:
- The index of the particle
Returns the particle's ID. A particle ID is a number that uniquely identifies the particle within a cloud. It is invariant throughout the simulation.
- Returns:
- The particle ID
CStatus PutTypeID |
( |
LONG |
in_TypeID | ) |
|
Changes the type ID of the particle.
- Parameters:
-
in_TypeID | The new type ID for the particle |
- See also:
- Particle::GetTypeID
Sets the particle position
- Parameters:
-
in_vect | The position of the particle |
- See also:
- Particle::GetVelocity
double GetPathLength |
( |
| ) |
const |
Returns the distance that the particle has travelled since birth.
- Returns:
- The particle's path length
Returns the particle's age (frames since the particles birth). This can be a useful function in a custom operator for detecting if a particle is freshly born to run special initialization code.
- Returns:
- The particle's age
- See also:
- Particle::PutAge
LONG GetAgeLimit |
( |
| ) |
const |
Returns the particle life span (in frames)
- Returns:
- The particle's lifespan
- See also:
- Particle::PutAgeLimit
CStatus PutAgeLimit |
( |
LONG |
in_agelimit | ) |
|
Sets the particle life span
- Parameters:
-
in_agelimit | The particle's lifespan |
- See also:
- Particle::GetAgeLimit
Returns the random number generator seed for the particle
- Returns:
- The number to use as a seed
- See also:
- Particle::PutSeed
Sets the random number generator seed of the particle
- Parameters:
-
in_seed | The number to use as a seed |
- See also:
- Particle::GetSeed
Sets the particle's color
- Parameters:
-
in_vColor | The color to set, normalized with each component in the range 0 to 1 |
- See also:
- Particle::GetColor
Returns the parametric surface coordinates where the particle was emitted. As these are parametric coordinates, they make more sense when the emitters are NURBS curves or surfaces.
- Returns:
- The parametric surface coordinates on the emitter where the particle is emitted
- See also:
- Particle::PutUVW
Sets the parametric surface coordinates on the emitter where the particle is emitted. As these are parametric coordinates, they make more sense when the emitters are NURBS curves or surfaces.
- Parameters:
-
in_vect | Parametric surface coordinates where the particle was emitted |
- See also:
- Particle::GetUVW
LONG GetSpriteIndex |
( |
| ) |
const |
CStatus PutSpriteIndex |
( |
LONG |
in_index | ) |
|
double GetSpriteAngle |
( |
| ) |
const |
Returns the particle sprite angle. The sprite angle is the amount of rotation of the particle in the camera plane. The rotation is expressed in degrees and increases counter-clockwise.
- Returns:
- The sprite angle
- See also:
- Particle::PutSpriteAngle
CStatus PutSpriteAngle |
( |
double |
in_angle | ) |
|
Sets the particle sprite angle.
- Parameters:
-
in_angle | Amount of rotation of the particle in the camera plane |
- See also:
- Particle::GetSpriteAngle
Sets the particle's size
- Parameters:
-
in_size | Size of the particle |
- See also:
- Particle::GetSize
Sets the particle's mass
- Parameters:
-
in_mass | Mass controls how a particle is influenced by some forces |
- See also:
- Particle::GetMass
double GetDensity |
( |
| ) |
const |
Returns the particle's density
- Returns:
- The particle density
double GetPressure |
( |
| ) |
const |
Returns the pressure on the particle
- Returns:
- The particle pressure
The documentation for this class was generated from the following file: