2019-12-12 17:32:41 +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 17:55:04 +02:00
|
|
|
#ifndef IRR_C_PARTICLE_FADE_OUT_AFFECTOR_H_INCLUDED
|
|
|
|
#define IRR_C_PARTICLE_FADE_OUT_AFFECTOR_H_INCLUDED
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
#include "IrrCompileConfig.h"
|
|
|
|
#ifdef _IRR_COMPILE_WITH_PARTICLES_
|
|
|
|
|
|
|
|
#include "IParticleFadeOutAffector.h"
|
|
|
|
#include "SColor.h"
|
|
|
|
|
|
|
|
namespace irr
|
|
|
|
{
|
|
|
|
namespace scene
|
|
|
|
{
|
|
|
|
|
|
|
|
//! Particle Affector for fading out a color
|
|
|
|
class CParticleFadeOutAffector : public IParticleFadeOutAffector
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
CParticleFadeOutAffector(const video::SColor& targetColor, u32 fadeOutTime);
|
|
|
|
|
|
|
|
//! Affects a particle.
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual void affect(u32 now, SParticle* particlearray, u32 count) IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Sets the targetColor, i.e. the color the particles will interpolate
|
|
|
|
//! to over time.
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual void setTargetColor( const video::SColor& targetColor ) IRR_OVERRIDE { TargetColor = targetColor; }
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Sets the amount of time it takes for each particle to fade out.
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual void setFadeOutTime( u32 fadeOutTime ) IRR_OVERRIDE { FadeOutTime = fadeOutTime ? static_cast<f32>(fadeOutTime) : 1.0f; }
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Sets the targetColor, i.e. the color the particles will interpolate
|
|
|
|
//! to over time.
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual const video::SColor& getTargetColor() const IRR_OVERRIDE { return TargetColor; }
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Sets the amount of time it takes for each particle to fade out.
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual u32 getFadeOutTime() const IRR_OVERRIDE { return static_cast<u32>(FadeOutTime); }
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Writes attributes of the object.
|
|
|
|
//! Implement this to expose the attributes of your scene node animator for
|
|
|
|
//! scripting languages, editors, debuggers or xml serialization purposes.
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Reads attributes of the object.
|
|
|
|
//! Implement this to set the attributes of your scene node animator for
|
|
|
|
//! scripting languages, editors, debuggers or xml deserialization purposes.
|
|
|
|
//! \param startIndex: start index where to start reading attributes.
|
|
|
|
//! \return: returns last index of an attribute read by this affector
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
video::SColor TargetColor;
|
|
|
|
f32 FadeOutTime;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // end namespace scene
|
|
|
|
} // end namespace irr
|
|
|
|
|
|
|
|
|
|
|
|
#endif // _IRR_COMPILE_WITH_PARTICLES_
|
|
|
|
|
|
|
|
#endif
|