#region CPL License
/*
Nuclex Framework
Copyright (C) 2002-2009 Nuclex Development Labs
This library is free software; you can redistribute it and/or
modify it under the terms of the IBM Common Public License as
published by the IBM Corporation; either version 1.0 of the
License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
IBM Common Public License for more details.
You should have received a copy of the IBM Common Public
License along with this library
*/
#endregion
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Nuclex.Graphics.Batching;
using Nuclex.Support;
namespace Nuclex.Graphics.SpecialEffects.Particles.HighLevel {
/// Manages multiple particles systems and renders them
///
///
/// The particle system manager allows you to offload pruning, updating and
/// rendering of your particle systems to a central place. You still have to
/// keep a reference to your particle systems to add particles or modify
/// affectors, but you no longer have to worry about manually updating,
/// pruning and drawing them yourself.
///
///
/// As an added benefit, multiple particle systems using the same vertex type
/// will be rendered in combined batches, allowing for efficient rendering
/// even when your particle systems are only sparsely populated.
///
///
/// The recommended usage is to create a particle system management service
/// for your game where particle systems can be registered to this component
/// (if you want to construct and destroy particle systems on the fly).
/// Another option would be to let the service provide a fixed set of
/// particle systems via properties so that particles can easily be added to
/// them from your game entities, depending on your design approach.
///
///
public partial class ParticleSystemManager : Drawable, IParticleSystemService {
/// Initializes a new particle system manager
///
/// Graphics device service being used to render the particle systems
///
public ParticleSystemManager(IGraphicsDeviceService graphicsDeviceService) :
base(graphicsDeviceService) {
this.particleSystems = new Dictionary