mirror of
https://github.com/minetest/irrlicht.git
synced 2024-09-07 05:10:19 +02:00
Basically fixing original Bug#427 reported by MArkus Elfring. Unfortunately there are still more defines (in IrrCompileConfig.h) which also are not nice c++ Lots of files touched for very minor cleanup *sigh* git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6253 dfc29bdd-3216-0410-991c-e03cc46cb475
167 lines
6.4 KiB
C++
167 lines
6.4 KiB
C++
// 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
|
|
|
|
#ifndef IRR_C_PARTICLE_CYLINDER_EMITTER_H_INCLUDED
|
|
#define IRR_C_PARTICLE_CYLINDER_EMITTER_H_INCLUDED
|
|
|
|
#include "IrrCompileConfig.h"
|
|
#ifdef _IRR_COMPILE_WITH_PARTICLES_
|
|
|
|
#include "IParticleCylinderEmitter.h"
|
|
#include "irrArray.h"
|
|
|
|
namespace irr
|
|
{
|
|
namespace scene
|
|
{
|
|
|
|
//! A default box emitter
|
|
class CParticleCylinderEmitter : public IParticleCylinderEmitter
|
|
{
|
|
public:
|
|
|
|
//! constructor
|
|
CParticleCylinderEmitter(
|
|
const core::vector3df& center, f32 radius,
|
|
const core::vector3df& normal, f32 length,
|
|
bool outlineOnly = false, const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
|
|
u32 minParticlesPerSecond = 20,
|
|
u32 maxParticlesPerSecond = 40,
|
|
const video::SColor& minStartColor = video::SColor(255,0,0,0),
|
|
const 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.
|
|
virtual s32 emitt(u32 now, u32 timeSinceLastCall, SParticle*& outArray) IRR_OVERRIDE;
|
|
|
|
//! Set the center of the radius for the cylinder, at one end of the cylinder
|
|
virtual void setCenter( const core::vector3df& center ) IRR_OVERRIDE { Center = center; }
|
|
|
|
//! Set the normal of the cylinder
|
|
virtual void setNormal( const core::vector3df& normal ) IRR_OVERRIDE { Normal = normal; }
|
|
|
|
//! Set the radius of the cylinder
|
|
virtual void setRadius( f32 radius ) IRR_OVERRIDE { Radius = radius; }
|
|
|
|
//! Set the length of the cylinder
|
|
virtual void setLength( f32 length ) IRR_OVERRIDE { Length = length; }
|
|
|
|
//! Set whether or not to draw points inside the cylinder
|
|
virtual void setOutlineOnly( bool outlineOnly ) IRR_OVERRIDE { OutlineOnly = outlineOnly; }
|
|
|
|
//! Set direction the emitter emits particles
|
|
virtual void setDirection( const core::vector3df& newDirection ) IRR_OVERRIDE { Direction = newDirection; }
|
|
|
|
//! Set direction the emitter emits particles
|
|
virtual void setMinParticlesPerSecond( u32 minPPS ) IRR_OVERRIDE { MinParticlesPerSecond = minPPS; }
|
|
|
|
//! Set direction the emitter emits particles
|
|
virtual void setMaxParticlesPerSecond( u32 maxPPS ) IRR_OVERRIDE { MaxParticlesPerSecond = maxPPS; }
|
|
|
|
//! Set direction the emitter emits particles
|
|
virtual void setMinStartColor( const video::SColor& color ) IRR_OVERRIDE { MinStartColor = color; }
|
|
|
|
//! Set direction the emitter emits particles
|
|
virtual void setMaxStartColor( const video::SColor& color ) IRR_OVERRIDE { MaxStartColor = color; }
|
|
|
|
//! Set the maximum starting size for particles
|
|
virtual void setMaxStartSize( const core::dimension2df& size ) IRR_OVERRIDE { MaxStartSize = size; }
|
|
|
|
//! Set the minimum starting size for particles
|
|
virtual void setMinStartSize( const core::dimension2df& size ) IRR_OVERRIDE { MinStartSize = size; }
|
|
|
|
//! Set the minimum particle life-time in milliseconds
|
|
virtual void setMinLifeTime( u32 lifeTimeMin ) IRR_OVERRIDE { MinLifeTime = lifeTimeMin; }
|
|
|
|
//! Set the maximum particle life-time in milliseconds
|
|
virtual void setMaxLifeTime( u32 lifeTimeMax ) IRR_OVERRIDE { MaxLifeTime = lifeTimeMax; }
|
|
|
|
//! Maximal random derivation from the direction
|
|
virtual void setMaxAngleDegrees( s32 maxAngleDegrees ) IRR_OVERRIDE { MaxAngleDegrees = maxAngleDegrees; }
|
|
|
|
//! Get the center of the cylinder
|
|
virtual const core::vector3df& getCenter() const IRR_OVERRIDE { return Center; }
|
|
|
|
//! Get the normal of the cylinder
|
|
virtual const core::vector3df& getNormal() const IRR_OVERRIDE { return Normal; }
|
|
|
|
//! Get the radius of the cylinder
|
|
virtual f32 getRadius() const IRR_OVERRIDE { return Radius; }
|
|
|
|
//! Get the center of the cylinder
|
|
virtual f32 getLength() const IRR_OVERRIDE { return Length; }
|
|
|
|
//! Get whether or not to draw points inside the cylinder
|
|
virtual bool getOutlineOnly() const IRR_OVERRIDE { return OutlineOnly; }
|
|
|
|
//! Gets direction the emitter emits particles
|
|
virtual const core::vector3df& getDirection() const IRR_OVERRIDE { return Direction; }
|
|
|
|
//! Gets direction the emitter emits particles
|
|
virtual u32 getMinParticlesPerSecond() const IRR_OVERRIDE { return MinParticlesPerSecond; }
|
|
|
|
//! Gets direction the emitter emits particles
|
|
virtual u32 getMaxParticlesPerSecond() const IRR_OVERRIDE { return MaxParticlesPerSecond; }
|
|
|
|
//! Gets direction the emitter emits particles
|
|
virtual const video::SColor& getMinStartColor() const IRR_OVERRIDE { return MinStartColor; }
|
|
|
|
//! Gets direction the emitter emits particles
|
|
virtual const video::SColor& getMaxStartColor() const IRR_OVERRIDE { return MaxStartColor; }
|
|
|
|
//! Gets the maximum starting size for particles
|
|
virtual const core::dimension2df& getMaxStartSize() const IRR_OVERRIDE { return MaxStartSize; }
|
|
|
|
//! Gets the minimum starting size for particles
|
|
virtual const core::dimension2df& getMinStartSize() const IRR_OVERRIDE { return MinStartSize; }
|
|
|
|
//! Get the minimum particle life-time in milliseconds
|
|
virtual u32 getMinLifeTime() const IRR_OVERRIDE { return MinLifeTime; }
|
|
|
|
//! Get the maximum particle life-time in milliseconds
|
|
virtual u32 getMaxLifeTime() const IRR_OVERRIDE { return MaxLifeTime; }
|
|
|
|
//! Maximal random derivation from the direction
|
|
virtual s32 getMaxAngleDegrees() const IRR_OVERRIDE { return MaxAngleDegrees; }
|
|
|
|
//! Writes attributes of the object.
|
|
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const IRR_OVERRIDE;
|
|
|
|
//! Reads attributes of the object.
|
|
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) IRR_OVERRIDE;
|
|
|
|
private:
|
|
|
|
core::array<SParticle> Particles;
|
|
|
|
core::vector3df Center;
|
|
core::vector3df Normal;
|
|
core::vector3df Direction;
|
|
core::dimension2df MaxStartSize, MinStartSize;
|
|
u32 MinParticlesPerSecond, MaxParticlesPerSecond;
|
|
video::SColor MinStartColor, MaxStartColor;
|
|
u32 MinLifeTime, MaxLifeTime;
|
|
|
|
f32 Radius;
|
|
f32 Length;
|
|
|
|
u32 Time;
|
|
s32 MaxAngleDegrees;
|
|
|
|
bool OutlineOnly;
|
|
};
|
|
|
|
} // end namespace scene
|
|
} // end namespace irr
|
|
|
|
#endif // _IRR_COMPILE_WITH_PARTICLES_
|
|
|
|
#endif
|