This page has been translated automatically.
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Content Creation
Materials
Unigine Material Library
Tutorials
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

ObjectParticles Class

This class is used to create particle systems. The particles are approximated with a sphere. They can be of different types (see the details) and radius (that can change with time). They are emitted from different emitters (see the details) with a specified spawn rate. The particles disappear after the set life time period or culled when hitting other nodes. They either collide with the outer surface of the approximation sphere or intersect only by the its center.

The particle flow direction can be influenced by:

The particle system can also initialized before it actually appears, so that it starts to be rendered with already spawned particles.

The following samples demonstrate the ObjectParticles class usage:

ObjectParticles Class

This class inherits from Object

Members


ObjectParticles ()

Constructor. Creates a particle system.

int addDeflector ()

Adds a deflector with default settings.

Return value

Number of the new deflector in the list of deflectors.

void addEmitterSpark (vec3 point, vec3 normal, vec3 velocity)

Adds a spark emitter in the given point.

Arguments

  • vec3 point - Point for sparks emission.
  • vec3 normal - Normal of the point of spark emission.
  • vec3 velocity - Velocity in the point of spark emission (velocity of source particles or node by contact).

int addForce ()

Adds a force with default settings.

Return value

Number of the new force in the list of forces.

int addNoise ()

Adds a new noise with default settings.

Return value

Number of the new noise in the list of noises.

void clearParticles ()

Deletes all particles spawned by the emitter.

float getAngleMean ()

Returns a mean value of emission angle.

Return value

Mean value in degrees.

float getAngleSpread ()

Returns a spread value of emission angle.

Return value

Spread value in degrees.

float getAngularDamping ()

Returns the current angular damping of particles. The default is 0.

Return value

Current angular damping.

int getCollision ()

Returns a value indicating if collision is detected by the outer surface of the sphere that approximates the particles. This method is slower than sphere center-based intersection detection, but more precise. The default is 0.

Return value

Positive number if sphere center-based intersection detection is enabled; otherwise, 0.

vec3 getContactNormal (int num)

Returns the point of the particles collision with other objects.

Arguments

  • int num - Collision point number.

Return value

Collision point coordinates.

Object getContactObject (int num)

Returns the object that collided with particles collided in a given collision point.

Arguments

  • int num - Collision point number.

Return value

Object participated in collision.

vec3 getContactPoint (int num)

Returns the normal vector for the collision point of the particles with other objects.

Arguments

  • int num - Collision point number.

Return value

Normal vector coordinates.

vec3 getContactVelocity (int num)

Returns the velocity in the collision point of the particles with other objects.

Arguments

  • int num - Collision point number.

Return value

Velocity values for each of space dimensions.

int getCulling ()

Returns a value indicating if particles would disappear upon collision or intersection. The default is 0.

Return value

Positive number if particles would disappear; otherwise, 0.

float getDeflectorRestitution (int deflector)

Returns the current restitution of the deflector. Makes sense only for reflectors. The default is 0.85.

Arguments

  • int deflector - Number of the deflector.

Return value

Restitution.

float getDeflectorRoughness (int deflector)

Returns the current roughness of the deflector. Makes sense only for reflectors. The default is 0.

Arguments

  • int deflector - Number of the deflector.

Return value

Roughness.

vec3 getDeflectorSize (int deflector)

Returns dimensions of a given deflector. The default is (1, 1, 0).

Arguments

  • int deflector - Number of the deflector.

Return value

Dimensions. Only the first two components should be taken into account (x and y).

mat4 getDeflectorTransform (int deflector)

Returns a transformation matrix of a given deflector. This matrix describes the position and orientation of the deflector. The default is the identity matrix.

Arguments

  • int deflector - Number of the deflector.

Return value

Transformation matrix.

int getDeflectorType (int deflector)

Returns a type of a given deflector. The default is OBJECT_PARTICLES_DEFLECTOR_REFLECTOR

Arguments

  • int deflector - Number of the deflector.

Return value

OBJECT_PARTICLES_DEFLECTOR_REFLECTOR or OBJECT_PARTICLES_DEFLECTOR_CLIPPER.

float getDelayMean ()

Returns a mean value of particles initialization delay relative to the parent particle system.

Return value

Mean value in seconds.

float getDelaySpread ()

Returns a spread value of particles initialization delay relative to the parent particle system.

Return value

Spread value in seconds.

int getDepthSort ()

Returns a value indicating if depth sorting of particles is enabled. Depth sorting is required, if particles use alpha blending. The default is 0.

Return value

Positive number if depth sorting is enabled; otherwise, 0.

float getDurationMean ()

Returns the current mean value of particle emission intervals. The default is INFINITY.

Return value

Mean value in seconds.

float getDurationSpread ()

Returns the current spread value of particle emission intervals. The default is 0.

Return value

Spread value in seconds.

vec3 getEmitterDirection ()

Returns the current direction of particles emission along the axes. The default is (0, 0, 0).

Return value

Current emission direction.

int getEmitterLimit ()

Returns the current maximum number of particles that an emitter can possibly spawn per one frame.

Return value

Maximum possible number of particles.

int getEmitterSequence ()

Returns the current rendering order of the particle system inside the particles hierarchy.

Return value

Rendering priority.

vec3 getEmitterSize ()

Returns the current emitter size. The default is (0, 0, 0).

Return value

Current size. Depending on the type of the emitter, this value is interpreted as follows:

vec3 getEmitterSpread ()

Returns the current spread of particles emission along the axes. The default is (1,1,1).

Return value

Spread of scattering.

int getEmitterSync ()

Returns a value indicating if a particle system emitter is synchronized to a parent particle system. The default is 1 (it is synchronized to a parent).

Return value

Positive number if it is synchronized; otherwise, 0.

int getEmitterType ()

Returns the type of the emitter. The default is OBJECT_PARTICLES_EMITTER_POINT .

Return value

OBJECT_PARTICLES_EMITTER_POINT, OBJECT_PARTICLES_EMITTER_SPHERE, OBJECT_PARTICLES_EMITTER_CYLINDER, OBJECT_PARTICLES_EMITTER_BOX or OBJECT_PARTICLES_EMITTER_WORLD.

vec3 getEmitterVelocity ()

Returns the current emitter velocity, which is added to the initial velocity of spawned particles. If the value equals 0, the actual velocity of emitter node will be used. The default is (0, 0, 0)..

Return value

Emitter velocity in units per second.

float getForceAttenuation (int num)

Returns the current attenuation factor for the specified force.

Arguments

  • int num - Force number.

Return value

Attenuation factor.

float getForceAttractor (int num)

Returns the current attraction force applied to the particles in the specified force radius.

Arguments

  • int num - Attraction force number.

Return value

Force value.

float getForceRadius (int num)

Returns the current radius set for applying the force.

Arguments

  • int num - Force number.

Return value

Radius in units.

float getForceRotator (int num)

Returns the current rotation force applied to the particles in the specified force radius.

Arguments

  • int num - Rotation force number.

Return value

Force value.

mat4 getForceTransform (int num)

Returns the current transformation matrix for the specified force.

Arguments

  • int num - Force number.

Return value

Transformation matrix.

vec3 getGravity ()

Returns the current gravity force influencing particles. The default is (0, 0, 0).

Return value

Current gravity force.

float getGrowthDamping ()

Returns the current damping of particles growth in size.

Return value

Current growth damping.

float getGrowthMean ()

Returns the current mean value of the particle growth factor. The default is 0.

Return value

Mean value.

float getGrowthSpread ()

Returns the current spread value of the particle growth factor. The default is 0.

Return value

Spread value.

int getIntersection ()

Returns a value indicating if collision is detected by the center of the sphere that approximates the particles. This method is faster than sphere-based collision detection, but less precise.

Return value

Positive number if sphere center-based intersection detection is enabled; otherwise, 0.

float getLengthFlattening ()

Returns the current factor of the linear interpolation between Z axis and the camera direction for the length particles. The default is 0.

Return value

Current flattening factor.

float getLengthStretch ()

Returns the current factor, by which length particles are stretched. The default is 0.

Return value

Current stretch factor.

float getLifeMean ()

Returns the current mean value of particle lifetime duration. The default is 1 second.

Return value

Mean value in seconds.

float getLifeSpread ()

Returns the current spread value of particle lifetime duration. The default is 0.5 seconds.

Return value

Spread value in seconds.

float getLinearDamping ()

Returns the current linear damping of particles. The default is 0.

Return value

Current linear damping.

float getNoiseForce (int num)

Returns the Force parameter value for the required noise.

Arguments

  • int num - Target noise number.

Return value

Noise force value.

int getNoiseFrequency (int num)

Returns the Frequency parameter value for the required noise.

Arguments

  • int num - Target noise number.

Return value

Noise frequency value.

Image getNoiseImage (int num)

Returns the spatial texture for the required noise.

Arguments

  • int num - Target noise number.

Return value

Texture of the noise.

vec3 getNoiseOffset (int num)

Returns the Offset parameter coordinates values for the required noise.

Arguments

  • int num - Target noise number.

Return value

Offset coordinates values.

float getNoiseScale (int num)

Returns the Scale parameter value for the required noise.

Arguments

  • int num - Target noise number.

Return value

Noise scale value.

int getNoiseSize (int num)

Returns the Size parameter value for the required noise.

Arguments

  • int num - Target noise number.

Return value

Noise size value.

vec3 getNoiseStep (int num)

Returns the Step parameter coordinates values for the required noise.

Arguments

  • int num - Target noise number.

Return value

Step coordinates values.

mat4 getNoiseTransform (int num)

Returns the transformation matrix for the required noise.

Arguments

  • int num - Target noise number.

Return value

Noise transformation matrix.

int getNumContacts ()

Returns the total number of particles collisions with other objects.

Return value

The number of collisions.

int getNumDeflectors ()

Returns the current number of deflectors.

Return value

The number of deflectors.

int getNumForces ()

Returns the number of currently acting forces.

Return value

The number of forces.

int getNumNoises ()

Returns the current number of noises.

Return value

Number of the noises.

int getNumParticles ()

Returns the current number of particles.

Return value

The number of particles.

vec3 getParticlePosition (int num)

Returns the position of a given particle.

Arguments

  • int num - Particle number.

Return value

Position coordinates for a particle.

float getParticleRadius (int num)

Returns the radius of a given particle.

Arguments

  • int num - Particle number.

Return value

Radius of a particle.

void getParticleTransforms (int transforms)

Returns transformation matrices for spawned particles.

Arguments

  • int transforms - ID of the return array.

vec3 getParticleVelocity (int num)

Returns the velocity vector for a specified particle.

Arguments

  • int num - Particle number.

Return value

Velocity vector.

int getParticlesType ()

Returns the type of emitted particles. The default is OBJECT_PARTICLES_TYPE_BILLBOARD .

Return value

OBJECT_PARTICLES_TYPE_BILLBOARD, OBJECT_PARTICLES_TYPE_FLAT, OBJECT_PARTICLES_TYPE_POINT or OBJECT_PARTICLES_TYPE_LENGTH.

float getPeriodMean ()

Returns the current mean value of emitter inactivity intervals. The default is 0 seconds.

Return value

Mean value in seconds.

float getPeriodSpread ()

Returns the current spread value of emitter inactivity intervals. The default is 0 seconds.

Return value

Spread value in seconds.

int getPhysicalMask ()

Returns the bit mask for interactions with physicals. Two objects interact, if they both have matching masks.

Return value

Integer, each bit of which is a mask.

float getPhysicalMass ()

Returns the current mass of the particles. This value matters only for computing physical interactions.

Return value

Particles mass.

float getRadiusMean ()

Returns the current mean value of particle radii. The default is 1 unit.

Return value

Mean value in units.

float getRadiusSpread ()

Returns the current spread value of particle radii. The default is 0.5 units.

Return value

Spread value in units.

float getRestitution ()

Returns the current restitution of particles. The default is 0.5.

Return value

Current restitution.

float getRotationMean ()

Returns the current mean value of the angles, at which emitted particles are rotated. The default is 0 degrees.

Return value

Mean value in degrees.

float getRotationSpread ()

Returns the current spread value of the angles, at which emitted particles are rotated. The default is 0 degrees.

Return value

Spread value in degrees.

float getRoughness ()

Returns the current roughness of particle surface. The default is 0.

Return value

Current roughness.

int getSeed ()

Returns a seed value used for the particles' random generator.

Return value

Seed value.

float getSpawnRate ()

Returns the current particle spawn rate. The default is 20.

Return value

Current spawn rate.

float getSpawnScale ()

Returns the current spawn scale that allows to modulate smooth and gradual initialization of the particle system starting with the given spawn state and up to the specified spawn rate.

Return value

Current spawn scale.

float getSpawnThreshold ()

Returns the current velocity threshold for spark and random emitters. They spawn particles if velocity of the parent particles is high enough.

Return value

Velocity threshold of the parent particles.

int getTextureAtlas ()

Returns a value indicating if a diffuse texture for the particles is used as a 4x4 texture atlas. The default is 0.

Return value

Positive number if a texture atlas is used; otherwise, 0.

int getVariationX ()

Returns a value indicating if the initial orientation of particles diffuse texture is randomly varied along X axis.

Return value

Positive number if there is random variation along X axis, 0 if not.

int getVariationY ()

Returns a value indicating if the initial orientation of particles diffuse texture is randomly varied along Y axis.

Return value

Positive number if there is random variation along Y axis, 0 if not.

float getVelocityMean ()

Returns the current mean value of the initial particle velocities. The default is 1 unit per second.

Return value

Mean value in units per second.

float getVelocitySpread ()

Returns the current spread value of the initial particle velocities. The default is 0.5 units per second.

Return value

Spread value in units per second.

int getWarming ()

Returns a value indicating if warm start is enabled for the particles. It means that the particle system starts to be rendered with already emitted particles, rather then from a zero point.

Return value

1 if warm start is enabled; 0 if disabled.

int isDeflectorAttached (int deflector)

Returns a value indicating if a given deflector is attached to the particle system. The default is 1.

Arguments

  • int deflector - Number of the deflector.

Return value

Positive number if the deflector is attached; otherwise, 0.

int isEmitterBased ()

Returns a value indicating if particles follow emitter transformations, i.e. the direction of their flow changes after the emitter.

Return value

Positive number if particles follow emitter transformations; otherwise, 0.

int isEmitterContinuous ()

Returns a value indicating if additional spawn points are generated when the emitter is moved, which provides a continuous flow of particles. The default is 1.

Return value

Positive number if particles are created in the continuous flow; otherwise, 0.

int isEmitterEnabled ()

Returns a value indicating if particle emission is enabled.

Return value

Positive number if emission is enabled; otherwise, 0.

int isEmitterShift ()

Returns a value indicating if the emitter spawns particles only when it is moving. The further it has moved, if compared to its position in the previous frame, the more particles will be spawned. If the emitter is not moving, there are particles at all. The default is 0.

Return value

Positive number if shift-based spawning is enabled; 0 if not.

int isForceAttached (int force)

Returns a value indicating if the given force is attached to the particle system. The default value is 1.

Arguments

  • int force - Number of the force.

Return value

Positive number if the force is attached; otherwise, 0.

int isNoiseAttached (int num)

Returns a value indicating if the given noise is attached to the particle system. The default value is 1.

Arguments

  • int num - Target noise number.

Return value

1 if the noise is attached; otherwise - 0.

void removeDeflector (int deflector)

Removes a given point deflector.

Arguments

  • int deflector - Number of the deflector to remove.

void removeForce (int force)

Removes the given force.

Arguments

  • int force - Number of the force to remove.

void removeNoise (int num)

Removes the given noise.

Arguments

  • int num - Target noise number.

void setAngle (float mean, float spread)

Sets an angle of emission. The default is 0 and 180 respectively.

Arguments

  • float mean - Mean value in degrees.
  • float spread - Spread value in degrees.

void setAngularDamping (float damping)

Sets angular damping of particles. The default is 0.

Arguments

  • float damping - New angular damping. If a negative value is provided, 0 will be used instead.

void setCollision (int mode)

Enables or disables detecting collision by the outer surface of the sphere that approximates the particles. This method is slower than intersection detection, but more precise. The default is 0. Enables or disables particle collision detection. Each particle is approximated with a sphere.

Arguments

  • int mode - Positive number to enable sphere-based collision detection, 0 to disable it.

void setCulling (int culling)

Sets a value indicating if particles should disappear upon collision or intersection. The default is 0.

Arguments

  • int culling - Positive number to make particles disappear; 0 to continue rendering of particles after collision/intersection.

void setDeflectorAttached (int deflector, int mode)

Attaches or detaches a given deflector to the particle system.

Arguments

  • int deflector - Number of the deflector.
  • int mode - Positive number to attach the deflector, 0 to detach it.

void setDeflectorRestitution (int deflector, float restitution)

Sets restitution of the deflector. Makes sense only for reflectors.

Arguments

  • int deflector - Number of the deflector.
  • float restitution - New restitution. The provided value will be saturated in the range [0; 1].

void setDeflectorRoughness (int deflector, float roughness)

Sets roughness of the deflector surface. Makes sense only for reflectors.

Arguments

  • int deflector - Number of the deflector.
  • float roughness - New roughness. The provided value will be saturated in the range [0; 1].

void setDeflectorSize (int deflector, vec3 dimensions)

Sets dimensions of a given deflector.

Arguments

  • int deflector - Number of the deflector.
  • vec3 dimensions - New dimensions. Only the first two components are taken into account (x and y).

void setDeflectorTransform (int deflector, mat4 matrix)

Sets a transformation matrix for a given deflector. This matrix describes the position and orientation of the deflector.

Arguments

  • int deflector - Number of the deflector.
  • mat4 matrix - New transformation matrix.

void setDeflectorType (int deflector, int type)

Sets a type of a given deflector.

Arguments

void setDelay (float mean, float spread)

Sets delay of particle system initialization relative to the parent particle one. The default values are (0,0).

Arguments

  • float mean - Mean value in seconds. If a negative value is provided, 0 will be used instead.
  • float spread - Spread value in seconds.

void setDepthSort (int mode)

Enables or disables depth sorting of particles. Depth sorting is required, if particles use alpha blending. The default is 0.

Arguments

  • int mode - Positive number to enable depth sorting, 0 to disable it.

void setDuration (float mean, float spread)

Sets a duration of each particle emission in seconds. The default values are infinity and 0 seconds respectively.

Arguments

  • float mean - Mean value in seconds. If a negative value is provided, 0 will be used instead.
  • float spread - Spread value in seconds.

void setEmitterBased (int based)

Sets a value indicating if particles should follow emitter transformations, i.e. the direction of their flow should change after the emitter. The default is 0.

Arguments

  • int based - Positive number for particles to follow emitter transformations; 0 for them to flow independently.

void setEmitterContinuous (int continuous)

Sets a value indicating if additional spawn points should be generated when the emitter is moved, which provides a continuous flow of particles. The default is 1.

Arguments

  • int continuous - Positive number to create the continuous flow of particles; 0 to create discrete flow with sparse generation points.

void setEmitterDirection (vec3 direction)

Sets the direction of particles emission along the axes.

Arguments

  • vec3 direction - Emission direction.

void setEmitterEnabled (int mode)

Enables or disables particle emission.

Arguments

  • int mode - Positive number to enable particle emission, 0 to disable it.

void setEmitterLimit (int limit)

Sets the maximum number of particles that an emitter can possibly spawn per one frame. The default is 10000.

Arguments

  • int limit - Maximum possible number of particles. If a negative value is provided, 0 will be used instead.

void setEmitterSequence (int sequence)

Sets the rendering order of the particle system inside the particles hierarchy. The default is 0.

Arguments

  • int sequence - Rendering priority. First are rendered particle systems with the lowest order number.

void setEmitterShift (int shift)

Sets a value indicating if the emitter spawns particles only when it is moving. The further it has moved, if compared to its position in the previous frame, the more particles will be spawned. If the emitter is not moving, there are particles at all. The default is 0.

Arguments

  • int shift - Positive number to enable shift-based spawning; 0 to disable.

void setEmitterSize (vec3 size)

Sets a size of the emitter.

Arguments

void setEmitterSpread (vec3 spread)

Set the spread of particles emission along the axes. The default is (1,1,1).

Arguments

  • vec3 spread - Spread of scattering.

void setEmitterSync (int sync)

Sets a value indicating if a particle system emitter need to be synchronized to a parent particle system. The default is 1 (it is synchronized to a parent).

Arguments

  • int sync - Positive number synchronize; otherwise, 0.

void setEmitterType (int type)

Sets a type of the emitter.

Arguments

  • int type - One of the OBJECT_PARTICLES_EMITTER_* variables.

void setEmitterVelocity (vec3 velocity)

Sets the emitter velocity, which is added to the initial velocity of spawned particles. If the value equals 0, the actual velocity of emitter node will be used.

Arguments

  • vec3 velocity - Emitter velocity in units per second.

void setForceAttached (int force, int mode)

Attaches or detaches the given force to the particle system.

Arguments

  • int force - Number of the force.
  • int mode - Positive number to attach the force, 0 to detach it.

void setForceAttenuation (int num, float attenuation)

Sets an attenuation factor for the specified force.

Arguments

  • int num - Force number.
  • float attenuation - Attenuation factor.

void setForceAttractor (int num, float attractor)

Sets attraction force that will be applied to the particles in the specified force radius.

Arguments

  • int num - Attraction force number.
  • float attractor - Force value.

void setForceRadius (int num, float radius)

Sets a radius for applying the force.

Arguments

  • int num - Force number.
  • float radius - Radius in units. If a negative value is provided, 0 will be used instead.

void setForceRotator (int num, float rotator)

Sets a rotation force that will be applied to the particles in the specified force radius.

Arguments

  • int num - Rotation force number.
  • float rotator - Force value.

void setForceTransform (int num, mat4 transform)

Sets a transformation matrix for the specified force.

Arguments

  • int num - Force number.
  • mat4 transform - Transformation matrix.

void setGravity (vec3 gravity)

Sets a gravity force influencing particles.

Arguments

  • vec3 gravity - Gravity force.

void setGrowthDamping (float damping)

Sets the damping of particles growth in size. The default is 0.

Arguments

  • float damping - New growth damping. If negative value is provided, 0 will be used instead.

void setGrowth (float mean, float spread)

Sets a particle growth factor. The default is 0 for both values.

Arguments

  • float mean - Mean value.
  • float spread - Spread value.

void setIntersection (int mode)

Enables or disables detecting collision by the center of the sphere that approximates the particles. This method is faster than collision detection, but less precise. The default is 0.

Arguments

  • int mode - Positive number to detect intersections, 0 not to detect.

void setLengthFlattening (float flattening)

Sets a factor of the linear interpolation between Z axis and the camera direction for the length particles. The default is 0.

Arguments

  • float flattening - Flattening factor. If a negative value is provided, 0 will be used instead.

void setLengthStretch (float stretch)

Sets a factor, by which length particles will be stretched. The default is 0.

Arguments

  • float stretch - Stretch factor. If a negative value is provided, 0 will be used instead.

void setLife (float mean, float spread)

Sets a lifetime duration of particles in seconds. The default values are 1 and 0.5 seconds respectively.

Arguments

  • float mean - Mean value in seconds. If a too small value is provided, 1E-6 will be used instead.
  • float spread - Spread value in seconds.

void setLinearDamping (float damping)

Sets linear damping of particles. The default is 0.

Arguments

  • float damping - New linear damping. If a negative value is provided, 0 will be used instead.

void setNoiseAttached (int num, int attached)

Sets the noise as an attached.

Arguments

  • int num - Target noise number.
  • int attached - 1 to enable an Attached flag, 0 - to disable it.

void setNoiseForce (int num, float damping)

Sets the Force parameter value for the required noise.

Arguments

  • int num - Target noise number.
  • float damping - Noise force value.

void setNoiseFrequency (int num, int frequency)

Sets the Frequency parameter value for the required noise.

Arguments

  • int num - Target noise number.
  • int frequency - Noise frequency value.

void setNoiseOffset (int num, vec3 offset)

Sets the Offset parameter coordinates values for the required noise.

Arguments

  • int num - Target noise number.
  • vec3 offset - Offset coordinates values.

void setNoiseScale (int num, float scale)

Sets the Scale parameter value for the required noise.

Arguments

  • int num - Target noise number.
  • float scale - Noise scale value.

void setNoiseSize (int num, int size)

Sets the Size parameter value for the required noise.

Arguments

  • int num - Target noise number.
  • int size - Noise size value.

void setNoiseStep (int num, vec3 step)

Sets the Step parameter coordinates values for the required noise.

Arguments

  • int num - Target noise number.
  • vec3 step - Step coordinates values.

void setNoiseTransform (int num, mat4 transform)

Sets the transformation matrix for the required noise.

Arguments

  • int num - Target noise number.
  • mat4 transform - Noise transformation matrix.

void setParticlesType (int type)

Sets a type of particles to emit.

Arguments

  • int type - One of the OBJECT_PARTICLES_TYPE_* variables.

void setPeriod (float mean, float spread)

Sets an interval of emitter inactivity in seconds. The default values are (0,0).

Arguments

  • float mean - Mean value in seconds. If a negative value is provided, 0 will be used instead.
  • float spread - Spread value in seconds.

void setPhysicalMask (int mask)

Sets the bit mask for interactions with physicals. Two objects interact, if they both have matching masks.

Arguments

  • int mask - Integer, each bit of which is a mask.

void setPhysicalMass (float mass)

Sets the mass of the particles. This value matters only for computing physical interactions.

Arguments

  • float mass - Particles mass.

void setRadius (float mean, float square)

Sets a particle radius in units. The default is 1 and 0.5 respectively.

Arguments

  • float mean - Mean value in units. If a too small value is provided, 1E-6 will be used instead.
  • float square - Spread value in units.

void setRestitution (float restitution)

Sets restitution of particles. The default is 0.5.

Arguments

  • float restitution - New restitution. The provided value will be saturated in the range [0; 1].

void setRotation (float mean, float spread)

Sets an angle in degrees, at which emitted particles should be rotated. The default is 0 for both values.

Arguments

  • float mean - Mean value in degrees.
  • float spread - Spread value in degrees.

void setRoughness (float roughness)

Sets roughness of particle surface. The default is 0.

Arguments

  • float roughness - New roughness. The provided value will be saturated in the range [0; 1].

void setSeed (int seed)

Sets a seed value for the particles' random generator.

Arguments

  • int seed - Seed value.

void setSpawnRate (float rate)

Sets a rate, at which particles are created. The default is 20.

Arguments

  • float rate - New spawn rate. If a too small value is provided, 1E-6 will be used instead.

void setSpawnScale (float scale)

Sets a spawn scale that allows to modulate smooth and gradual initialization of the particle system starting with the given spawn state and up to the specified spawn rate.

Arguments

  • float scale - Spawn scale. The provided value is clipped to range [0;1]. By the value of 0, there are no spawned particles at the start. By the value of 1, the system is initialized with the specified spawn rate.

void setSpawnThreshold (float threshold)

Sets the velocity threshold for spark and random emitters. They spawn particles if velocity of the parent particles is high enough. The default is 0.

Arguments

  • float threshold - Velocity threshold for the parent particles.

void setTextureAtlas (int atlas)

Sets a value indicating if a diffuse texture for the particles is a 4x4 texture atlas. The default is 0.

Arguments

  • int atlas - Positive number if a texture atlas is used; 0 if an ordinary diffuse texture is assigned.

void setVariationX (int variation)

Sets a value indicating if the initial orientation of particles diffuse texture should be randomly varied along X axis. The default is 0.

Arguments

  • int variation - Positive number to add random variation along X axis, 0 not to add.

void setVariationY (int variation)

Sets a value indicating if the initial orientation of particles diffuse texture should be randomly varied along Y axis. The default is 0.

Arguments

  • int variation - Positive number to add random variation along Y axis, 0 not to add.

void setVelocity (float mean, float spread)

Sets an initial particle velocity in units per second. The default is 1 and 0.5 units per second respectively.

Arguments

  • float mean - Mean value in units per second.
  • float spread - Spread value in units per second.

void setWarming (int warming)

Enables the warm start for the particles. It means that the particle system starts to be rendered with already emitted particles, rather then from a zero point. The default is 1.

Arguments

  • int warming - Positive number to enable the warm start; 0 to disable.

int OBJECT_PARTICLES_DEFLECTOR_CLIPPER

Description

When a particle hits a deflector of this type, the particle is removed.

int OBJECT_PARTICLES_DEFLECTOR_REFLECTOR

Description

When a particle hits a deflector of this type, the particle bounces off it.

int OBJECT_PARTICLES_EMITTER_BOX

Description

Box emitter. Particles are emitted from a random point of the box.

int OBJECT_PARTICLES_EMITTER_CYLINDER

Description

Cylinder emitter. Particles are emitted from a random point of the cylinder.

int OBJECT_PARTICLES_EMITTER_POINT

Description

Point emitter. Particles are emitted from one single point.

int OBJECT_PARTICLES_EMITTER_RANDOM

Description

Arbitrary emitter. Particles are emitted from a random point of their parent node. With an emitter of this type you can create particles, which spawn particles themselves.

int OBJECT_PARTICLES_EMITTER_SHIFT

Description

Emitter of this type generates particles only when it is moving.

int OBJECT_PARTICLES_EMITTER_SPARK

Description

Spark emitter. Sparks can be generated in the collision point either of the particles set as parent or any other node.

int OBJECT_PARTICLES_EMITTER_SPHERE

Description

Sphere emitter. Particles are emitted from a random point of the sphere.

int OBJECT_PARTICLES_TYPE_BILLBOARD

Description

Particles of this type are camera-oriented and rotating.

int OBJECT_PARTICLES_TYPE_CHAIN

Description

Particles of this type are camera-oriented and connected with each other at vertices forming continuous flow.

int OBJECT_PARTICLES_TYPE_FLAT

Description

Particles of this type are perpendicular to the z-axis of their particle system.

int OBJECT_PARTICLES_TYPE_LENGTH

Description

Particles of this type are similar to billboard particles, but stretched along the direction of their motion and do not rotate.

int OBJECT_PARTICLES_TYPE_POINT

Description

Particles of this type are similar to billboard particles, but do not rotate.

int OBJECT_PARTICLES_TYPE_RANDOM

Description

Particles of this type are arbitrary oriented ones.

int OBJECT_PARTICLES_TYPE_ROUTE

Description

Particles of this type can be used to create tracks from moving objects (for example, foam after a ship). Each Route particle is flat (just like Flat particles), but is oriented on the plane in the same way as the emitter when it spawned it.
Last update: 2017-07-03
Build: ()