OGRE-Next  4.0.0unstable
Object-Oriented Graphics Rendering Engine
Ogre::ParticleSystemManager2 Class Reference

#include <OgreParticleSystemManager2.h>

Public Member Functions

 ParticleSystemManager2 (SceneManager *ogre_nullable sceneManager, ParticleSystemManager2 *ogre_nullable master)
 
 ~ParticleSystemManager2 ()
 
void _addParticleSystemDefAsActive (ParticleSystemDef *def)
 
void _addToRenderQueue (size_t threadIdx, size_t numThreads, RenderQueue *renderQueue, uint8 renderQueueId, uint32 visibilityMask, bool includeNonCasters) const
 Instructs us to add all the ParticleSystemDef to the RenderQueue that match the given renderQueueId and pass the visibilityMask. More...
 
IndexBufferPacked_getSharedIndexBuffer (size_t maxQuota, VaoManager *vaoManager)
 
void _prepareParallel ()
 See prepareForUpdate() This function is called from multiple threads. More...
 
void _removeParticleSystemDefFromActive (ParticleSystemDef *def)
 
void _updateParallel (size_t threadIdx, size_t numThreads)
 See prepareForUpdate() This function is called from multiple threads. More...
 
BillboardSetcreateBillboardSet ()
 Creates a BillboardSet. More...
 
ParticleSystemDefcreateParticleSystemDef (const String &name)
 
void destroyAllBillboardSets ()
 Destroys all BillboardSet created with createBillboardSet(). More...
 
void destroyAllParticleSystems ()
 
void destroyBillboardSet (BillboardSet *billboardSet)
 Destroys a BillboardSet created with createBillboardSet(). More...
 
const Vector3getCameraPosition () const
 
uint32 getHighestPossibleQuota16 () const
 
uint32 getHighestPossibleQuota32 () const
 
ParticleSystemDefgetParticleSystemDef (const String &name, bool bAutoInit=true)
 Retrieves an existing ParticleSystemDef with the given name Throws if not found. More...
 
bool hasParticleSystemDef (const String &name, bool bSearchInRoot=true) const
 Returns true if this ParticleSystemManager2 has a ParticleSystemDef by that name. More...
 
void prepareForUpdate (Real timeSinceLast)
 The order of function calls is: More...
 
void setCameraPosition (const Vector3 &camPos)
 All instances are sorted every frame to their distance to camera. More...
 
void setHighestPossibleQuota (uint16 highestQuota16, uint32 highestQuota32)
 ParticleSystemManager2 must know the highest possible quota any of its particle systems may achieve. More...
 
void update ()
 See prepareForUpdate() More...
 

Static Public Member Functions

static void addAffectorFactory (ParticleAffectorFactory2 *factory)
 
static void addEmitterFactory (ParticleEmitterDefDataFactory *factory)
 
static ParticleAffectorFactory2getAffectorFactory (IdString name)
 
static ParticleEmitterDefDataFactorygetFactory (IdString name)
 
static void removeAffectorFactory (ParticleAffectorFactory2 *factory)
 
static void removeEmitterFactory (ParticleEmitterDefDataFactory *factory)
 

Constructor & Destructor Documentation

◆ ParticleSystemManager2()

Ogre::ParticleSystemManager2::ParticleSystemManager2 ( SceneManager *ogre_nullable  sceneManager,
ParticleSystemManager2 *ogre_nullable  master 
)

◆ ~ParticleSystemManager2()

Ogre::ParticleSystemManager2::~ParticleSystemManager2 ( )

Member Function Documentation

◆ _addParticleSystemDefAsActive()

void Ogre::ParticleSystemManager2::_addParticleSystemDefAsActive ( ParticleSystemDef def)

◆ _addToRenderQueue()

void Ogre::ParticleSystemManager2::_addToRenderQueue ( size_t  threadIdx,
size_t  numThreads,
RenderQueue renderQueue,
uint8  renderQueueId,
uint32  visibilityMask,
bool  includeNonCasters 
) const

Instructs us to add all the ParticleSystemDef to the RenderQueue that match the given renderQueueId and pass the visibilityMask.

Parameters
threadIdx
numThreads
renderQueue
renderQueueId
visibilityMask
includeNonCasters

◆ _getSharedIndexBuffer()

IndexBufferPacked* Ogre::ParticleSystemManager2::_getSharedIndexBuffer ( size_t  maxQuota,
VaoManager vaoManager 
)

◆ _prepareParallel()

void Ogre::ParticleSystemManager2::_prepareParallel ( )

See prepareForUpdate() This function is called from multiple threads.

Each thread handles a whole ParticleSystemDef. (i.e. 2 threads won't concurrently access the same ParticleSystemDef).

It handles sorting them by distance to camera; and emits new particles that instances require.

◆ _removeParticleSystemDefFromActive()

void Ogre::ParticleSystemManager2::_removeParticleSystemDefFromActive ( ParticleSystemDef def)

◆ _updateParallel()

void Ogre::ParticleSystemManager2::_updateParallel ( size_t  threadIdx,
size_t  numThreads 
)

See prepareForUpdate() This function is called from multiple threads.

Remarks
Unlike _prepareParallel(), each thread concurrently access the same ParticleSystemDef. This function is in charge of advancing the simulation of each particle forward. Each thread handles one particle (i.e. 2 threads won't concurrently access the same ParticleCpuData).

◆ addAffectorFactory()

static void Ogre::ParticleSystemManager2::addAffectorFactory ( ParticleAffectorFactory2 factory)
static

◆ addEmitterFactory()

static void Ogre::ParticleSystemManager2::addEmitterFactory ( ParticleEmitterDefDataFactory factory)
static

◆ createBillboardSet()

BillboardSet* Ogre::ParticleSystemManager2::createBillboardSet ( )

Creates a BillboardSet.

Returns
Pointer to newly created BillboardSet.

◆ createParticleSystemDef()

ParticleSystemDef* Ogre::ParticleSystemManager2::createParticleSystemDef ( const String name)

◆ destroyAllBillboardSets()

void Ogre::ParticleSystemManager2::destroyAllBillboardSets ( )

Destroys all BillboardSet created with createBillboardSet().

Do not hold any more references to those pointers as they will become dangling!

◆ destroyAllParticleSystems()

void Ogre::ParticleSystemManager2::destroyAllParticleSystems ( )

◆ destroyBillboardSet()

void Ogre::ParticleSystemManager2::destroyBillboardSet ( BillboardSet billboardSet)

Destroys a BillboardSet created with createBillboardSet().

Parameters
billboardSetSet to destroy.

◆ getAffectorFactory()

static ParticleAffectorFactory2* Ogre::ParticleSystemManager2::getAffectorFactory ( IdString  name)
static

◆ getCameraPosition()

const Vector3& Ogre::ParticleSystemManager2::getCameraPosition ( ) const
inline

◆ getFactory()

static ParticleEmitterDefDataFactory* Ogre::ParticleSystemManager2::getFactory ( IdString  name)
static

◆ getHighestPossibleQuota16()

uint32 Ogre::ParticleSystemManager2::getHighestPossibleQuota16 ( ) const
inline

◆ getHighestPossibleQuota32()

uint32 Ogre::ParticleSystemManager2::getHighestPossibleQuota32 ( ) const
inline

◆ getParticleSystemDef()

ParticleSystemDef* Ogre::ParticleSystemManager2::getParticleSystemDef ( const String name,
bool  bAutoInit = true 
)

Retrieves an existing ParticleSystemDef with the given name Throws if not found.

Remarks
If we 'this' belongs to a SceneManager and a ParticleSystemDef hasn't been cloned yet, we will look into Root's ParticleSystemManager2 to see if they have a master definition.

We only throw if Root's version doesn't have a definition by that name either.

Parameters
nameName of the ParticleSystemDef.
bAutoInitWhen true, we always call ParticleSystemDef::init after cloning. When false, we don't (useful if you want to customize).
Returns
The ParticleSystemDef.

◆ hasParticleSystemDef()

bool Ogre::ParticleSystemManager2::hasParticleSystemDef ( const String name,
bool  bSearchInRoot = true 
) const

Returns true if this ParticleSystemManager2 has a ParticleSystemDef by that name.

Parameters
nameName of the ParticleSystemDef.
bSearchInRootWhen true, we also search in Root's ParticleSystemManager2 to see if they have a master definition.
Returns
True if found. False if not found.

◆ prepareForUpdate()

void Ogre::ParticleSystemManager2::prepareForUpdate ( Real  timeSinceLast)

The order of function calls is:

  1. manager->prepareForUpdate( timeSinceLast ) (main thread)
  2. manager->_prepareParallel() (from many threads)
  3. manager->update() (main thread)
    • This function will call _updateParallel from all threads.

Prepares everything for caller to later call _prepareParallel() from all threads. This function must be called from main thread.

Parameters
timeSinceLastTime in seconds since last frame (to advance the particle simulation).

◆ removeAffectorFactory()

static void Ogre::ParticleSystemManager2::removeAffectorFactory ( ParticleAffectorFactory2 factory)
static

◆ removeEmitterFactory()

static void Ogre::ParticleSystemManager2::removeEmitterFactory ( ParticleEmitterDefDataFactory factory)
static

◆ setCameraPosition()

void Ogre::ParticleSystemManager2::setCameraPosition ( const Vector3 camPos)
inline

All instances are sorted every frame to their distance to camera.

Closer instances are given higher priority to emit. If instances reach the shared Quota (see ParticleSystemDef::setParticleQuota) then eventually over time far instances will run out of particles as they can no longer emit more, while close instances will still be emitting as much as possible.

Remarks
Only one camera position per SceneManager is supported. If rendering from multiple camera positions, consider using the most relevant position for the simulation.

This value does not control rendering. It's not instantaneous. It merely tells the simulation which systems should be prioritized for emission for this frame.

Parameters
camPosCamera position

◆ setHighestPossibleQuota()

void Ogre::ParticleSystemManager2::setHighestPossibleQuota ( uint16  highestQuota16,
uint32  highestQuota32 
)

ParticleSystemManager2 must know the highest possible quota any of its particle systems may achieve.

After the index buffer has been initialized, this value cannot be changed.

After initialization you can create new ParticleSystemDef that set quotas lower than the already highest possible one. However you cannot set a quota larger than that.

Make sure to call this function with the highest values you anticipate your particle systems will need.

Note this value directly correlates to VRAM used. The amount of bytes consumed are : highestQuota32 * 6 * 4 bytes + highestQuota16 * 6 * 2

Parameters
highestQuota16The highest possible quota for ParticleSystemDefs that need less than 65536 particles. If unsure, you can set it to 65536.

This value can be 0, however we may raise it if we find a ParticleSystemDef that needs it.

Parameters
highestQuota32The highest possible quota for ParticleSystemDefs that need more than 65535 particles. This value can be 0, however we may raise it if we find a ParticleSystemDef that needs it.

◆ update()

void Ogre::ParticleSystemManager2::update ( )

See prepareForUpdate()

Must be called after prepareForUpdate() & _prepareParallel(). This function must be called from main thread.


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