/*
	ZParticleEffect.h
	Author: James Russell <jcrussell@762studios.com>

	Purpose: A particle effect class which maintains a set of particle emitters.

	Changelog
	2011/08/28 - creation (jcrussell)
*/

#pragma once

#ifndef _ZPARTICLEEFFECT_H
#define _ZPARTICLEEFFECT_H

#include <ZRenderer/ZRenderer.hpp>
#include <ZRendererUtil/ZParticleEmitter.h>

class ZParticleEffect
{
private:
	//The name of this particle effect
	ZString Name;

	//Boolean indicating this particle effect has completed
	bool bIsFinished;

	//The emitters attached to this particle effect
	ZArray< ZSmartPointer<ZParticleEmitter> > Emitters;

public:
	/*
	Default Constructor.
	*/
	ZParticleEffect();

	/*
	Parameterized Constructor.

	@param _name - the name of this particle effect
	*/
	ZParticleEffect(const ZString& _name);

	/*
	Destructor.
	*/
	~ZParticleEffect();

	/*
	public ZParticleEffect::AddEmitter
	
	Adds an emitter to this particle effect.  The emitter will be updated and rendered when the 
	effect is.
	
	@param _emitter - the emitter to add
	@return (void)
	@context (all)
	*/
	void AddEmitter(ZPtr<ZParticleEmitter> _emitter);

	/*
	public ZParticleEffect::GetName
	
	Gets the name of this particle effect.
	
	@return (ZString) - the name of this effect
	@context (all)
	*/
	ZString GetName();

	/*
	public ZParticleEffect::IsFinished
	
	Returns true if this particle effect is finished.
	
	@return (bool) - true if completed, false otherwise
	@context (all)
	*/
	bool IsFinished();

	/*
	public ZParticleEffect::RemoveEmitter
	
	Removes an emitter from this particle effect.
	
	@param _emitter - the particle effect
	@return (bool) - true if the emitter was contained, false otherwise
	@context (all)
	*/
	bool RemoveEmitter(ZPtr<ZParticleEmitter> _emitter);

	/*
	public ZParticleEffect::Render
	
	Renders this particle effect using the provided renderer.
	
	@param _renderer - the renderer to use
	@param _frameContext - the frame context to render with
	@param _drawGroup - the draw group to render in
	@return (void)
	@context (all)
	*/
	void Render(ZRenderer* _renderer, ZFrameContext _frameContext, int _drawGroup = 0);

	/*
	public ZParticleEffect::SetFinished
	
	Sets completion status of this effect to the provided value.
	
	@param _status - completion status (true if finished, false otherwise)
	@return (void)
	@context (all)
	*/
	void SetFinished(bool _status);

	/*
	public ZParticleEffect::SetName
	
	Sets the name of this particle effect.
	
	@param _name - the name of this particle effect
	@return (void)
	@context (all)
	*/
	void SetName(const ZString& _name);

	/*
	public ZParticleEffect::Update
	
	Updates this particle effect with the provided delta time since last call to update.
	
	@param _dt - the time (in milliseconds) since the last call to Update
	@return (void)
	@context (all)
	*/
	void Update(size_t _dt);
};

#endif
 