/*
	Trig Wars.
	Copyright (c) 2008, Darragh Coy.
	All rights reserved.
	Original work(s), source code & author(s) details available at: http://www.darraghcoy.com

	Redistribution and use in source and binary forms, with or without modification, are permitted 
	provided that the following conditions are met:

		* 	Redistributions of source code must retain the above copyright notice, this list of 
			conditions and the following disclaimer.
		* 	Redistributions in binary form must reproduce the above copyright notice, this list of 
			conditions and the following disclaimer in the documentation.
		* 	Neither the name of the author nor the names of contributors may be used to endorse or 
			promote products derived from this software without specific prior written permission.
		* 	The use of any third party libraries, modules or data files provided with the source 
			form of the program must follow and respect the individual licensing terms of these 
			components. You do not have permission to modify or circumvent the licensing terms for 
			provided third party components unless the third party licenses specifically allow this. 
			If you do not agree to the terms of provided third party components then you do not have 
			permission to use them in your derived work(s).
		* 	The terms of this license do not apply to separate (but related) distributions if supplied 
			by the author(s), only to the contents of this source distribution, derived works, and the 
			binaries produced by either modified or unmodified versions of the source code. The terms 
			of this license do not also apply to any third party libraries or components provided with 
			the source distribution. Such third party elements are licensed under their own separate 
			agreements.

	THIS SOFTWARE IS PROVIDED BY DARRAGH COY ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 
	BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
	ARE DISCLAIMED. IN NO EVENT SHALL DARRAGH COY BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
	EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 
	OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
	OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
	IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef PARTICLE_EMITTER_BURST_H
#define PARTICLE_EMITTER_BURST_H

//=====================================================================================================================
//=====================================================================================================================

#include "Graphics\Texture.h"

//=====================================================================================================================
//=====================================================================================================================

namespace Game
{
    //=================================================================================================================
    /// @brief		Represents a burst of particles in a particle emitter. This class simply holds the data for 
	///				a burst and nothing more.
    //=================================================================================================================

    struct ParticleEmitterBurst : public Poolable
    {       
        //=============================================================================================================
        // Variables
        //=============================================================================================================

            /// The number of particles in the burst.

            unsigned m_num_particles;

            /// Texture used for the particle burst.

            Texture m_texture;

            /// A seed to make the particle distribution different from other bursts.
            
            float m_random_seed;

            /// Position of the burst in the world.

            Vec3f m_position;

            /// How long this burst of particles has been alive for.

            float m_time_alive;

            /// Random live time for the particles - number 1

            float m_live_time1;

            /// Random live time for the particles - number 2

            float m_live_time2;

            /// Random color for the particles - number 1

            Color m_color1;

            /// Random color for the particles - number 2

            Color m_color2;

            /// Random size for the particles - number 1

            float m_size1;

            /// Random size for the particles - number 2

            float m_size2;

            /// Random direction for the particle flow - 1

            float m_direction1;

            /// Random direction for the particle flow - 2

            float m_direction2;

            /// Random speed for the particle flow - 1

            float m_speed1;

            /// Random speed for the particle flow - 1

            float m_speed2;

            /// Apply alpha blending to the burst ? If false additive blending will be used instead.

            bool m_alpha_blend;

        //=============================================================================================================
        // Functions
        //=============================================================================================================

			//=========================================================================================================
			/// @brief		Default constructor. Makes a default invalid burst with nothing initialized.
			//=========================================================================================================
			
			ParticleEmitterBurst(){}

			//=========================================================================================================
			/// @brief		Copy constructor: creates from another burst
			/// @param		other - other burst to create from
			//=========================================================================================================

			ParticleEmitterBurst( const ParticleEmitterBurst & other )
			{
				this->m_num_particles	= other.m_num_particles;
				this->m_texture			= other.m_texture;
				this->m_random_seed		= other.m_random_seed;
				this->m_position		= other.m_position;
				this->m_time_alive		= other.m_time_alive;
				this->m_live_time1		= other.m_live_time1;
				this->m_live_time2		= other.m_live_time2;
				this->m_color1			= other.m_color1;
				this->m_color2			= other.m_color2;
				this->m_size1			= other.m_size1;
				this->m_size2			= other.m_size2;
				this->m_direction1		= other.m_direction1;
				this->m_direction2		= other.m_direction2;
				this->m_speed1			= other.m_speed1;
				this->m_speed2			= other.m_speed2;
				this->m_alpha_blend		= other.m_alpha_blend;
			}

			//=========================================================================================================
			/// @brief		Assignment operator - copies the other burst into this one
			/// @param		other - other burst to create from
			/// @returns	This burst
			//=========================================================================================================

			ParticleEmitterBurst & operator = ( const ParticleEmitterBurst & other )
			{
				this->m_num_particles	= other.m_num_particles;
				this->m_texture			= other.m_texture;
				this->m_random_seed		= other.m_random_seed;
				this->m_position		= other.m_position;
				this->m_time_alive		= other.m_time_alive;
				this->m_live_time1		= other.m_live_time1;
				this->m_live_time2		= other.m_live_time2;
				this->m_color1			= other.m_color1;
				this->m_color2			= other.m_color2;
				this->m_size1			= other.m_size1;
				this->m_size2			= other.m_size2;
				this->m_direction1		= other.m_direction1;
				this->m_direction2		= other.m_direction2;
				this->m_speed1			= other.m_speed1;
				this->m_speed2			= other.m_speed2;
				this->m_alpha_blend		= other.m_alpha_blend;

				return * this;
			}
    };
}

#endif