This page has been translated automatically.
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
Extending Editor Functionality
FAQ
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes
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.

Unigine::ObjectParticles Class

Header: #include <UnigineObjects.h>
Inherits: Object

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.

See Also#

A set of UnigineScript API samples located in the <UnigineSDK>/data/samples/objects/ folder:

Usage Example#

In the following example, we create a new particle system, specify its settings by means of C++ API.

Prior Knowledge
It is supposed that you have already created an empty C++ project by using UNIGINE SDK Browser.

In the AppWorldLogic.h file, we define the following smart pointers:

  • ObjectParticlesPtr for a particle system
  • NodePtr for a world light source
Source code (C++)
// AppWorldLogic.h

#include <UnigineLogic.h>
#include <UnigineStreams.h>
#include <UnigineObjects.h>

class AppWorldLogic : public Unigine::WorldLogic {
	
public:
	
	/* ... */

private:
	// define smart pointers to particles and sun nodes
	Unigine::ObjectParticlesPtr particles;
	Unigine::NodePtr sun;
};

In the AppWorldLogic.cpp file, we create a new particle system, specify its settings and disable the world light source called "sun" to make the particle system visually identifiable.

Source code (C++)
// AppWorldLogic.cpp

#include "AppWorldLogic.h"
#include "UnigineEditor.h"
#include "UnigineGame.h"

using namespace Unigine;
using namespace Math;

int AppWorldLogic::init() {
	particles = ObjectParticles::create();

	// set world transform to the particle system, specify its material and material diffuse parameter
	particles->setWorldTransform(Mat4(quat(0.0f, 0.0f, 0.0f, 0.0f)));
	particles->setMaterial("particles_base", "*");
	particles->setMaterialParameter("diffuse_color", vec4(0.5f, 0.1f, 0.0f, 1.0f), 0);

	// enable the emitter and specify its setttings
	particles->setEmitterEnabled(1);
	particles->setSpawnRate(2000.0f);
	particles->setLife(5.0f, 0.5f);
	particles->setRadius(0.2f, 0.1f);
	particles->setGrowth(0.1f, 0.1f);
	particles->setVelocity(3.0f, 2.0f);
	particles->setGravity(vec3(0.0f, 0.0f, 4.0f));

	// disable the sun node
	sun = World::getNodeByName("sun");
	sun->setEnabled(0);

	return 1;
}

int AppWorldLogic::update() {
	// set transformation for particle system
	float time = Game::getTime();
	particles->setWorldTransform(Mat4(rotateZ(time * 64.0f) * translate(15.0f, 0.0f, 0.0f)));
	return 1;
}

int AppWorldLogic::shutdown() {
	// clear the pointer to particles
	// you don't need to clear the pointer to the sun node because Editor is the owner
	particles.clear();

	return 1;
}

If you launch the application, you get the following particle system:

ObjectParticles Class

Enums

SYNC_MODE#

Synchronization mode to be used for the particle system.
NameDescription
SYNC_MODE_NONE = 0
SYNC_MODE_MASTER = 1
SYNC_MODE_SLAVE = 2

Members


static ObjectParticlesPtr create ( ) #

Constructor. Creates a particle system.

void setAngle ( float mean, float spread ) #

Sets an angle of emission.

Arguments

  • float mean - A mean value in degrees.
  • float spread - A spread value in degrees.

float getAngleMean ( ) #

Returns the mean value of the emission angle.

Return value

The mean value in degrees.

float getAngleSpread ( ) #

Returns the spread value of the emission angle.

Return value

The spread value in degrees.

void setAngularDamping ( float damping ) #

Sets an angular damping of particles.

Arguments

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

float getAngularDamping ( ) #

Returns the current angular damping of particles.

Return value

The current angular damping.

BoundBox getBoundBoxParticles ( ) #

Returns the estimated bounding box considering the changes of the particle system (velocity, length, etc.).

Return value

Bounding box

BoundBox getBoundBoxSimulation ( ) #

Returns the exact bounding box of the particles system.

Return value

Bounding box

void setClearOnEnable ( bool enable ) #

Enables or disables re-initialization of the particle system each time it is enabled. When this option is disabled, turning on the particle system will restore the state it had before it was turned off.

Arguments

  • bool enable - 1 to re-initialize particle system each time it is enabled; otherwise, 0.

bool isClearOnEnable ( ) #

Returns a value indicating if particle system is to be re-initialized each time it is enabled.

Return value

1 if particle system is to be re-initialized each time it is enabled; otherwise, 0.

void setCollision ( int collision ) #

Enables or disables detecting collision by the outer surface of the sphere that approximates the particles (each particle is approximated with the sphere). This method is slower than intersection detection, but more precise.

Arguments

  • int collision - 1 to enable sphere-based collision detection, 0 to disable it.

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.

Return value

1 if the sphere-based collision detection is enabled; otherwise, 0.

Math::vec3 getContactNormal ( int num ) #

Returns the point of the particles collision with other objects.

Arguments

  • int num - The collision point number.

Return value

Collision point coordinates.

Ptr<Object> getContactObject ( int num ) #

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

Arguments

  • int num - The collision point number.

Return value

The object participated in collision.

Math::Vec3 getContactPoint ( int num ) #

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

Arguments

  • int num - The collision point number.

Return value

Normal vector coordinates.

Math::vec3 getContactVelocity ( int num ) #

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

Arguments

  • int num - The collision point number.

Return value

Velocity values for each of space dimensions.

void setCulling ( int culling ) #

Sets a value indicating if particles should disappear upon collision or intersection.

Arguments

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

int getCulling ( ) #

Returns a value indicating if particles would disappear upon collision or intersection.

Return value

1 if particles would disappear; otherwise, 0.

void setDeflectorAttached ( int num, int attached ) #

Attaches or detaches a given deflector to the particle system.

Arguments

  • int num - The deflector number.
  • int attached - 1 to attach the deflector, 0 to detach it.

int isDeflectorAttached ( int num ) #

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

Arguments

  • int num - The deflector number.

Return value

1 if the deflector is attached; otherwise, 0.

void setDeflectorEnabled ( int num, bool enabled ) #

Enables or disables the given deflector.

Arguments

  • int num - The deflector number.
  • bool enabled - 1 to enable the deflector, 0 to disable it.

bool isDeflectorEnabled ( int num ) #

Returns a value indicating if the given deflector is enabled.

Arguments

  • int num - The deflector number.

Return value

1 if the deflector is enabled; otherwise, 0.

void setDeflectorRestitution ( int num, float restitution ) #

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

Arguments

  • int num - The deflector number.
  • float restitution - A new restitution. The provided value will be saturated in the range [0; 1].

float getDeflectorRestitution ( int num ) #

Returns the current restitution of the deflector. Makes sense only for reflectors.

Arguments

  • int num - The deflector number.

Return value

The current restitution.

void setDeflectorRoughness ( int num, float roughness ) #

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

Arguments

  • int num - The deflector number.
  • float roughness - A new roughness. The provided value will be saturated in the range [0; 1].

float getDeflectorRoughness ( int num ) #

Returns the current roughness of the deflector. Makes sense only for reflectors.

Arguments

  • int num - The deflector number.

Return value

The current roughness.

void setDeflectorSize ( int num, const Math::vec3 & size ) #

Sets dimensions of a given deflector.

Arguments

  • int num - The deflector number.
  • const Math::vec3 & size - New dimensions. Only the first two components are taken into account (x and y).

Math::vec3 getDeflectorSize ( int num ) #

Returns the current dimensions of the given deflector.

Arguments

  • int num - The deflector number.

Return value

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

void setDeflectorTransform ( int num, const Math::Mat4 & transform ) #

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

Arguments

  • int num - The deflector number.
  • const Math::Mat4 & transform - A new transformation matrix.

Math::Mat4 getDeflectorTransform ( int num ) #

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

Arguments

  • int num - The deflector number.

Return value

The transformation matrix.

void setDeflectorType ( int num, int type ) #

Sets a type of a given deflector.

Arguments

  • int num - The deflector number.
  • int type - DEFLECTOR_REFLECTOR or DEFLECTOR_CLIPPER.

int getDeflectorType ( int num ) #

Returns a type of a given deflector.

Arguments

  • int num - The deflector number.

Return value

DEFLECTOR_REFLECTOR or DEFLECTOR_CLIPPER.

void setDelay ( float mean, float spread ) #

Sets delay of particle system initialization relative to the parent particle one.

Arguments

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

float getDelayMean ( ) #

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

Return value

The mean value in seconds.

float getDelaySpread ( ) #

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

Return value

The spread value in seconds.

void setDepthSort ( int sort ) #

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

Arguments

  • int sort - 1 to enable the depth sorting, 0 to disable it.

int getDepthSort ( ) #

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

Return value

1 if the depth sorting is enabled; otherwise, 0.

void setDuration ( float mean, float spread ) #

Sets a duration of each particle emission in seconds.

Arguments

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

float getDurationMean ( ) #

Returns the current mean value of particle emission intervals.

Return value

The mean value in seconds.

float getDurationSpread ( ) #

Returns the current spread value of particle emission intervals.

Return value

The spread value in seconds.

void setEmitterBased ( bool based ) #

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

Arguments

  • bool based - 1 for particles to follow emitter transformations; 0 for them to flow independently.

bool isEmitterBased ( ) #

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

Return value

1 if particles follow emitter transformations; otherwise, 0.

void setEmitterContinuous ( bool continuous ) #

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

Arguments

  • bool continuous - 1 to create the continuous flow of particles; 0 to create the discrete flow with sparse generation points.

bool isEmitterContinuous ( ) #

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

Return value

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

void setEmitterDirection ( const Math::vec3 & direction ) #

Sets the direction of particles emission along the axes.

Arguments

  • const Math::vec3 & direction - The emission direction.

Math::vec3 getEmitterDirection ( ) #

Returns the current direction of particles emission along the axes.

Return value

The current emission direction.

void setEmitterEnabled ( bool enabled ) #

Enables or disables particle emission.

Arguments

  • bool enabled - 1 to enable particle emission, 0 to disable it.

bool isEmitterEnabled ( ) #

Returns a value indicating if particle emission is enabled.

Return value

1 if emission is enabled; otherwise, 0.

void setEmitterLimit ( int limit ) #

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

Arguments

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

int getEmitterLimit ( ) #

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

Return value

The maximum possible number of particles.

void setEmitterSequence ( int sequence ) #

Sets the rendering order of the particle system inside the particles hierarchy.

Arguments

  • int sequence - The rendering priority. Particle systems with the lowest order number are rendered first.

int getEmitterSequence ( ) #

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

Return value

The current rendering priority.

void setEmitterShift ( bool 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 no particles at all.

Arguments

  • bool shift - 1 to enable the shift-based spawning; 0 to disable it.

bool 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 no particles at all.

Return value

1 if the shift-based spawning is enabled; 0 if it is not.

void setEmitterSize ( const Math::vec3 & size ) #

Sets a size of the emitter.

Arguments

  • const Math::vec3 & size - A new emitter size. If negative values are provided, 0 will be used instead of them. Depending on the type of the emitter, this value is interpreted as follows:
    • EMITTER_POINT, EMITTER_SPARK, EMITTER_RANDOM: all vector components are ignored.
    • EMITTER_SPHERE: the first vector component is the radius of the sphere.
    • EMITTER_CYLINDER: the first vector component is the radius of the cylinder, the second vector component is the height of the cylinder.
    • EMITTER_BOX: all vector components are interpreted as box dimensions (x, y, z).

Math::vec3 getEmitterSize ( ) #

Returns the current emitter size.

Return value

The current size of the emitter. Depending on the type of the emitter, this value is interpreted as follows:
  • EMITTER_POINT, EMITTER_SPARK, EMITTER_RANDOM: all vector components are ignored.
  • EMITTER_SPHERE: the first vector component is the radius of the sphere.
  • EMITTER_CYLINDER: the first vector component is the radius of the cylinder, the second vector component is the height of the cylinder.
  • EMITTER_BOX: all vector components are interpreted as box dimensions (x, y, z).

void setEmitterSpread ( const Math::vec3 & spread ) #

Sets a spread of particles emission along the axes.

Arguments

  • const Math::vec3 & spread - A spread of particles emission.

Math::vec3 getEmitterSpread ( ) #

Returns the current spread of particles emission along the axes.

Return value

The spread of particles emission.

void setEmitterSync ( int sync ) #

Sets a value indicating if a particle system emitter needs to be synchronized to a parent particle system.

Arguments

  • int sync - 1 to synchronize the emitter; otherwise, 0.

int getEmitterSync ( ) #

Returns a value indicating if a particle system emitter is synchronized to a parent particle system.

Return value

1 if it is synchronized; otherwise, 0.

void setEmitterType ( int type ) #

Sets a type of the emitter.

Arguments

  • int type - The type of the emitter (one of the EMITTER_* values).

int getEmitterType ( ) #

Returns the type of the emitter.

Return value

The type of the emitter (one of the EMITTER_* values).

void setEmitterVelocity ( const Math::vec3 & velocity ) #

Sets an 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

  • const Math::vec3 & velocity - An emitter velocity in units per second.

Math::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.

Return value

The emitter velocity in units per second.

void setForceAttached ( int num, int attached ) #

Attaches or detaches the given force to the particle system.

Arguments

  • int num - The force number.
  • int attached - 1 to attach the force, 0 to detach it.

int isForceAttached ( int num ) #

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

Arguments

  • int num - The force number.

Return value

1 if the force is attached; otherwise, 0.

void setForceAttenuation ( int num, float attenuation ) #

Sets an attenuation factor for the specified force.

Arguments

  • int num - The force number.
  • float attenuation - An attenuation factor.

float getForceAttenuation ( int num ) #

Returns the current attenuation factor for the specified force.

Arguments

  • int num - The force number.

Return value

The current attenuation factor.

void setForceAttractor ( int num, float attractor ) #

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

Arguments

  • int num - The attraction force number.
  • float attractor - The force value.

float getForceAttractor ( int num ) #

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

Arguments

  • int num - The attraction force number.

Return value

The force value.

void setForceEnabled ( int num, bool enabled ) #

Enables or disables the given force.

Arguments

  • int num - The force number.
  • bool enabled - 1 to enable the force, 0 to disable it.

bool isForceEnabled ( int num ) #

Returns a value indicating if the given force is enabled.

Arguments

  • int num - The force number.

Return value

1 if the force is enabled; otherwise, 0.

void setForceRadius ( int num, float radius ) #

Sets a radius for applying the force.

Arguments

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

float getForceRadius ( int num ) #

Returns the current radius set for applying the force.

Arguments

  • int num - The force number.

Return value

The current radius in units.

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 - The rotation force number.
  • float rotator - The force value.

float getForceRotator ( int num ) #

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

Arguments

  • int num - The rotation force number.

Return value

The force value.

void setForceTransform ( int num, const Math::Mat4 & transform ) #

Sets a transformation matrix for the specified force.

Arguments

  • int num - The force number.
  • const Math::Mat4 & transform - A transformation matrix.

Math::Mat4 getForceTransform ( int num ) #

Returns the current transformation matrix for the specified force.

Arguments

  • int num - The force number.

Return value

The transformation matrix.

void setGravity ( const Math::vec3 & gravity ) #

Sets a gravity force influencing particles.

Arguments

  • const Math::vec3 & gravity - A gravity force.

Math::vec3 getGravity ( ) #

Returns the current gravity force influencing particles.

Return value

The current gravity force.

void setGrowth ( float mean, float spread ) #

Sets a particle growth factor.

Arguments

  • float mean - A mean value.
  • float spread - A spread value.

void setGrowthDamping ( float damping ) #

Sets the damping of particles growth in size.

Arguments

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

float getGrowthDamping ( ) #

Returns the current damping of particles growth in size.

Return value

The current growth damping.

float getGrowthMean ( ) #

Returns the current mean value of the particle growth factor.

Return value

The mean value.

float getGrowthSpread ( ) #

Returns the current spread value of the particle growth factor.

Return value

The spread value.

void setIntersection ( int intersection ) #

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.

Arguments

  • int intersection - 1 to detect intersections, 0 not to detect.

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

1 if the sphere center-based intersection detection is enabled; otherwise, 0.

void setLengthFlattening ( float flattening ) #

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

Arguments

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

float getLengthFlattening ( ) #

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

Return value

The current flattening factor.

void setLengthStretch ( float stretch ) #

Sets a factor by which length particles will be stretched.

Arguments

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

float getLengthStretch ( ) #

Returns the current factor, by which length particles are stretched.

Return value

The current stretch factor.

void setLife ( float mean, float spread ) #

Sets a lifetime duration of particles in seconds.

Arguments

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

float getLifeMean ( ) #

Returns the current mean value of particle lifetime duration.

Return value

The mean value in seconds.

float getLifeSpread ( ) #

Returns the current spread value of particle lifetime duration.

Return value

The spread value in seconds.

void setLinearDamping ( float damping ) #

Sets a linear damping of particles.

Arguments

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

float getLinearDamping ( ) #

Returns the current linear damping of particles.

Return value

The current linear damping.

void setMaxWarmingTime ( float time ) #

Sets max time for particles simulation during the warming, in seconds.

Arguments

  • float time - Time, in seconds.

float getMaxWarmingTime ( ) #

Returns max time value for particles simulation during the warming, in seconds.

Return value

Time, in seconds.

void setNoiseAttached ( int num, int attached ) #

Sets the noise as an attached.

Arguments

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

int isNoiseAttached ( int num ) #

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

Arguments

  • int num - Target noise number.

Return value

1 if the noise is attached; otherwise, 0.

void setNoiseEnabled ( int num, bool enabled ) #

Enables or disables the given noise.

Arguments

  • int num - Target noise number.
  • bool enabled - 1 to enable the noise, 0 to disable it.

bool isNoiseEnabled ( int num ) #

Returns a value indicating if the given noise is enabled.

Arguments

  • int num - Target noise number.

Return value

1 if the noise is enabled; otherwise, 0.

void setNoiseForce ( int num, float force ) #

Sets the Force parameter value for the required noise.

Arguments

  • int num - Target noise number.
  • float force - The noise force value.

float getNoiseForce ( int num ) #

Returns the Force parameter value for the required noise.

Arguments

  • int num - Target noise number.

Return value

The 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 - The noise frequency value.

int getNoiseFrequency ( int num ) #

Returns the Frequency parameter value for the required noise.

Arguments

  • int num - The target noise number.

Return value

The noise frequency value.

Ptr<Image> getNoiseImage ( int num ) #

Returns the spatial texture for the required noise.

Arguments

  • int num - Target noise number.

Return value

The texture of the noise.

void setNoiseOffset ( int num, const Math::vec3 & offset ) #

Sets the Offset parameter coordinates values for the required noise.

Arguments

  • int num - Target noise number.
  • const Math::vec3 & offset - Offset coordinates values.

Math::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.

void setNoiseScale ( int num, float scale ) #

Sets the Scale parameter value for the required noise.

Arguments

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

float getNoiseScale ( int num ) #

Returns the Scale parameter value for the required noise.

Arguments

  • int num - Target noise number.

Return value

The noise scale value.

void setNoiseSize ( int num, int size ) #

Sets the Size parameter value for the required noise.

Arguments

  • int num - The target noise number.
  • int size - The noise size value.

int getNoiseSize ( int num ) #

Returns the Size parameter value for the required noise.

Arguments

  • int num - Target noise number.

Return value

The noise size value.

void setNoiseStep ( int num, const Math::vec3 & step ) #

Sets the Step parameter coordinates values for the required noise.

Arguments

  • int num - Target noise number.
  • const Math::vec3 & step - Step coordinates values.

Math::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.

void setNoiseTransform ( int num, const Math::Mat4 & transform ) #

Sets the transformation matrix for the required noise.

Arguments

  • int num - Target noise number.
  • const Math::Mat4 & transform - The noise transformation matrix.

Math::Mat4 getNoiseTransform ( int num ) #

Returns the transformation matrix for the required noise.

Arguments

  • int num - Target noise number.

Return value

The noise transformation matrix.

int getNumContacts ( ) #

Returns the total number of particles collisions with other objects.

Return value

Number of collisions.

void setNumDeflectors ( int deflectors ) #

Sets the new number of deflectors.

Arguments

  • int deflectors - Number of deflectors.

int getNumDeflectors ( ) #

Returns the current number of deflectors.

Return value

The number of deflectors.

void setNumForces ( int forces ) #

Sets the new number of forces.

Arguments

  • int forces - Number of forces.

int getNumForces ( ) #

Returns the number of the currently acting forces.

Return value

The number of forces.

void setNumNoises ( int noises ) #

Sets the new number of noises.

Arguments

  • int noises - Number of noises.

int getNumNoises ( ) #

Returns the current number of noises.

Return value

Number of noises.

int getNumParticles ( ) #

Returns the current number of particles.

Return value

The number of particles.

Math::Vec3 getParticlePosition ( int num ) #

Returns the position of a given particle.

Arguments

  • int num - The particle number.

Return value

Position coordinates for the particle.

float getParticleRadius ( int num ) #

Returns the radius of a given particle.

Arguments

  • int num - The particle number.

Return value

Radius of the particle.

void setParticlesRotation ( float mean, float spread ) #

Sets the particle system rotation mean and spread values.

Arguments

  • float mean
  • float spread

float getParticlesRotationMean ( ) #

Returns the particle system rotation mean value.

Return value

Rotation mean value.

float getParticlesRotationSpread ( ) #

Returns the particle system rotation spread value.

Return value

Rotation spread value.

void setParticlesType ( int type ) #

Sets a type of particles to emit.

Arguments

  • int type - A type of particles (one of the TYPE_* values).

int getParticlesType ( ) #

Returns the type of emitted particles.

Return value

The type of particles (one of the TYPE_* values).

void getParticleTransforms ( Vector< Math::Mat4 > & transforms ) #

Returns transformation matrices for spawned particles.

Arguments

  • Vector< Math::Mat4 > & transforms - Array to which the transformation matrices will be added.

Math::vec3 getParticleVelocity ( int num ) #

Returns the velocity vector for a specified particle.

Arguments

  • int num - The particle number.

Return value

The velocity vector.

void setPeriod ( float mean, float spread ) #

Sets an interval of emitter inactivity in seconds.

Arguments

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

float getPeriodMean ( ) #

Returns the current mean value of emitter inactivity intervals.

Return value

The mean value in seconds.

float getPeriodSpread ( ) #

Returns the current spread value of emitter inactivity intervals.

Return value

The spread value in seconds.

void setPhysicalMask ( int mask ) #

Sets a 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.

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.

void setPhysicalMass ( float mass ) #

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

Arguments

  • float mass - The mass of the particles.

float getPhysicalMass ( ) #

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

Return value

The mass of the particles.

void setProceduralRendering ( bool rendering ) #

Enables particle system rendering to procedural texture to be used by an orthographic decal or a field height. For example, ship wake waves are simulated using this feature.

Arguments

  • bool rendering - 1 to enable rendering to procedural texture, 0 to disable.

bool isProceduralRendering ( ) #

Returns the value indicating if the procedural rendering enabled or not. This feature enables rendering of particles into an orthographic decal or a field height, and can be used, for example, to create ship wake waves.

Return value

1 if the procedural rendering is enabled; otherwise, 0.

void setProceduralParenting ( int parenting ) #

Sets the type of relationship between the particle system and a decal / field node that uses the procedural texture.
Notice
Procedural rendering must be enabled.

Arguments

  • int parenting - Relationship type to be used for rendering the particle system to a procedural texture:
    • 0 - a decal/field node that uses the procedural texture is a child of the particle system.
    • 1 - a decal/field node that uses the procedural texture is a parent of the particle system.

int getProceduralParenting ( ) #

Returns the current type of relationship between the particle system and a decal / field node that uses the procedural texture.
Notice
Procedural rendering must be enabled.

Return value

Relationship type to be used for rendering the particle system to a procedural texture:
  • 0 - a decal/field node that uses the procedural texture is a child of the particle system.
  • 1 - a decal/field node that uses the procedural texture is a parent of the particle system.

void setProceduralPositioning ( int positioning ) #

Sets positioning mode to be used for child nodes using the procedural texture to which the particle system is rendered.
Notice
  • Positioning mode can be set only when the particle system is a parent of a decal/field node that uses the procedural texture (parenting mode is set to 0)
  • Procedural rendering must be enabled.

Arguments

  • int positioning - Mode of the procedural positioning. Can be one of the following:
    • PROCEDURAL_POSITIONING_MANUAL = 0 - position of a child decal/field node, that uses the procedural texture, can be changed manually.
    • PROCEDURAL_POSITIONING_AUTO = 1 - position of a child decal/field node, that uses the procedural texture, is automatically defined by the position of particle system and cannot be changed manually.

int getProceduralPositioning ( ) #

Returns the value indicating the procedural position mode.
Notice
Procedural rendering must be enabled.

Return value

Mode of the procedural positioning. Can be one of the following:
  • PROCEDURAL_POSITIONING_MANUAL = 0
  • PROCEDURAL_POSITIONING_AUTO = 1

void setProceduralTextureResolution ( const Math::vec3 & res ) #

Sets the resolution of the procedural texture.
Notice
Procedural rendering must be enabled.

Arguments

  • const Math::vec3 & res - Resolution of the texture.

Math::vec3 getProceduralTextureResolution ( ) #

Returns the resolution of the procedural texture.
Notice
Procedural rendering must be enabled.

Return value

Resolution of the texture.

void setRadius ( float mean, float spread ) #

Sets a particle radius in units.

Arguments

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

float getRadiusMean ( ) #

Returns the current mean value of particle radii.

Return value

The mean value in units.

float getRadiusSpread ( ) #

Returns the current spread value of particle radii.

Return value

The spread value in units.

void setRestitution ( float restitution ) #

Sets a restitution value for particles.

Arguments

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

float getRestitution ( ) #

Returns the current restitution value for particles.

Return value

The current restitution value.

void setRoughness ( float roughness ) #

Sets a roughness of the particle surface.

Arguments

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

float getRoughness ( ) #

Returns the current roughness of the particle surface.

Return value

The current roughness.

void setSeed ( unsigned int seed ) #

Sets a seed value for the particles' random generator.

Arguments

  • unsigned int seed - A seed value.

unsigned int getSeed ( ) #

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

Return value

The seed value.

void setNumberPerSpawn ( int spawn ) #

Sets the number of particles to be spawned simultaneously each time according to the spawn rate.

Arguments

  • int spawn - Number of particles to be spawned simultaneously.

int getNumberPerSpawn ( ) #

Returns the current number of particles to be spawned simultaneously each time according to the spawn rate.

Return value

Current number of particles to be spawned simultaneously.

void setSpawnRate ( float rate ) #

Sets a rate at which particles are created.

Arguments

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

float getSpawnRate ( ) #

Returns the current particle spawn rate.

Return value

The current spawn rate.

void setSpawnScale ( float scale ) #

Sets a spawn scale that enables 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 - A 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.

float getSpawnScale ( ) #

Returns the current spawn scale that enables 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

The current spawn scale.

void setSpawnThreshold ( float threshold ) #

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

Arguments

  • float threshold - A velocity threshold for the parent particles.

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

The current velocity threshold of the parent particles.

void setTextureAtlas ( int atlas ) #

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

Arguments

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

int getTextureAtlas ( ) #

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

Return value

1 if a texture atlas is used; otherwise, 0.

void setVariationX ( int variationx ) #

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

Arguments

  • int variationx - 1 to add random variation along the X axis, 0 not to add.

int getVariationX ( ) #

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

Return value

1 if there is random variation along the X axis, 0 if there is not.

void setVariationY ( int variationy ) #

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

Arguments

  • int variationy - 1 to add random variation along the Y axis, 0 not to add.

int getVariationY ( ) #

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

Return value

1 if there is random variation along the Y axis, 0 if there is not.

void setVelocity ( float mean, float spread ) #

Sets an initial particle velocity in units per second.

Arguments

  • float mean - A mean value in units per second.
  • float spread - A spread value in units per second.

float getVelocityMean ( ) #

Returns the current mean value of the initial particle velocities.

Return value

The mean value in units per second.

float getVelocitySpread ( ) #

Returns the current spread value of the initial particle velocities.

Return value

The 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.

Arguments

  • int warming - 1 to enable the warm start; 0 to disable it.

int getWarming ( ) #

Returns a value indicating if the 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 the warm start is enabled; 0 if it is disabled.

UNIGINE_BOUND_BOX getWorldBoundBoxParticles ( ) #

Returns the estimated world bounding box considering the changes of the particle system (velocity, length, etc.).

Math::Vec3 getWorldOffset ( ) #

Returns the current world offset of the local origin of coordinates of the particle system. The offset of the origin of coordinates is changed depending on the position of the particle system so that the particles are simulated near their emitter.

Return value

Offset coordinates values.

int addDeflector ( ) #

Adds a deflector with default settings.

Return value

The number of the new deflector in the list of deflectors.

void addEmitterSpark ( const Math::Vec3 & point, const Math::vec3 & normal, const Math::vec3 & velocity ) #

Adds a spark emitter in the given point.

Arguments

  • const Math::Vec3 & point - Point for sparks emission.
  • const Math::vec3 & normal - Normal vector of the point of spark emission.
  • const Math::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

The number of the new force in the list of forces.

int addNoise ( ) #

Adds a new noise with default settings.

Return value

The number of the new noise in the list of noises.

void clearParticles ( ) #

Deletes all particles spawned by the emitter.

void removeDeflector ( int num ) #

Removes a given point deflector.

Arguments

  • int num - The number of the deflector to remove.

void removeForce ( int num ) #

Removes the given force.

Arguments

  • int num - The number of the force to remove.

void removeNoise ( int num ) #

Removes the given noise.

Arguments

  • int num - Target noise number.

static int type ( ) #

Returns the type of the object.

Return value

Object Particles type identifier.

int restoreStateSelf ( const Ptr<Stream> & stream ) #

Restores the object's state from the stream.
Notice
This method restores all object's parameters, including forces, noises, and deflectors. To restore any of these parameters individually, use restoreStateForces(), restoreStateNoises(), or restoreStateDeflectors() respectively.

Arguments

  • const Ptr<Stream> & stream - Stream smart pointer.

Return value

Returns 1 if the object state was successfully restored; otherwise, 0.

int saveStateSelf ( const Ptr<Stream> & stream ) #

Saves the object's state to the stream.
Notice
This method saves all object's parameters, including forces, noises, and deflectors. To save any of these parameters individually, use saveStateForces(), saveStateNoises(), or saveStateDeflectors() respectively.

Arguments

  • const Ptr<Stream> & stream - Stream smart pointer.

Return value

Returns 1 if the object state was successfully saved; otherwise, 0 is returned.

int saveStateForces ( const Ptr<Stream> & stream ) #

Saves the state of the object's forces to the specified stream.

Arguments

  • const Ptr<Stream> & stream - Stream smart pointer.

int restoreStateForces ( const Ptr<Stream> & stream ) #

Restores the state of the object's forces from the specified stream.

Arguments

  • const Ptr<Stream> & stream - Stream smart pointer.

int saveStateNoises ( const Ptr<Stream> & stream ) #

Saves the state of the object's noises to the specified stream.

Arguments

  • const Ptr<Stream> & stream - Stream smart pointer.

int restoreStateNoises ( const Ptr<Stream> & stream ) #

Restores the state of the object's noises from the specified stream.

Arguments

  • const Ptr<Stream> & stream - Stream smart pointer.

int saveStateDeflectors ( const Ptr<Stream> & stream ) #

Saves the state of the object's deflectors to the specified stream.

Arguments

  • const Ptr<Stream> & stream - Stream smart pointer.

int restoreStateDeflectors ( const Ptr<Stream> & stream ) #

Restores the state of the object's deflectors from the specified stream.

Arguments

  • const Ptr<Stream> & stream - Stream smart pointer.

void setNoiseSeed ( int num, int seed ) #

Sets a new random seed value to be used for the noise with the specified number. This parameter is used to synchronize pseudorandom number generators for particle system noises.

Arguments

  • int num - Target noise number.
  • int seed - Random seed value to be used for the target noise.

int getNoiseSeed ( int num ) #

Returns the random seed value currently used for the noise with the specified number. This parameter is used to synchronize pseudorandom number generators for particle system noises.

Arguments

  • int num - Target noise number.

Return value

Random seed value currently used for the target noise.

void setSyncMode ( ObjectParticles::SYNC_MODE mode ) #

Sets synchronization mode to be used for the particle system.

Arguments

  • ObjectParticles::SYNC_MODE mode - Synchronization mode to be set, one of the SYNC_MODE values.

ObjectParticles::SYNC_MODE getSyncMode ( ) #

Returns the current synchronization mode used for the particle system.

Return value

Current synchronization mode, one of the SYNC_MODE values.

void takeSyncData ( const Ptr<Stream> & stream ) #

Writes particle synchronization data to the specified stream.

Arguments

  • const Ptr<Stream> & stream - Stream to which particle synchronization data is to be written.

void applySyncData ( const Ptr<Stream> & stream ) #

Reads particle synchronization data from the specified stream and applies it to the particle system.

Arguments

  • const Ptr<Stream> & stream - Stream with particle synchronization data to be applied.
Last update: 2019-12-25
Build: ()