Skylicht Engine
Loading...
Searching...
No Matches
Skylicht::Particle::CEmitter Class Referenceabstract

Base class for particle emitters. More...

#include <ParticleSystem/Particles/Emitters/CEmitter.h>

Inheritance diagram for Skylicht::Particle::CEmitter:
Skylicht::Particle::CParticleSerializable Skylicht::Particle::CDirectionEmitter Skylicht::Particle::CNormalEmitter Skylicht::Particle::CRandomEmitter Skylicht::Particle::CSphericEmitter Skylicht::Particle::CStraightEmitter

Public Member Functions

 CEmitter (EEmitter type)
virtual CObjectSerializablecreateSerializable ()
 Creates a serializable object for property editing or saving.
virtual void loadSerializable (CObjectSerializable *object)
 Loads properties from a serializable object.
virtual bool haveDirection ()
 Returns true if this emitter has a primary direction.
CZonesetZone (CZone *z)
 Sets the spawn zone.
CZonegetZone ()
 Gets the current spawn zone.
void stop ()
 Stops the emitter immediately.
void setTank (int tank)
 Sets the tank capacity and current value.
void resetTank ()
 Resets the tank and flow logic.
int getTank ()
 Gets current tank value.
int getLastTank ()
 Gets last set tank value.
void setTankValue (int tank)
 Updates the persistent tank value without immediate reset.
int getDefaultTank ()
 Gets default tank from serializable data.
float getDefaultFlow ()
 Gets default flow from serializable data.
void setFlow (float flow)
 Sets continuous birth rate (particles per second).
float getFlow ()
 Gets current flow rate.
void setActive (bool b)
 Enables or disables the emitter.
bool isActive ()
 Checks if emitter is active.
void setDelay (float timeSecond)
 Sets start delay in seconds.
void setForce (float min, float max)
 Sets initial velocity force range.
float getForceMin ()
 Gets min force.
float getForceMax ()
 Gets max force.
void setResetTankInterval (float min, float max)
 Sets interval for automatic tank resets.
void setEmitFullZone (bool b)
 Sets volume spawn mode.
bool isEmitFullZone ()
 Checks volume spawn mode.
EEmitter getType ()
 Gets emitter type.
const wchar_t * getName ()
 Gets display name.
virtual u32 updateNumber (float deltaTime)
 Calculates how many particles should be born this frame.
virtual void setBornData (SBornData &data)
 Initializes birth data for sub-emitters.
u32 updateBornData (u32 index, float deltaTime)
 Internal: updates birth calculation for a specific sub-group particle index.
virtual u32 updateBornData (SBornData &data, float deltaTime)
 Internal: core logic for sub-emitter birth calculation.
void clearBornData ()
 Clears sub-emitter birth records.
void generateVelocity (CParticle &particle, CZone *zone, CGroup *group)
 Generates initial velocity for a particle.
void emitParticle (CParticle &particle, CZone *zone, CGroup *group)
 Full emission logic: generates position and velocity.
virtual void generateVelocity (CParticle &particle, float speed, CZone *zone, CGroup *group)=0
 Implementation-specific velocity generation.
u32 addBornData ()
 Adds a new sub-emitter record.
void swapBornData (int index1, int index2)
 Swaps sub-emitter records (for array reordering).
void deleteBornData ()
 Removes a sub-emitter record.

Protected Attributes

int m_lastTank
int m_defaultTank
int m_tank
 Current particles remaining in the tank.
float m_flow
 Current birth rate (particles per second).
float m_lastFlow
float m_defaultFlow
float m_flowLifeTime
 Duration of the flow logic before it stops.
float m_forceMin
 Minimum magnitude of initial velocity.
float m_forceMax
 Maximum magnitude of initial velocity.
float m_fraction
bool m_active
 Active status.
bool m_emitFullZone
 Whether to spawn particles randomly within the zone volume.
float m_delay
 Configured delay.
float m_waitDelay
 Current waiting time for delay.
float m_lifeTime
 Total time elapsed since start.
float m_reset
 Current reset timer.
float m_resetIntervalMin
 Min interval for auto-resetting the tank.
float m_resetIntervalMax
 Max interval for auto-resetting the tank.
CZonem_zone
 The spawn zone assigned to this emitter.
EEmitter m_type
 Type of the emitter.
core::array< SBornDatam_bornData
 Internal: birth data for sub-emitters.

Detailed Description

Base class for particle emitters.

Emitters control how many particles are born per second (Flow) and their initial velocity. They can operate in "Flow" mode (continuous) or "Tank" mode (limited count).

Member Function Documentation

◆ createSerializable()

virtual CObjectSerializable * Skylicht::Particle::CEmitter::createSerializable ( )
virtual

Creates a serializable object for property editing or saving.

Returns
Pointer to a new CObjectSerializable instance.

Reimplemented from Skylicht::Particle::CParticleSerializable.

Reimplemented in Skylicht::Particle::CNormalEmitter, Skylicht::Particle::CSphericEmitter, and Skylicht::Particle::CStraightEmitter.

◆ generateVelocity()

virtual void Skylicht::Particle::CEmitter::generateVelocity ( CParticle & particle,
float speed,
CZone * zone,
CGroup * group )
pure virtual

◆ haveDirection()

virtual bool Skylicht::Particle::CEmitter::haveDirection ( )
inlinevirtual

Returns true if this emitter has a primary direction.

Reimplemented in Skylicht::Particle::CDirectionEmitter.

◆ loadSerializable()

virtual void Skylicht::Particle::CEmitter::loadSerializable ( CObjectSerializable * object)
virtual

Loads properties from a serializable object.

Parameters
objectThe serializable data to load.

Reimplemented from Skylicht::Particle::CParticleSerializable.

Reimplemented in Skylicht::Particle::CNormalEmitter, Skylicht::Particle::CSphericEmitter, and Skylicht::Particle::CStraightEmitter.


The documentation for this class was generated from the following file: