#pragma once
#include "../../../stdafx.h"
#include "../../glLibLocals.h"

namespace glLib { namespace Effect { namespace Particle {

class particle_emitter {
	friend class particle_system;
	public:
		float emit_position[3], emit_position_jitter[3]; glLibFlagRandom emit_position_jitter_random_type;
		float emit_velocity[3], emit_velocity_jitter[3]; glLibFlagRandom emit_velocity_jitter_random_type;
		float emit_rate;
		float particle_max_time, particle_max_time_jitter; glLibFlagRandom particle_max_time_jitter_random_type;
	private:
		bool _emit_position_jitter; float emit_position_jitter_normalized[3];
		bool _emit_velocity_jitter; float emit_velocity_jitter_normalized[3];
		bool _particle_max_time_jitter;

		#ifdef GLLIB_ERROR_MODE_REPORT_ERRORS
		bool _has_set_position;
		bool _has_set_velocity;
		bool _has_set_rate;
		bool _has_set_max_time;
		#endif

	public:
		particle_emitter(void);
		~particle_emitter(void);

		void set_emit_position(const float* new_position, const float* new_position_jitter=NULL, const glLibFlagRandom random_type=GLLIB_RANDOM_GAUSSIAN);
		void set_emit_velocity(const float* new_velocity, const float* new_velocity_jitter=NULL, const glLibFlagRandom random_type=GLLIB_RANDOM_GAUSSIAN);
		void set_emit_rate(const float new_rate);

		void set_particle_max_time(float new_particle_max_time, float new_particle_max_time_jitter=0.0f, const glLibFlagRandom random_type=GLLIB_RANDOM_GAUSSIAN);

	private:
		void glLibInternal_get_new_position(float* pos);
		void glLibInternal_get_new_velocity(float* vel);
		void glLibInternal_get_new_max_time(float* val);
};

};};};