Skip to content

Commit

Permalink
BillboadSets can now be created via SceneManager
Browse files Browse the repository at this point in the history
It's about consistency with the rest of the API.
  • Loading branch information
darksylinc committed Jul 20, 2024
1 parent b71b384 commit d356853
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 3 deletions.
31 changes: 30 additions & 1 deletion OgreMain/include/OgreSceneManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -1649,7 +1649,7 @@ namespace Ogre
ParticleSystemDef *createParticleSystemDef( const String &name );

/** Creates an instance the next generation of ParticleFX.
This instanec must be based off a ParticleSystemDef already setup.
This instance must be based off a ParticleSystemDef already setup.
See createParticleSystemDef().
@param systemDef
Expand All @@ -1665,8 +1665,37 @@ namespace Ogre

void destroyParticleSystem2( ParticleSystem2 *obj );

/// Destroys all particle systems created with createParticleSystem2.
/// Do not hold any more references to those pointers as they will become dangling!
void destroyAllParticleSystems2();

/** Creates an instance of the new generation of billboards.
See ParticleSystemManager2::createBillboardSet.
@remark
This is the same as doing:
sceneMgr->getParticleSystemManager2()->createBillboardSet();
*/
BillboardSet *createBillboardSet2();

/** Destroys a BillboardSet created with createBillboardSet2().
See ParticleSystemManager2::destroyBillboardSet.
@remark
This is the same as doing:
sceneMgr->getParticleSystemManager2()->destroyBillboardSet( s );
@param billboardSet
Set to destroy.
*/
void destroyBillboardSet2( BillboardSet *billboardSet );

/** Destroys all BillboardSet created with createBillboardSet2().
Do not hold any more references to those pointers as they will become dangling!
See ParticleSystemManager2::destroyAllBillboardSets.
@remark
This is the same as doing:
sceneMgr->getParticleSystemManager2()->destroyAllBillboardSets();
*/
void destroyAllBillboardSets2();

ParticleSystemManager2 *getParticleSystemManager2() { return mParticleSystemManager2; }

/** Empties the entire scene, inluding all SceneNodes, Entities, Lights,
Expand Down
15 changes: 15 additions & 0 deletions OgreMain/src/OgreSceneManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,21 @@ namespace Ogre
mParticleSystemManager2->destroyAllParticleSystems();
}
//-----------------------------------------------------------------------
BillboardSet *SceneManager::createBillboardSet2()
{
return mParticleSystemManager2->createBillboardSet();
}
//-----------------------------------------------------------------------
void SceneManager::destroyBillboardSet2( BillboardSet *billboardSet )
{
return mParticleSystemManager2->destroyBillboardSet( billboardSet );
}
//-----------------------------------------------------------------------
void SceneManager::destroyAllBillboardSets2()
{
return mParticleSystemManager2->destroyAllBillboardSets();
}
//-----------------------------------------------------------------------
void SceneManager::clearScene( bool deleteIndestructibleToo, bool reattachCameras )
{
destroyAllMovableObjects();
Expand Down
5 changes: 3 additions & 2 deletions Samples/2.0/ApiUsage/ParticleFX2/ParticleFX2GameState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ void ParticleFX2GameState::createScene01()
Ogre::ParticleSystem2 *pSystem1 = sceneManager->createParticleSystem2( "Examples/Aureola" );
Ogre::ParticleSystem2 *pSystem2 = sceneManager->createParticleSystem2( "Particle/SmokePBS" );

Ogre::BillboardSet *billboardSet = sceneManager->getParticleSystemManager2()->createBillboardSet();
billboardSet->setParticleQuota( 10u );
Ogre::BillboardSet *billboardSet = sceneManager->createBillboardSet2();
// Try to be as tight as possible. In this sample we only need 1.
billboardSet->setParticleQuota( 1u );
billboardSet->setMaterialName( "Marble",
Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME );
billboardSet->init( sceneManager->getDestinationRenderSystem()->getVaoManager() );
Expand Down

0 comments on commit d356853

Please sign in to comment.