Esempio n. 1
0
/* ----------------------------------------------------------------------------
Creates a particle emitter for an animated mesh scene node

Parameters:
 node,:  Pointer to the animated mesh scene node to emit particles from
 useNormalDirection,:  If true, the direction of each particle created will be
						the normal of the vertex that it's emitting from. The
						normal is divided by the normalDirectionModifier
						parameter, which defaults to 100.0f.
 direction,:  Direction and speed of particle emission.
 normalDirectionModifier,:  If the emitter is using the normal direction then the
							normal of the vertex that is being emitted from is
							divided by this number.
 mbNumber,:  This allows you to specify a specific meshBuffer for the IMesh* to
			emit particles from. The default value is -1, which means a random
			meshBuffer picked from all of the meshes meshBuffers will be selected
			to pick a random vertex from. If the value is 0 or greater, it will
			only pick random vertices from the meshBuffer specified by this value.
 everyMeshVertex,:  If true, the emitter will emit between min/max particles every
					second, for every vertex in the mesh, if false, it will emit
					between min/max particles from random vertices in the mesh.
 minParticlesPerSecond,:  Minimal amount of particles emitted per second.
 maxParticlesPerSecond,:  Maximal amount of particles emitted per second.
 minStartColor,:  Minimal initial start color of a particle. The real color of every
				particle is calculated as random interpolation between minStartColor
				and maxStartColor.
 maxStartColor,:  Maximal initial start color of a particle. The real color of every
				particle is calculated as random interpolation between minStartColor
				and maxStartColor.
 lifeTimeMin,:  Minimal lifetime of a particle, in milliseconds.
 lifeTimeMax,:  Maximal lifetime of a particle, in milliseconds.
 maxAngleDegrees,:  Maximal angle in degrees, the emitting direction of the particle
					will differ from the orignial direction.

Returns:
Returns a pointer to the created particle emitter. To set this emitter as new
emitter of this particle system, just call setEmitter(). Note that you'll have
to drop() the returned pointer, after you don't need it any more, see
IReferenceCounted::drop() for more informations.
*/
IParticleEmitter * DLL_EXPORT IrrAddAnimatedMeshSceneNodeEmitter (
		IParticleSystemSceneNode* ps,
		IAnimatedMeshSceneNode* node,
		bool useNormalDirection,
		float normalDirectionModifier,
		bool emitFromEveryMeshVertex,
		IRR_PARTICLE_EMITTER prop )
{
	IParticleEmitter* em = ps->createAnimatedMeshSceneNodeEmitter(
			node,
			useNormalDirection,
			core::vector3df(prop.direction_x,prop.direction_y,prop.direction_z),
			normalDirectionModifier,
			-1,	// use a random meshbuffer from within the node
			emitFromEveryMeshVertex,
			prop.min_paritlcles_per_second,prop.max_paritlcles_per_second,
			video::SColor(0,prop.min_start_color_red,prop.min_start_color_green,prop.min_start_color_blue),
			video::SColor(0,prop.max_start_color_red,prop.max_start_color_green,prop.max_start_color_blue),
			prop.min_lifetime,prop.max_lifetime,
			prop.max_angle_degrees );

    em->setMinStartSize( dimension2d<f32>(prop.min_start_sizeX, prop.min_start_sizeY));
    em->setMaxStartSize( dimension2d<f32>(prop.max_start_sizeX, prop.max_start_sizeY));
	ps->setEmitter(em);
	em->drop();
	return em;
}
Esempio n. 2
0
/* ----------------------------------------------------------------------------
create an emitter that can be added to a particle system
*/
IParticleEmitter * DLL_EXPORT IrrAddParticleEmitter( IParticleSystemSceneNode* ps, IRR_PARTICLE_EMITTER prop )
{
	IParticleEmitter* em = ps->createBoxEmitter(
		core::aabbox3d<f32>(prop.min_box_x,prop.min_box_y,prop.min_box_z,prop.max_box_x,prop.max_box_y,prop.max_box_z),
		core::vector3df(prop.direction_x,prop.direction_y,prop.direction_z),
		prop.min_paritlcles_per_second,prop.max_paritlcles_per_second,
		video::SColor(0,prop.min_start_color_red,prop.min_start_color_green,prop.min_start_color_blue),
		video::SColor(0,prop.max_start_color_red,prop.max_start_color_green,prop.max_start_color_blue),
		prop.min_lifetime,prop.max_lifetime,
		prop.max_angle_degrees );

    em->setMinStartSize( dimension2d<f32>(prop.min_start_sizeX, prop.min_start_sizeY));
    em->setMaxStartSize( dimension2d<f32>(prop.max_start_sizeX, prop.max_start_sizeY));
	ps->setEmitter(em);
	em->drop();
	return em;
}