Colobot
Loading...
Searching...
No Matches
Gfx::CParticle Class Reference

Particle engine. More...

#include <src/graphics/engine/particle.h>

Public Member Functions

 CParticle (CEngine *engine)
void SetDevice (CDevice *device)
 Sets the device to use.
void FlushParticle ()
 Removes all particles.
void FlushParticle (int sheet)
 Removes all particles of a sheet.
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.
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).
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.
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).
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.
void CreateWheelTrace (const Math::Vector &p1, const Math::Vector &p2, const Math::Vector &p3, const Math::Vector &p4, TraceColor color)
 Creates a tire mark.
void DeleteParticle (ParticleType type)
 Removes all particles of a given type.
void DeleteParticle (int channel)
 Removes all particles of a given channel.
void SetObjectLink (int channel, CObject *object)
 Specifies the object to which the particle is bound.
void SetObjectFather (int channel, CObject *object)
 Specifies the parent object that created the particle.
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)
bool GetPosition (int channel, Math::Vector &pos)
 Returns the position of the particle.
Color GetFogColor (Math::Vector pos)
 Returns the color if you're in the fog or black if you're not.
void SetFrameUpdate (int sheet, bool update)
 Indicates whether a sheet is updated or not.
void FrameParticle (float rTime)
 Updates all the particles.
void DrawParticle (int sheet)
 Draws all the particles.
void CutObjectLink (CObject *obj)
 Indicates that the object binds to the particle no longer exists, without deleting it.

Protected Member Functions

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

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

◆ SetDevice()

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

Sets the device to use.

◆ FlushParticle() [1/2]

void Gfx::CParticle::FlushParticle ( )

Removes all particles.

◆ FlushParticle() [2/2]

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

Removes all particles of a sheet.

◆ CreateParticle()

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.

◆ CreateFrag()

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

◆ CreatePart()

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

◆ CreateRay()

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

◆ CreateTrack()

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)!

◆ CreateWheelTrace()

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.

◆ DeleteParticle() [1/2]

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

Removes all particles of a given type.

◆ DeleteParticle() [2/2]

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

Removes all particles of a given channel.

◆ SetObjectLink()

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

Specifies the object to which the particle is bound.

◆ SetObjectFather()

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

Specifies the parent object that created the particle.

◆ GetPosition()

bool Gfx::CParticle::GetPosition ( int channel,
Math::Vector & pos )

Returns the position of the particle.

◆ GetFogColor()

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

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

◆ SetFrameUpdate()

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

Indicates whether a sheet is updated or not.

◆ FrameParticle()

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

Updates all the particles.

◆ DrawParticle()

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

Draws all the particles.

◆ CutObjectLink()

void Gfx::CParticle::CutObjectLink ( CObject * obj)

Indicates that the object binds to the particle no longer exists, without deleting it.

◆ DeleteRank()

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

Removes a particle of given rank.

◆ CheckChannel()

bool Gfx::CParticle::CheckChannel ( 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
Returns
true if success, false if particle doesn't exist anymore

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

◆ DrawParticleTriangle()

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

Draws a triangular particle.

◆ DrawParticleNorm()

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

Draw a normal particle.

◆ DrawParticleFlat()

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

Draw a particle flat (horizontal).

◆ DrawParticleFog()

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

Draw a particle to a flat sheet of fog.

◆ DrawParticleRay()

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

Draw a particle in the form of radius.

◆ DrawParticleSphere()

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

Draws a spherical particle.

◆ DrawParticleCylinder()

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

Draws a cylindrical particle.

◆ DrawParticleText()

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

Draws a text particle.

◆ DrawParticleWheel()

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

Draws a tire mark.

◆ SearchObjectGun()

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

Seeks if an object collided with a bullet.

◆ SearchObjectRay()

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

Seeks if an object collided with a ray.

◆ Play()

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

Sounded one.

◆ TrackMove()

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

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

◆ TrackDraw()

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

Draws a drag.


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