Particle Universe  1.2
ParticleUniverse::VertexEmitter Class Reference

#include <ParticleUniverseVertexEmitter.h>

Inheritance diagram for ParticleUniverse::VertexEmitter:

Public Member Functions

 VertexEmitter (void)
 
virtual ~VertexEmitter (void)
 
unsigned short getIterations (void) const
 
void setIterations (unsigned short iterations)
 
unsigned short getSegments (void) const
 
void setSegments (unsigned short segments)
 
unsigned short getStep (void) const
 
void setStep (unsigned short step)
 
const StringgetMeshName (void) const
 
virtual void _notifyStart (void)
 
void setMeshName (const String &meshName)
 
virtual void _initParticlePosition (Particle *particle)
 
unsigned short _calculateRequestedParticles (Real timeElapsed)
 
virtual void copyAttributesTo (ParticleEmitter *emitter)
 
- Public Member Functions inherited from ParticleUniverse::ParticleEmitter
 ParticleEmitter (void)
 
virtual ~ParticleEmitter (void)
 
ParticleTechniquegetParentTechnique (void) const
 
void setParentTechnique (ParticleTechnique *parentTechnique)
 
const StringgetEmitterType (void) const
 
void setEmitterType (const String &emitterType)
 
const StringgetName (void) const
 
void setName (const String &name)
 
DynamicAttributegetDynAngle (void) const
 
void setDynAngle (DynamicAttribute *dynAngle)
 
DynamicAttributegetDynEmissionRate (void) const
 
void setDynEmissionRate (DynamicAttribute *dynEmissionRate)
 
DynamicAttributegetDynTotalTimeToLive (void) const
 
void setDynTotalTimeToLive (DynamicAttribute *dynTotalTimeToLive)
 
DynamicAttributegetDynParticleMass (void) const
 
void setDynParticleMass (DynamicAttribute *dynParticleMass)
 
DynamicAttributegetDynVelocity (void) const
 
void setDynVelocity (DynamicAttribute *dynVelocity)
 
DynamicAttributegetDynDuration (void) const
 
void setDynDuration (DynamicAttribute *dynDuration)
 
void setDynDurationSet (bool durationSet)
 
DynamicAttributegetDynRepeatDelay (void) const
 
void setDynRepeatDelay (DynamicAttribute *dynRepeatDelay)
 
void setDynRepeatDelaySet (bool repeatDelaySet)
 
DynamicAttributegetDynParticleAllDimensions (void) const
 
void setDynParticleAllDimensions (DynamicAttribute *dynParticleAllDimensions)
 
void setDynParticleAllDimensionsSet (bool particleAllDimensionsSet)
 
DynamicAttributegetDynParticleWidth (void) const
 
void setDynParticleWidth (DynamicAttribute *dynParticleWidth)
 
void setDynParticleWidthSet (bool particleWidthSet)
 
DynamicAttributegetDynParticleHeight (void) const
 
void setDynParticleHeight (DynamicAttribute *dynParticleHeight)
 
void setDynParticleHeightSet (bool particleHeightSet)
 
DynamicAttributegetDynParticleDepth (void) const
 
void setDynParticleDepth (DynamicAttribute *dynParticleDepth)
 
void setDynParticleDepthSet (bool particleDepthSet)
 
ParticleType getEmitsType (void) const
 
void setEmitsType (ParticleType emitsType)
 
const StringgetEmitsName (void) const
 
void setEmitsName (const String &emitsName)
 
void setEmissionRateCameraDependency (CameraDependency *cameraDependency)
 
void setEmissionRateCameraDependency (Real squareDistance, bool inc=false)
 
CameraDependencygetEmissionRateCameraDependency (void) const
 
virtual const Vector3getParticleDirection (void)
 
const Vector3getOriginalParticleDirection (void) const
 
const QuaterniongetParticleOrientation (void) const
 
void setParticleOrientation (const Quaternion &orientation)
 
const QuaterniongetParticleOrientationRangeStart (void) const
 
void setParticleOrientationRangeStart (const Quaternion &orientationRangeStart)
 
const QuaterniongetParticleOrientationRangeEnd (void) const
 
void setParticleOrientationRangeEnd (const Quaternion &orientationRangeEnd)
 
virtual void setEnabled (bool enabled)
 
virtual void setParticleDirection (const Vector3 &direction)
 
bool isAutoDirection (void) const
 
void setAutoDirection (bool autoDirection)
 
bool isForceEmission (void) const
 
void setForceEmission (bool forceEmission)
 
virtual void _prepare (ParticleTechnique *particleTechnique)
 
virtual void _unprepare (ParticleTechnique *particleTechnique)
 
virtual void _postProcessParticles (ParticleTechnique *technique, Real timeElapsed)
 
virtual void _initForEmission (void)
 
virtual void _initForExpiration (ParticleTechnique *technique, Real timeElapsed)
 
virtual void _initParticleForEmission (Particle *particle)
 
virtual void _initParticleDirection (Particle *particle)
 
virtual void _initParticleOrientation (Particle *particle)
 
void _generateAngle (Radian &angle)
 
virtual void _initParticleVelocity (Particle *particle)
 
virtual void _initParticleMass (Particle *particle)
 
virtual void _initParticleColour (Particle *particle)
 
virtual void _initParticleTextureCoords (Particle *particle)
 
Real _initParticleTimeToLive (void)
 
void _initParticleDimensions (Particle *particle)
 
void _initTimeBased (void)
 
const Vector3getDerivedPosition (void)
 
virtual void _notifyStop (void)
 
virtual void _notifyPause (void)
 
virtual void _notifyResume (void)
 
virtual void _notifyRescaled (const Vector3 &scale)
 
virtual void copyParentAttributesTo (ParticleEmitter *emitter)
 
const ColourValuegetParticleColour (void) const
 
void setParticleColour (const ColourValue &particleColour)
 
const ColourValuegetParticleColourRangeStart (void) const
 
void setParticleColourRangeStart (const ColourValue &particleColourRangeStart)
 
const ColourValuegetParticleColourRangeEnd (void) const
 
void setParticleColourRangeEnd (const ColourValue &particleColourRangeEnd)
 
const uint16getParticleTextureCoords (void) const
 
void setParticleTextureCoords (const uint16 &particleTextureCoords)
 
const uint16getParticleTextureCoordsRangeStart (void) const
 
void setParticleTextureCoordsRangeStart (const uint16 &particleTextureCoordsRangeStart)
 
const uint16getParticleTextureCoordsRangeEnd (void) const
 
void setParticleTextureCoordsRangeEnd (const uint16 &particleTextureCoordsRangeEnd)
 
bool isKeepLocal (void) const
 
void setKeepLocal (bool keepLocal)
 
bool makeParticleLocal (Particle *particle)
 
void pushEvent (ParticleUniverseEvent &particleUniverseEvent)
 
- Public Member Functions inherited from ParticleUniverse::Particle
 Particle (void)
 
virtual ~Particle (void)
 
bool _isMarkedForEmission (void) const
 
void _setMarkedForEmission (bool markedForEmission)
 
virtual bool isEnabled (void) const
 
void _setOriginalEnabled (bool originalEnabled)
 
bool _getOriginalEnabled (void) const
 
bool isFreezed (void) const
 
void setFreezed (bool freezed)
 
void setEventFlags (uint32 flags)
 
void addEventFlags (uint32 flags)
 
void removeEventFlags (uint32 flags)
 
uint32 getEventFlags (void) const
 
bool hasEventFlags (uint32 flags) const
 
void copyBehaviours (ParticleBehaviourList &behaviours)
 
virtual void _process (ParticleTechnique *technique, Real timeElapsed)
 
ParticleBehaviourgetBehaviour (const String &behaviourType)
 
Real calculateVelocity (void) const
 
virtual void copyAttributesTo (Particle *particle)
 
- Public Member Functions inherited from ParticleUniverse::IAlias
 IAlias (void)
 
virtual ~IAlias (void)
 
const StringgetAliasName (void) const
 
void setAliasName (String aliasName)
 
const AliasType getAliasType (void) const
 
void setAliasType (AliasType aliasType)
 
- Public Member Functions inherited from ParticleUniverse::IElement
 IElement (void)
 
virtual ~IElement (void)
 

Static Public Attributes

static const unsigned short DEFAULT_STEP
 
static const unsigned short DEFAULT_SEGMENTS
 
static const unsigned short DEFAULT_ITERATIONS
 
- Static Public Attributes inherited from ParticleUniverse::ParticleEmitter
static const bool DEFAULT_ENABLED
 
static const Vector3 DEFAULT_POSITION
 
static const bool DEFAULT_KEEP_LOCAL
 
static const Vector3 DEFAULT_DIRECTION
 
static const Quaternion DEFAULT_ORIENTATION
 
static const Quaternion DEFAULT_ORIENTATION_RANGE_START
 
static const Quaternion DEFAULT_ORIENTATION_RANGE_END
 
static const Particle::ParticleType DEFAULT_EMITS
 
static const uint16 DEFAULT_START_TEXTURE_COORDS
 
static const uint16 DEFAULT_END_TEXTURE_COORDS
 
static const uint16 DEFAULT_TEXTURE_COORDS
 
static const ColourValue DEFAULT_START_COLOUR_RANGE
 
static const ColourValue DEFAULT_END_COLOUR_RANGE
 
static const ColourValue DEFAULT_COLOUR
 
static const bool DEFAULT_AUTO_DIRECTION
 
static const bool DEFAULT_FORCE_EMISSION
 
static const Real DEFAULT_EMISSION_RATE
 
static const Real DEFAULT_TIME_TO_LIVE
 
static const Real DEFAULT_MASS
 
static const Real DEFAULT_VELOCITY
 
static const Real DEFAULT_DURATION
 
static const Real DEFAULT_REPEAT_DELAY
 
static const Real DEFAULT_ANGLE
 
static const Real DEFAULT_DIMENSIONS
 
static const Real DEFAULT_WIDTH
 
static const Real DEFAULT_HEIGHT
 
static const Real DEFAULT_DEPTH
 
- Static Public Attributes inherited from ParticleUniverse::Particle
static Real DEFAULT_TTL
 
static Real DEFAULT_MASS
 

Protected Member Functions

virtual void _preProcessParticles (ParticleTechnique *technique, Real timeElapsed)
 
void _setDefaults (void)
 
void _loadMesh (void)
 
void _generatePoints (void)
 
void _generatePointsFromMesh (void)
 
void _generatePointsFromSubMesh (void)
 
void _fillVertexBuffer (void)
 
void _generatePointsFromVertexBuffer (void)
 
void _generatePoints (const Vector3 &startVector, const Vector3 &endVector, Real lengthIncrement=0.0f)
 
- Protected Member Functions inherited from ParticleUniverse::ParticleEmitter
void _pushEmitterEvent (EventType eventType)
 

Protected Attributes

list< Vector3mSpawnPositionList
 
const Ogre::VertexElementmPositionElement
 
Ogre::VertexDatamVertexData
 
Ogre::HardwareVertexBufferSharedPtr mBuffer
 
unsigned char * mVertexBuffer
 
Ogre::MeshmMesh
 
Ogre::SubMeshmSubMesh
 
bool mMeshProcessed
 
size_t mVertexSize
 
size_t mMaxVertexCount
 
size_t mVertexCount
 
unsigned short mSubMeshNumber
 
bool mAllVerticesProcessed
 
unsigned short mStep
 
unsigned short mSegments
 
unsigned short mIterations
 
String mMeshName
 
- Protected Attributes inherited from ParticleUniverse::ParticleEmitter
ParticleTechniquemParentTechnique
 
Vector3 _mEmitterScale
 
String mEmitterType
 
String mName
 
Vector3 mParticleDirection
 
Vector3 mOriginalParticleDirection
 
Quaternion mParticleOrientation
 
Quaternion mParticleOrientationRangeStart
 
Quaternion mParticleOrientationRangeEnd
 
bool mParticleOrientationRangeSet
 
DynamicAttributemDynAngle
 
DynamicAttributemDynEmissionRate
 
ParticleType mEmitsType
 
String mEmitsName
 
DynamicAttributemDynTotalTimeToLive
 
DynamicAttributemDynParticleMass
 
DynamicAttributemDynVelocity
 
DynamicAttributemDynDuration
 
DynamicAttributemDynRepeatDelay
 
DynamicAttributemDynParticleAllDimensions
 
bool mDynParticleAllDimensionsSet
 
DynamicAttributemDynParticleWidth
 
bool mDynParticleWidthSet
 
DynamicAttributemDynParticleHeight
 
bool mDynParticleHeightSet
 
DynamicAttributemDynParticleDepth
 
bool mDynParticleDepthSet
 
Vector3 mUpVector
 
Real mRemainder
 
DynamicAttributeFactory mDynamicAttributeFactory
 
DynamicAttributeHelper mDynamicAttributeHelper
 
Real mDurationRemain
 
bool mDynDurationSet
 
Real mRepeatDelayRemain
 
bool mDynRepeatDelaySet
 
CameraDependencymEmissionRateCameraDependency
 
CameraDependencyFactory mCameraDependencyFactory
 
bool mAutoDirection
 
bool mForceEmission
 
bool mOriginalForceEmission
 
bool mForceEmissionExecuted
 
bool mOriginalForceEmissionExecuted
 
ColourValue mParticleColour
 
ColourValue mParticleColourRangeStart
 
ColourValue mParticleColourRangeEnd
 
bool mParticleColourRangeSet
 
bool mKeepLocal
 
uint16 mParticleTextureCoords
 
uint16 mParticleTextureCoordsRangeStart
 
uint16 mParticleTextureCoordsRangeEnd
 
bool mParticleTextureCoordsRangeSet
 
- Protected Attributes inherited from ParticleUniverse::Particle
uint32 mEventFlags
 
bool mMarkedForEmission
 
bool mEnabled
 
bool mFreezed
 
bool mOriginalEnabled
 
bool mOriginalEnabledSet
 
Vector3 mDerivedPosition
 
ParticleBehaviourList mBehaviours
 
- Protected Attributes inherited from ParticleUniverse::IAlias
String mAliasName
 
AliasType mAliasType
 

Additional Inherited Members

- Public Types inherited from ParticleUniverse::Particle
enum  ParticleType {
  PT_VISUAL, PT_TECHNIQUE, PT_EMITTER, PT_AFFECTOR,
  PT_SYSTEM
}
 
enum  ReservedParticleEventFlags { PEF_EXPIRED = 1<<0, PEF_EMITTED = 1<<1, PEF_COLLIDED = 1<<2 }
 
typedef vector< ParticleBehaviour * > ParticleBehaviourList
 
typedef ParticleBehaviourList::const_iterator ParticleBehaviourIterator
 
- Public Types inherited from ParticleUniverse::IAlias
enum  AliasType {
  AT_UNDEFINED, AT_TECHNIQUE, AT_RENDERER, AT_EMITTER,
  AT_AFFECTOR, AT_OBSERVER, AT_EXTERN, AT_HANDLER,
  AT_BEHAVIOUR
}
 
- Public Attributes inherited from ParticleUniverse::Particle
ParticleEmitterparentEmitter
 
Vector3 position
 
Vector3 direction
 
Real mass
 
Real timeToLive
 
Real totalTimeToLive
 
Real timeFraction
 
ParticleType particleType
 
Any mUserDefinedObject
 
PhysicsActorphysicsActor
 
IVisualDatavisualData
 
Vector3 originalPosition
 
Vector3 originalDirection
 
Real originalVelocity
 
Real originalDirectionLength
 
Real originalScaledDirectionLength
 
Vector3 latestPosition
 

Detailed Description

The VertexEmitter gradually generates spawn points, based on the edges of a mesh. This means that in every ParticleTechnique-update, a few points are generated, until all vertices of the mesh have been processed.

Remarks
Beware, there is no intermediate validation whether the mesh still exist (performance reasons), so destroying the mesh before all vertices are processed will result in an exception.

Todo:

  • Add normals to the mSpawnPositionList

Constructor & Destructor Documentation

ParticleUniverse::VertexEmitter::VertexEmitter ( void  )
virtual ParticleUniverse::VertexEmitter::~VertexEmitter ( void  )
inlinevirtual

Member Function Documentation

unsigned short ParticleUniverse::VertexEmitter::_calculateRequestedParticles ( Real  timeElapsed)
virtual

Calculate the number of particles that the emitter wants to emit.

Reimplemented from ParticleUniverse::ParticleEmitter.

void ParticleUniverse::VertexEmitter::_fillVertexBuffer ( void  )
protected
void ParticleUniverse::VertexEmitter::_generatePoints ( void  )
protected

Generate spawn points from a mesh. The points will not be generated all at once, but gradually. In each call, the points on an edge are generated, until all vertices have been processed. In that case, mAllVerticesProcessed is set to true and this function stops further processing.

void ParticleUniverse::VertexEmitter::_generatePoints ( const Vector3 startVector,
const Vector3 endVector,
Real  lengthIncrement = 0.0f 
)
protected
void ParticleUniverse::VertexEmitter::_generatePointsFromMesh ( void  )
protected
void ParticleUniverse::VertexEmitter::_generatePointsFromSubMesh ( void  )
protected
void ParticleUniverse::VertexEmitter::_generatePointsFromVertexBuffer ( void  )
protected
virtual void ParticleUniverse::VertexEmitter::_initParticlePosition ( Particle particle)
virtual

Todo

Reimplemented from ParticleUniverse::ParticleEmitter.

void ParticleUniverse::VertexEmitter::_loadMesh ( void  )
protected
virtual void ParticleUniverse::VertexEmitter::_notifyStart ( void  )
virtual

Perform activities when a ParticleEmitter is started.

Reimplemented from ParticleUniverse::ParticleEmitter.

virtual void ParticleUniverse::VertexEmitter::_preProcessParticles ( ParticleTechnique technique,
Real  timeElapsed 
)
protectedvirtual

The _preProcessParticles() function is used to generate some spawn points in every update.

Reimplemented from ParticleUniverse::ParticleEmitter.

void ParticleUniverse::VertexEmitter::_setDefaults ( void  )
protected
virtual void ParticleUniverse::VertexEmitter::copyAttributesTo ( ParticleEmitter emitter)
virtual

Copy attributes to another emitter.

Reimplemented from ParticleUniverse::ParticleEmitter.

unsigned short ParticleUniverse::VertexEmitter::getIterations ( void  ) const
const String& ParticleUniverse::VertexEmitter::getMeshName ( void  ) const
unsigned short ParticleUniverse::VertexEmitter::getSegments ( void  ) const
unsigned short ParticleUniverse::VertexEmitter::getStep ( void  ) const
void ParticleUniverse::VertexEmitter::setIterations ( unsigned short  iterations)
void ParticleUniverse::VertexEmitter::setMeshName ( const String meshName)
void ParticleUniverse::VertexEmitter::setSegments ( unsigned short  segments)
void ParticleUniverse::VertexEmitter::setStep ( unsigned short  step)

Member Data Documentation

const unsigned short ParticleUniverse::VertexEmitter::DEFAULT_ITERATIONS
static
const unsigned short ParticleUniverse::VertexEmitter::DEFAULT_SEGMENTS
static
const unsigned short ParticleUniverse::VertexEmitter::DEFAULT_STEP
static
bool ParticleUniverse::VertexEmitter::mAllVerticesProcessed
protected
Ogre::HardwareVertexBufferSharedPtr ParticleUniverse::VertexEmitter::mBuffer
protected
unsigned short ParticleUniverse::VertexEmitter::mIterations
protected

Defines the speed of generating spawnpoints. In each Particle Technique update 'mIterations' vertices are traversed.

Remarks
Setting this attribute to a higher value is needed if the emssion rate of the emitter is high. On slower computers, emitting the particles may exceed generating the spawnpoints (because this is not done at once, but per Particle Tehcnique update).
size_t ParticleUniverse::VertexEmitter::mMaxVertexCount
protected
Ogre::Mesh* ParticleUniverse::VertexEmitter::mMesh
protected
String ParticleUniverse::VertexEmitter::mMeshName
protected

Determines the name of the mesh of which the vertices are used.

bool ParticleUniverse::VertexEmitter::mMeshProcessed
protected
const Ogre::VertexElement* ParticleUniverse::VertexEmitter::mPositionElement
protected
unsigned short ParticleUniverse::VertexEmitter::mSegments
protected

Determines in how many segments an edge is divided. This results in spawn points.

list<Vector3> ParticleUniverse::VertexEmitter::mSpawnPositionList
protected
unsigned short ParticleUniverse::VertexEmitter::mStep
protected

Determines the size of the steps that are used to traverse through the vertices.

Ogre::SubMesh* ParticleUniverse::VertexEmitter::mSubMesh
protected
unsigned short ParticleUniverse::VertexEmitter::mSubMeshNumber
protected
unsigned char* ParticleUniverse::VertexEmitter::mVertexBuffer
protected
size_t ParticleUniverse::VertexEmitter::mVertexCount
protected
Ogre::VertexData* ParticleUniverse::VertexEmitter::mVertexData
protected
size_t ParticleUniverse::VertexEmitter::mVertexSize
protected

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