Colobot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
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.
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, ParticleType type)
 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.
bool WriteWheelTrace (const char *filename, int width, int height, Math::Vector dl, Math::Vector ur)
 Writes a file containing all the tire tracks.

Protected Member Functions

void DeleteRank (int rank)
 Removes a particle of given rank.
bool CheckChannel (int &channel)
 Check a channel number.
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 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 (Sound 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
CDevicem_device
CTerrainm_terrain
CWaterm_water
CRobotMainm_main
CSoundInterfacem_sound
Particle m_particle [MAXPARTICULE *MAXPARTITYPE]
EngineTriangle m_triangle [MAXPARTICULE]
Track m_track [MAXTRACK]
int m_wheelTraceTotal
int m_wheelTraceIndex
WheelTrace m_wheelTrace [MAXWHEELTRACE]
int m_totalInterface [MAXPARTITYPE][SH_MAX]
bool m_frameUpdate [SH_MAX]
int m_fogTotal
int m_fog [MAXPARTIFOG]
int m_uniqueStamp
int m_exploGunCounter
float m_lastTimeGunDel
float m_absTime

Detailed Description

Particle engine.

TODO: documentation

Member Function Documentation

bool Gfx::CParticle::CheckChannel ( int &  channel)
protected

Check a channel number.

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

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


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