Colobot
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Gfx::CParticle Class Reference

Particle engine. More...

#include <particle.h>

Public Member Functions

 CParticle (CEngine *engine)
 
void SetDevice (CDevice *device)
 Sets the device to use. More...
 
void FlushParticle ()
 Removes all particles. More...
 
void FlushParticle (int sheet)
 Removes all particles of a sheet. More...
 
int CreateParticle (Math::Vector pos, Math::Vector speed, Math::Point dim, ParticleType type, float duration=1.0f, float mass=0.0f, float windSensitivity=1.0f, int sheet=0)
 Creates a new particle. More...
 
int CreateFrag (Math::Vector pos, Math::Vector speed, EngineTriangle *triangle, ParticleType type, float duration=1.0f, float mass=0.0f, float windSensitivity=1.0f, int sheet=0)
 Creates a new triangular particle (debris) More...
 
int CreatePart (Math::Vector pos, Math::Vector speed, ParticleType type, float duration=1.0f, float mass=0.0f, float weight=0.0f, float windSensitivity=1.0f, int sheet=0)
 Creates a new particle being a part of object. More...
 
int CreateRay (Math::Vector pos, Math::Vector goal, ParticleType type, Math::Point dim, float duration=1.0f, int sheet=0)
 Creates a new linear particle (radius) More...
 
int CreateTrack (Math::Vector pos, Math::Vector speed, Math::Point dim, ParticleType type, float duration=1.0f, float mass=0.0f, float length=10.0f, float width=1.0f)
 Creates a particle with a trail. More...
 
void CreateWheelTrace (const Math::Vector &p1, const Math::Vector &p2, const Math::Vector &p3, const Math::Vector &p4, TraceColor color)
 Creates a tire mark. More...
 
void DeleteParticle (ParticleType type)
 Removes all particles of a given type. More...
 
void DeleteParticle (int channel)
 Removes all particles of a given channel. More...
 
void SetObjectLink (int channel, CObject *object)
 Specifies the object to which the particle is bound. More...
 
void SetObjectFather (int channel, CObject *object)
 Specifies the parent object that created the particle. More...
 
void SetPosition (int channel, Math::Vector pos)
 
void SetDimension (int channel, Math::Point dim)
 
void SetZoom (int channel, float zoom)
 
void SetAngle (int channel, float angle)
 
void SetIntensity (int channel, float intensity)
 
void SetParam (int channel, Math::Vector pos, Math::Point dim, float zoom, float angle, float intensity)
 
void SetPhase (int channel, ParticlePhase phase, float duration)
 
Math::Vector GetPosition (int channel)
 Returns the position of the particle. More...
 
Color GetFogColor (Math::Vector pos)
 Returns the color if you're in the fog or black if you're not. More...
 
void SetFrameUpdate (int sheet, bool update)
 Indicates whether a sheet is updated or not. More...
 
void FrameParticle (float rTime)
 Updates all the particles. More...
 
void DrawParticle (int sheet)
 Draws all the particles. More...
 
bool ParticleExists (int channel)
 Checks if given particle channel still exists. More...
 

Protected Member Functions

void DeleteRank (int rank)
 Removes a particle of given rank. More...
 
void GetRankFromChannel (int &channel)
 Adapts the channel so it can be used as an offset in m_particle. More...
 
void DrawParticleTriangle (int i)
 Draws a triangular particle. More...
 
void DrawParticleNorm (int i)
 Draw a normal particle. More...
 
void DrawParticleFlat (int i)
 Draw a particle flat (horizontal) More...
 
void DrawParticleFog (int i)
 Draw a particle to a flat sheet of fog. More...
 
void DrawParticleRay (int i)
 Draw a particle in the form of radius. More...
 
void DrawParticleSphere (int i)
 Draws a spherical particle. More...
 
void DrawParticleCylinder (int i)
 Draws a cylindrical particle. More...
 
void DrawParticleText (int i)
 Draws a text particle. More...
 
void DrawParticleWheel (int i)
 Draws a tire mark. More...
 
CObjectSearchObjectGun (Math::Vector old, Math::Vector pos, ParticleType type, CObject *father)
 Seeks if an object collided with a bullet. More...
 
CObjectSearchObjectRay (Math::Vector pos, Math::Vector goal, ParticleType type, CObject *father)
 Seeks if an object collided with a ray. More...
 
void Play (SoundType sound, Math::Vector pos, float amplitude)
 Sounded one. More...
 
bool TrackMove (int i, Math::Vector pos, float progress)
 Moves a drag; returns true if the drag is finished. More...
 
void TrackDraw (int i, ParticleType type)
 Draws a drag. More...
 

Protected Attributes

CEnginem_engine = nullptr
 
CDevicem_device = nullptr
 
CTerrainm_terrain = nullptr
 
CWaterm_water = nullptr
 
CRobotMainm_main = nullptr
 
CSoundInterfacem_sound = nullptr
 
Particle m_particle [MAXPARTICULE *MAXPARTITYPE]
 
EngineTriangle m_triangle [MAXPARTICULE]
 
Track m_track [MAXTRACK]
 
int m_wheelTraceTotal = 0
 
int m_wheelTraceIndex = 0
 
WheelTrace m_wheelTrace [MAXWHEELTRACE]
 
int m_totalInterface [MAXPARTITYPE][SH_MAX] = {}
 
bool m_frameUpdate [SH_MAX] = {}
 
int m_fogTotal = 0
 
int m_fog [MAXPARTIFOG] = {}
 
int m_uniqueStamp = 0
 
int m_exploGunCounter = 0
 
float m_lastTimeGunDel = 0.0f
 
float m_absTime = 0.0f
 

Detailed Description

Particle engine.

TODO: documentation

Member Function Documentation

void Gfx::CParticle::SetDevice ( CDevice device)

Sets the device to use.

void Gfx::CParticle::FlushParticle ( )

Removes all particles.

void Gfx::CParticle::FlushParticle ( int  sheet)

Removes all particles of a sheet.

int Gfx::CParticle::CreateParticle ( Math::Vector  pos,
Math::Vector  speed,
Math::Point  dim,
ParticleType  type,
float  duration = 1.0f,
float  mass = 0.0f,
float  windSensitivity = 1.0f,
int  sheet = 0 
)

Creates a new particle.

Returns the channel of the particle created or -1 on error.

int Gfx::CParticle::CreateFrag ( Math::Vector  pos,
Math::Vector  speed,
EngineTriangle triangle,
ParticleType  type,
float  duration = 1.0f,
float  mass = 0.0f,
float  windSensitivity = 1.0f,
int  sheet = 0 
)

Creates a new triangular particle (debris)

Returns the channel of the particle created or -1 on error

int Gfx::CParticle::CreatePart ( Math::Vector  pos,
Math::Vector  speed,
ParticleType  type,
float  duration = 1.0f,
float  mass = 0.0f,
float  weight = 0.0f,
float  windSensitivity = 1.0f,
int  sheet = 0 
)

Creates a new particle being a part of object.

Returns the channel of the particle created or -1 on error

int Gfx::CParticle::CreateRay ( Math::Vector  pos,
Math::Vector  goal,
ParticleType  type,
Math::Point  dim,
float  duration = 1.0f,
int  sheet = 0 
)

Creates a new linear particle (radius)

Returns the channel of the particle created or -1 on error

int Gfx::CParticle::CreateTrack ( Math::Vector  pos,
Math::Vector  speed,
Math::Point  dim,
ParticleType  type,
float  duration = 1.0f,
float  mass = 0.0f,
float  length = 10.0f,
float  width = 1.0f 
)

Creates a particle with a trail.

"length" is the length of the tail of drag (in seconds)!

void Gfx::CParticle::CreateWheelTrace ( const Math::Vector p1,
const Math::Vector p2,
const Math::Vector p3,
const Math::Vector p4,
TraceColor  color 
)

Creates a tire mark.

void Gfx::CParticle::DeleteParticle ( ParticleType  type)

Removes all particles of a given type.

void Gfx::CParticle::DeleteParticle ( int  channel)

Removes all particles of a given channel.

void Gfx::CParticle::SetObjectLink ( int  channel,
CObject object 
)

Specifies the object to which the particle is bound.

void Gfx::CParticle::SetObjectFather ( int  channel,
CObject object 
)

Specifies the parent object that created the particle.

Math::Vector Gfx::CParticle::GetPosition ( int  channel)

Returns the position of the particle.

Color Gfx::CParticle::GetFogColor ( Math::Vector  pos)

Returns the color if you're in the fog or black if you're not.

void Gfx::CParticle::SetFrameUpdate ( int  sheet,
bool  update 
)

Indicates whether a sheet is updated or not.

void Gfx::CParticle::FrameParticle ( float  rTime)

Updates all the particles.

void Gfx::CParticle::DrawParticle ( int  sheet)

Draws all the particles.

bool Gfx::CParticle::ParticleExists ( int  channel)

Checks if given particle channel still exists.

void Gfx::CParticle::DeleteRank ( int  rank)
protected

Removes a particle of given rank.

void Gfx::CParticle::GetRankFromChannel ( int &  channel)
protected

Adapts the channel so it can be used as an offset in m_particle.

Parameters
channelChannel number to process, will be modified to be index of particle in m_particle
Exceptions
std::runtime_errorif this particle does not exist any more
void Gfx::CParticle::DrawParticleTriangle ( int  i)
protected

Draws a triangular particle.

void Gfx::CParticle::DrawParticleNorm ( int  i)
protected

Draw a normal particle.

void Gfx::CParticle::DrawParticleFlat ( int  i)
protected

Draw a particle flat (horizontal)

void Gfx::CParticle::DrawParticleFog ( int  i)
protected

Draw a particle to a flat sheet of fog.

void Gfx::CParticle::DrawParticleRay ( int  i)
protected

Draw a particle in the form of radius.

void Gfx::CParticle::DrawParticleSphere ( int  i)
protected

Draws a spherical particle.

void Gfx::CParticle::DrawParticleCylinder ( int  i)
protected

Draws a cylindrical particle.

void Gfx::CParticle::DrawParticleText ( int  i)
protected

Draws a text particle.

void Gfx::CParticle::DrawParticleWheel ( int  i)
protected

Draws a tire mark.

CObject * Gfx::CParticle::SearchObjectGun ( Math::Vector  old,
Math::Vector  pos,
ParticleType  type,
CObject father 
)
protected

Seeks if an object collided with a bullet.

CObject * Gfx::CParticle::SearchObjectRay ( Math::Vector  pos,
Math::Vector  goal,
ParticleType  type,
CObject father 
)
protected

Seeks if an object collided with a ray.

void Gfx::CParticle::Play ( SoundType  sound,
Math::Vector  pos,
float  amplitude 
)
protected

Sounded one.

bool Gfx::CParticle::TrackMove ( int  i,
Math::Vector  pos,
float  progress 
)
protected

Moves a drag; returns true if the drag is finished.

void Gfx::CParticle::TrackDraw ( int  i,
ParticleType  type 
)
protected

Draws a drag.


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