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

	Purpose: TODO

	Changelog
	2011/09/11 - creation (jcrussell)
*/

#pragma once

#ifndef _ZSTANDARDPARTICLESPAWNSTRATEGY_H
#define _ZSTANDARDPARTICLESPAWNSTRATEGY_H

#define ZSP_DEFAULT_SPAWN_MASS			(1)

#define ZSP_DEFAULT_SPAWN_ENERGY		(1000)

#define ZSP_DEFAULT_SPAWN_VELOCITY_X	(0.0f)
#define ZSP_DEFAULT_SPAWN_VELOCITY_Y	(0.0f)
#define ZSP_DEFAULT_SPAWN_VELOCITY_Z	(0.0f)

#define ZSP_DEFAULT_SPAWN_FACING_X		(0.0f)
#define ZSP_DEFAULT_SPAWN_FACING_Y		(0.0f)
#define ZSP_DEFAULT_SPAWN_FACING_Z		(1.0f)

#define ZSP_DEFAULT_SPAWN_SCALE_X		(1.0f)
#define ZSP_DEFAULT_SPAWN_SCALE_Y		(1.0f)

#define ZSP_DEFAULT_SPAWN_COLOR_R		(1.0f)
#define ZSP_DEFAULT_SPAWN_COLOR_G		(1.0f)
#define ZSP_DEFAULT_SPAWN_COLOR_B		(1.0f)
#define ZSP_DEFAULT_SPAWN_COLOR_A		(1.0f)

#define ZSP_DEFAULT_TEXTURE_U			(0.0f)
#define ZSP_DEFAULT_TEXTURE_V			(0.0f)
#define ZSP_DEFAULT_TEXTURE_OFFSET		(1.0f)

#define ZSP_DEFAULT_SPAWN_INTERVAL		(100)
#define ZSP_DEFAULT_SPAWN_ANGLE			(0.0f)
#define ZSP_DEFAULT_SPAWN_COUNT_MIN		(0)
#define ZSP_DEFAULT_SPAWN_COUNT_MAX		(1)

#include <ZRendererUtil/ZStandardParticleStorageAllocator.h>
#include <ZRendererUtil/ZParticleSpawnStrategy.h>

class ZStandardParticleSpawnStrategy : public ZParticleSpawnStrategy
{
private:
	//The time until our next spawn
	int NextSpawn;

	//Our current spawn group
	size_t CurrentSpawnGroup;

protected:
	//Template for the particle we will be spawning with
	ZStandardParticle TemplateParticle;

	//The span between particle spawns
	size_t SpawnInterval;

	//The half-angle we deviate within when spawning a particle [0.0 - pi]
	float SpawnAngle;

	//The particle count spawn range (lower, upper)
	ZPair<size_t, size_t> SpawnCountRange;

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

	/*
	Destructor.
	*/
	virtual ~ZStandardParticleSpawnStrategy();

	//Subclass Override
	virtual bool CheckParticleFormat( const ZString& _format );

	//Subclass Override
	virtual void UpdateSpawn(ZParticleEffect* _particleEffect, 
							 ZParticleEmitter* _particleEmitter, 
							 ZParticleStorageAllocator* _storageAllocator, 
							 size_t _dt );

	/*
	public ZStandardParticleSpawnStrategy::GetSpawnAngle
	
	TODO
	
	@return (float)
	@context (all)
	*/
	float GetSpawnAngle();

	/*
	public ZStandardParticleSpawnStrategy::GetSpawnColor
	
	TODO
	
	@return (const ZVector4f&)
	@context (all)
	*/
	const ZVector4f& GetSpawnColor();

	/*
	public ZStandardParticleSpawnStrategy::GetSpawnEnergy
	
	TODO
	
	@return (size_t)
	@context (all)
	*/
	size_t GetSpawnEnergy();

	/*
	public ZStandardParticleSpawnStrategy::GetSpawnInterval
	
	TODO
	
	@return (size_t)
	@context (all)
	*/
	size_t GetSpawnInterval();

	/*
	public ZStandardParticleSpawnStrategy::GetSpawnScale
	
	TODO
	
	@return (const ZVector2f&)
	@context (all)
	*/
	const ZVector2f& GetSpawnScale();

	/*
	public ZStandardParticleSpawnStrategy::GetSpawnVelocity
	
	TODO
	
	@return (const ZVector3f&)
	@context (all)
	*/
	const ZVector3f& GetSpawnVelocity();

	/*
	public ZStandardParticleSpawnStrategy::SetSpawnAngle
	
	TODO
	
	@param _angle - 
	@return (void)
	@context (all)
	*/
	void SetSpawnAngle(float _angle);

	/*
	public ZStandardParticleSpawnStrategy::SetSpawnColor
	
	TODO
	
	@param _color - 
	@return (void)
	@context (all)
	*/
	void SetSpawnColor(const ZVector4f& _color);

	/*
	public ZStandardParticleSpawnStrategy::SetSpawnEnergy
	
	TODO
	
	@param _energy - 
	@return (void)
	@context (all)
	*/
	void SetSpawnEnergy(size_t _energy);

	/*
	public ZStandardParticleSpawnStrategy::SetSpawnInterval
	
	TODO
	
	@param _interval - 
	@return (void)
	@context (all)
	*/
	void SetSpawnInterval(size_t _interval);

	/*
	public ZStandardParticleSpawnStrategy::SetSpawnScale
	
	TODO
	
	@param _scale - 
	@return (void)
	@context (all)
	*/
	void SetSpawnScale(const ZVector2f& _scale);

	/*
	public ZStandardParticleSpawnStrategy::SetDirection
	
	TODO
	
	@param _direction - 
	@return (void)
	@context (all)
	*/
	void SetSpawnVelocity(const ZVector3f& _velocity);
};

#endif
 
