2020-01-03 20:05:16 +01:00
|
|
|
// Copyright (C) 2002-2012 Nikolaus Gebhardt
|
|
|
|
// This file is part of the "Irrlicht Engine".
|
|
|
|
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
|
|
|
|
2021-08-27 21:14:39 +02:00
|
|
|
#ifndef IRR_C_PARTICLE_POINT_EMITTER_H_INCLUDED
|
|
|
|
#define IRR_C_PARTICLE_POINT_EMITTER_H_INCLUDED
|
2020-01-03 20:05:16 +01:00
|
|
|
|
|
|
|
#include "IrrCompileConfig.h"
|
|
|
|
#ifdef _IRR_COMPILE_WITH_PARTICLES_
|
|
|
|
|
|
|
|
#include "IParticleEmitter.h"
|
|
|
|
|
|
|
|
namespace irr
|
|
|
|
{
|
|
|
|
namespace scene
|
|
|
|
{
|
|
|
|
|
|
|
|
//! A default point emitter
|
|
|
|
class CParticlePointEmitter : public IParticlePointEmitter
|
|
|
|
{
|
|
|
|
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,
|
|
|
|
const core::dimension2df& minStartSize = core::dimension2df(5.0f,5.0f),
|
|
|
|
const core::dimension2df& maxStartSize = core::dimension2df(5.0f,5.0f) );
|
|
|
|
|
|
|
|
//! Prepares an array with new particles to emitt into the system
|
|
|
|
//! and returns how much new particles there are.
|
2021-08-27 21:14:39 +02:00
|
|
|
virtual s32 emitt(u32 now, u32 timeSinceLastCall, SParticle*& outArray) IRR_OVERRIDE;
|
2020-01-03 20:05:16 +01:00
|
|
|
|
|
|
|
//! Set direction the emitter emits particles.
|
2021-08-27 21:14:39 +02:00
|
|
|
virtual void setDirection( const core::vector3df& newDirection ) IRR_OVERRIDE { Direction = newDirection; }
|
2020-01-03 20:05:16 +01:00
|
|
|
|
|
|
|
//! Set minimum number of particles emitted per second.
|
2021-08-27 21:14:39 +02:00
|
|
|
virtual void setMinParticlesPerSecond( u32 minPPS ) IRR_OVERRIDE { MinParticlesPerSecond = minPPS; }
|
2020-01-03 20:05:16 +01:00
|
|
|
|
|
|
|
//! Set maximum number of particles emitted per second.
|
2021-08-27 21:14:39 +02:00
|
|
|
virtual void setMaxParticlesPerSecond( u32 maxPPS ) IRR_OVERRIDE { MaxParticlesPerSecond = maxPPS; }
|
2020-01-03 20:05:16 +01:00
|
|
|
|
|
|
|
//! Set minimum start color.
|
2021-08-27 21:14:39 +02:00
|
|
|
virtual void setMinStartColor( const video::SColor& color ) IRR_OVERRIDE { MinStartColor = color; }
|
2020-01-03 20:05:16 +01:00
|
|
|
|
|
|
|
//! Set maximum start color.
|
2021-08-27 21:14:39 +02:00
|
|
|
virtual void setMaxStartColor( const video::SColor& color ) IRR_OVERRIDE { MaxStartColor = color; }
|
2020-01-03 20:05:16 +01:00
|
|
|
|
|
|
|
//! Set the maximum starting size for particles
|
2021-08-27 21:14:39 +02:00
|
|
|
virtual void setMaxStartSize( const core::dimension2df& size ) IRR_OVERRIDE { MaxStartSize = size; }
|
2020-01-03 20:05:16 +01:00
|
|
|
|
|
|
|
//! Set the minimum starting size for particles
|
2021-08-27 21:14:39 +02:00
|
|
|
virtual void setMinStartSize( const core::dimension2df& size ) IRR_OVERRIDE { MinStartSize = size; }
|
2020-01-03 20:05:16 +01:00
|
|
|
|
|
|
|
//! Set the minimum particle life-time in milliseconds
|
2021-08-27 21:14:39 +02:00
|
|
|
virtual void setMinLifeTime( u32 lifeTimeMin ) IRR_OVERRIDE { MinLifeTime = lifeTimeMin; }
|
2020-01-03 20:05:16 +01:00
|
|
|
|
|
|
|
//! Set the maximum particle life-time in milliseconds
|
2021-08-27 21:14:39 +02:00
|
|
|
virtual void setMaxLifeTime( u32 lifeTimeMax ) IRR_OVERRIDE { MaxLifeTime = lifeTimeMax; }
|
2020-01-03 20:05:16 +01:00
|
|
|
|
|
|
|
//! Set maximal random derivation from the direction
|
2021-08-27 21:14:39 +02:00
|
|
|
virtual void setMaxAngleDegrees( s32 maxAngleDegrees ) IRR_OVERRIDE { MaxAngleDegrees = maxAngleDegrees; }
|
2020-01-03 20:05:16 +01:00
|
|
|
|
|
|
|
//! Gets direction the emitter emits particles.
|
2021-08-27 21:14:39 +02:00
|
|
|
virtual const core::vector3df& getDirection() const IRR_OVERRIDE { return Direction; }
|
2020-01-03 20:05:16 +01:00
|
|
|
|
|
|
|
//! Gets minimum number of particles emitted per second.
|
2021-08-27 21:14:39 +02:00
|
|
|
virtual u32 getMinParticlesPerSecond() const IRR_OVERRIDE { return MinParticlesPerSecond; }
|
2020-01-03 20:05:16 +01:00
|
|
|
|
|
|
|
//! Gets maximum number of particles emitted per second.
|
2021-08-27 21:14:39 +02:00
|
|
|
virtual u32 getMaxParticlesPerSecond() const IRR_OVERRIDE { return MaxParticlesPerSecond; }
|
2020-01-03 20:05:16 +01:00
|
|
|
|
|
|
|
//! Gets minimum start color.
|
2021-08-27 21:14:39 +02:00
|
|
|
virtual const video::SColor& getMinStartColor() const IRR_OVERRIDE { return MinStartColor; }
|
2020-01-03 20:05:16 +01:00
|
|
|
|
|
|
|
//! Gets maximum start color.
|
2021-08-27 21:14:39 +02:00
|
|
|
virtual const video::SColor& getMaxStartColor() const IRR_OVERRIDE { return MaxStartColor; }
|
2020-01-03 20:05:16 +01:00
|
|
|
|
|
|
|
//! Gets the maximum starting size for particles
|
2021-08-27 21:14:39 +02:00
|
|
|
virtual const core::dimension2df& getMaxStartSize() const IRR_OVERRIDE { return MaxStartSize; }
|
2020-01-03 20:05:16 +01:00
|
|
|
|
|
|
|
//! Gets the minimum starting size for particles
|
2021-08-27 21:14:39 +02:00
|
|
|
virtual const core::dimension2df& getMinStartSize() const IRR_OVERRIDE { return MinStartSize; }
|
2020-01-03 20:05:16 +01:00
|
|
|
|
|
|
|
//! Get the minimum particle life-time in milliseconds
|
2021-08-27 21:14:39 +02:00
|
|
|
virtual u32 getMinLifeTime() const IRR_OVERRIDE { return MinLifeTime; }
|
2020-01-03 20:05:16 +01:00
|
|
|
|
|
|
|
//! Get the maximum particle life-time in milliseconds
|
2021-08-27 21:14:39 +02:00
|
|
|
virtual u32 getMaxLifeTime() const IRR_OVERRIDE { return MaxLifeTime; }
|
2020-01-03 20:05:16 +01:00
|
|
|
|
|
|
|
//! Get maximal random derivation from the direction
|
2021-08-27 21:14:39 +02:00
|
|
|
virtual s32 getMaxAngleDegrees() const IRR_OVERRIDE { return MaxAngleDegrees; }
|
2020-01-03 20:05:16 +01:00
|
|
|
|
|
|
|
//! Writes attributes of the object.
|
2021-08-27 21:14:39 +02:00
|
|
|
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const IRR_OVERRIDE;
|
2020-01-03 20:05:16 +01:00
|
|
|
|
|
|
|
//! Reads attributes of the object.
|
2021-08-27 21:14:39 +02:00
|
|
|
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) IRR_OVERRIDE;
|
2020-01-03 20:05:16 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
SParticle Particle;
|
|
|
|
core::vector3df Direction;
|
|
|
|
core::dimension2df MinStartSize, MaxStartSize;
|
|
|
|
u32 MinParticlesPerSecond, MaxParticlesPerSecond;
|
|
|
|
video::SColor MinStartColor, MaxStartColor;
|
|
|
|
u32 MinLifeTime, MaxLifeTime;
|
|
|
|
s32 MaxAngleDegrees;
|
|
|
|
|
|
|
|
u32 Time;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // end namespace scene
|
|
|
|
} // end namespace irr
|
|
|
|
|
|
|
|
#endif // _IRR_COMPILE_WITH_PARTICLES_
|
|
|
|
|
|
|
|
#endif
|