Explosion Class Reference

Generic explosion class ; which is at the same time a 3D effect, an evolving physic object, and weapon properties. More...

#include <Explosion.h>

Inheritance diagram for Explosion:

Inheritance graph
[legend]

List of all members.

Classes

class  LSCallback

Public Member Functions

virtual EContainerType getType () const
 Gets the type of the current container.
 Explosion (bool createAnimation=true, const C3DPhy *pInheritTeamAndPlayer=NULL)
 Creates an explosion with default parameters.
 Explosion (const ExplosionParams &params, bool createAnimation=true, const C3DPhy *pInheritTeamAndPlayer=NULL)
 Creates an explosion with given parameters.
virtual void step (dReal stepSize)
 Steps the 3D-Phy. Default is to do nothing but decreasing the TTL and call the onTTLZero() method if necessary.
osg::ImageSequence * getAnimation ()
const osg::ImageSequence * getAnimation () const
virtual bool hitBefore (Physics::Contact *pContacts, unsigned int nbContacts, Physics::Contact *pMaxEnergyContact, Physics::Geom &thisGeom, Physics::Geom &otherGeom, Physics::Body *&inout_pThisBody, Physics::Body *&inout_pOtherBody)
 Default behaviour on hit is to do nothing.
Energy parameters
Values are generally energy values (in joules).

Please not here that WeaponEnergy::PERFORANT is not supported for explosions.

void setParam (WeaponEnergy::EEneryType energyType, float value)
 Sets a value for a given energy type.
float getParam (WeaponEnergy::EEneryType energyType) const

Protected Member Functions

virtual ~Explosion ()
void init (bool createAnimation=true)
void createLight (UINT lightNumber)

Protected Attributes

float vParams [WeaponEnergy::MAX_WEAPON_ENERGY]
float radius
 Current radius.
osg::Group * pSphere
 3D growing sphere.
osg::ImageSequence * pSpriteIS
 Animated sprite image sequence, or NULL.
float spriteTime
osg::LightSource * pLight

Friends

class LSCallback


Detailed Description

Generic explosion class ; which is at the same time a 3D effect, an evolving physic object, and weapon properties.

An explosion is a growing (or not) sphere that pushes away things and give them cinetic energy and potentially all WeaponEnergy::EEneryType energies. The explosion has no mass (no Body, just a Geom), and thus the force applied to the touched objects is absolutly not related to the cinetic energy produced by the velocity of the explosion. The force applied relies on given values: the initial force and attenuation factors.

Author:
Sukender
Warning:
TTL has no effect on an Explosion object (C3DPhy::setTTL()).
Version:
0.2.0 - Under dev
See also:
Missile
Todo:
Add real support for instant explosions.

Add sprites support for cool effects (How do we animate? How long? Which color of the polys?...).

Add debris support for cool effects? Or manually add them outside? Or support one or two default options?

Add sound support (sound played once).

(low) Support custom force attenuation.

(low) Support non-linear growth (logarithmic / sqrtf like) and explosion time as an equivalent of growingSpeed.

Add support for camera shaking.

Add support for creation via a factory (?).

Definition at line 103 of file Explosion.h.


Constructor & Destructor Documentation

Explosion::Explosion ( bool  createAnimation = true,
const C3DPhy pInheritTeamAndPlayer = NULL 
)

Creates an explosion with default parameters.

Definition at line 68 of file Explosion.cpp.

References init().

Explosion::Explosion ( const ExplosionParams params,
bool  createAnimation = true,
const C3DPhy pInheritTeamAndPlayer = NULL 
)

Creates an explosion with given parameters.

Definition at line 78 of file Explosion.cpp.

References init().

Explosion::~Explosion (  )  [protected, virtual]


Member Function Documentation

void Explosion::createLight ( UINT  lightNumber  )  [protected]

const osg::ImageSequence* Explosion::getAnimation (  )  const [inline]

Definition at line 116 of file Explosion.h.

osg::ImageSequence* Explosion::getAnimation (  )  [inline]

Definition at line 115 of file Explosion.h.

float Explosion::getParam ( WeaponEnergy::EEneryType  energyType  )  const [inline]

Definition at line 130 of file Explosion.h.

virtual EContainerType Explosion::getType (  )  const [inline, virtual]

Gets the type of the current container.

Reimplemented from C3DPhy.

Definition at line 105 of file Explosion.h.

bool Explosion::hitBefore ( Physics::Contact pContacts,
unsigned int  nbContacts,
Physics::Contact pMaxEnergyContact,
Physics::Geom thisGeom,
Physics::Geom otherGeom,
Physics::Body *&  inout_pThisBody,
Physics::Body *&  inout_pOtherBody 
) [virtual]

void Explosion::init ( bool  createAnimation = true  )  [protected]

void Explosion::setParam ( WeaponEnergy::EEneryType  energyType,
float  value 
) [inline]

Sets a value for a given energy type.

Be aware that values are attenuated over time, as the explosion grows, the same way the force is attenuated.

Warning:
By default the explosion does not create cinetic damage (=no call to isHitByCinetic()).

Definition at line 129 of file Explosion.h.

References ASSERT, and WeaponEnergy::PERFORANT.

void Explosion::step ( dReal  stepSize  )  [virtual]


Friends And Related Function Documentation

friend class LSCallback [friend]

Definition at line 140 of file Explosion.h.

Referenced by init().


Member Data Documentation

osg::LightSource* Explosion::pLight [protected]

Definition at line 150 of file Explosion.h.

Referenced by createLight(), Explosion::LSCallback::onSourceTaken(), step(), and ~Explosion().

osg::Group* Explosion::pSphere [protected]

3D growing sphere.

Definition at line 146 of file Explosion.h.

Referenced by init(), and step().

osg::ImageSequence* Explosion::pSpriteIS [protected]

Animated sprite image sequence, or NULL.

Definition at line 148 of file Explosion.h.

Referenced by init(), and step().

float Explosion::radius [protected]

Current radius.

Definition at line 144 of file Explosion.h.

Referenced by hitBefore(), init(), and step().

float Explosion::spriteTime [protected]

Definition at line 149 of file Explosion.h.

Referenced by step().

float Explosion::vParams[WeaponEnergy::MAX_WEAPON_ENERGY] [protected]

Definition at line 142 of file Explosion.h.

Referenced by hitBefore(), and init().


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

Generated on Sun Jan 17 11:39:27 2010 for PVLE (Pro-Vocation Light Engine) by  doxygen 1.5.9