Colobot
|
#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... | |
CObject * | SearchObjectGun (Math::Vector old, Math::Vector pos, ParticleType type, CObject *father) |
Seeks if an object collided with a bullet. More... | |
CObject * | SearchObjectRay (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 | |
CEngine * | m_engine = nullptr |
CDevice * | m_device = nullptr |
CTerrain * | m_terrain = nullptr |
CWater * | m_water = nullptr |
CRobotMain * | m_main = nullptr |
CSoundInterface * | m_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 |
Particle engine.
TODO: 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.
|
protected |
Removes a particle of given rank.
|
protected |
Adapts the channel so it can be used as an offset in m_particle.
channel | Channel number to process, will be modified to be index of particle in m_particle |
std::runtime_error | if this particle does not exist any more |
|
protected |
Draws a triangular particle.
|
protected |
Draw a normal particle.
|
protected |
Draw a particle flat (horizontal)
|
protected |
Draw a particle to a flat sheet of fog.
|
protected |
Draw a particle in the form of radius.
|
protected |
Draws a spherical particle.
|
protected |
Draws a cylindrical particle.
|
protected |
Draws a text particle.
|
protected |
Draws a tire mark.
|
protected |
Seeks if an object collided with a bullet.
|
protected |
Seeks if an object collided with a ray.
|
protected |
Sounded one.
|
protected |
Moves a drag; returns true if the drag is finished.
|
protected |
Draws a drag.