2007-05-20 11:03:49 -07:00
|
|
|
// Copyright (C) 2002-2007 Nikolaus Gebhardt
|
|
|
|
// This file is part of the "Irrlicht Engine".
|
|
|
|
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
|
|
|
|
|
|
|
#ifndef __C_PARTICLE_POINT_EMITTER_H_INCLUDED__
|
|
|
|
#define __C_PARTICLE_POINT_EMITTER_H_INCLUDED__
|
|
|
|
|
|
|
|
#include "IParticleEmitter.h"
|
|
|
|
#include "irrArray.h"
|
|
|
|
|
|
|
|
namespace irr
|
|
|
|
{
|
|
|
|
namespace scene
|
|
|
|
{
|
|
|
|
|
|
|
|
//! A default point emitter
|
2007-08-29 09:13:38 -07:00
|
|
|
class CParticlePointEmitter : public IParticlePointEmitter
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
//! constructor
|
|
|
|
CParticlePointEmitter(
|
|
|
|
const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
|
|
|
|
u32 minParticlesPerSecond = 5,
|
|
|
|
u32 maxParticlesPerSecond = 10,
|
|
|
|
video::SColor minStartColor = video::SColor(255,0,0,0),
|
|
|
|
video::SColor maxStartColor = video::SColor(255,255,255,255),
|
|
|
|
u32 lifeTimeMin=2000,
|
|
|
|
u32 lifeTimeMax=4000,
|
|
|
|
s32 maxAngleDegrees=0);
|
|
|
|
|
|
|
|
//! Prepares an array with new particles to emitt into the system
|
|
|
|
//! and returns how much new particles there are.
|
|
|
|
virtual s32 emitt(u32 now, u32 timeSinceLastCall, SParticle*& outArray);
|
|
|
|
|
2007-08-29 09:13:38 -07:00
|
|
|
//! Set direction the emitter emits particles.
|
|
|
|
virtual void setDirection( const core::vector3df& newDirection ) { Direction = newDirection; }
|
|
|
|
|
|
|
|
//! Set minimum number of particles emitted per second.
|
|
|
|
virtual void setMinParticlesPerSecond( u32 minPPS ) { MinParticlesPerSecond = minPPS; }
|
|
|
|
|
|
|
|
//! Set maximum number of particles emitted per second.
|
|
|
|
virtual void setMaxParticlesPerSecond( u32 maxPPS ) { MaxParticlesPerSecond = maxPPS; }
|
|
|
|
|
|
|
|
//! Set minimum start color.
|
|
|
|
virtual void setMinStartColor( const video::SColor& color ) { MinStartColor = color; }
|
|
|
|
|
|
|
|
//! Set maximum start color.
|
|
|
|
virtual void setMaxStartColor( const video::SColor& color ) { MaxStartColor = color; }
|
|
|
|
|
|
|
|
//! Gets direction the emitter emits particles.
|
|
|
|
virtual const core::vector3df& getDirection() const { return Direction; }
|
|
|
|
|
|
|
|
//! Gets minimum number of particles emitted per second.
|
|
|
|
virtual u32 getMinParticlesPerSecond() const { return MinParticlesPerSecond; }
|
|
|
|
|
|
|
|
//! Gets maximum number of particles emitted per second.
|
|
|
|
virtual u32 getMaxParticlesPerSecond() const { return MaxParticlesPerSecond; }
|
|
|
|
|
|
|
|
//! Gets minimum start color.
|
|
|
|
virtual const video::SColor& getMinStartColor() const { return MinStartColor; }
|
|
|
|
|
|
|
|
//! Gets maximum start color.
|
|
|
|
virtual const video::SColor& getMaxStartColor() const { return MaxStartColor; }
|
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
//! Writes attributes of the object.
|
|
|
|
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options);
|
|
|
|
|
|
|
|
//! Reads attributes of the object.
|
|
|
|
virtual s32 deserializeAttributes(s32 startIndex, io::IAttributes* in, io::SAttributeReadWriteOptions* options);
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
SParticle Particle;
|
|
|
|
core::vector3df Direction;
|
2007-08-29 09:13:38 -07:00
|
|
|
u32 MinParticlesPerSecond, MaxParticlesPerSecond;
|
2007-05-20 11:03:49 -07:00
|
|
|
video::SColor MinStartColor, MaxStartColor;
|
2007-08-29 09:13:38 -07:00
|
|
|
u32 MinLifeTime, MaxLifeTime;
|
2007-05-20 11:03:49 -07:00
|
|
|
s32 MaxAngleDegrees;
|
|
|
|
|
|
|
|
u32 Time;
|
|
|
|
u32 Emitted;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // end namespace scene
|
|
|
|
} // end namespace irr
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|