/*
** particle.h for particle in /u/a1/caput_r/rendu/
**
** Made by remi caput
** Login caput_r <caput_r@epita.fr>
**
** Started on  Fri Nov  4 21:16:15 2005 remi caput
** Last update Thu Jan  1 01:18:41 1970 Vertyos
*/

#ifndef PARTICLE_H_
#define PARTICLE_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <math.h>
#include <stdarg.h>
#include <stdlib.h>
#include "coord.h"
#include "surface.h"
#include "vertex.h"

#define PARTICLE_COUNT_COLOR	10
#define PARTICLE_COUNT_DEFINE   10

#define PARTICLE_REALLOC_ITEM   32

struct		s_particle_spark
{
	float   coord[3];
	float   speed[3];
};

typedef void	(*t_particle_move) (struct s_particle_spark *, float);

enum	e_particle_color
{
		particle_color_blue,
		particle_color_red,
		particle_color_green,
		particle_color_yellow,
		particle_color_purple,
		particle_color_cyan,
		particle_color_orange,
		particle_color_white,
		particle_color_fire,
		particle_color_unknown
};

enum	e_particle_define
{
		particle_define_pad_release,
		particle_define_bonus_take,
		particle_define_pad_length,
		particle_define_block_hit,
		particle_define_ball_trail,
		particle_define_pad_load,
		particle_define_block_destroy,
		particle_define_ball_create,
		particle_define_bonus_fall,
		particle_define_ball_spark
};

struct		s_particle_color
{
	float	begin[4];
	float	end[4];
};

struct				s_particle_define
{
	t_particle_move	func;
	unsigned long	count;
	unsigned long	delay;
	float			radius_begin;
	float			radius_end;
	const char*		path;
};

struct							s_particle_item
{
	struct s_particle_spark*	spark;
	struct s_coord				coord;
	enum e_particle_color		color;
	enum e_particle_define		define;
	unsigned long				count;
	unsigned long				delay;
	unsigned long				size;
	unsigned long				time;
	GLuint						texture;
};

struct						s_particle
{
	GLuint*					texture;
	struct s_particle_item* item;
	unsigned long			count;
	unsigned long			size;
};

int		particle_create (struct s_particle*, struct s_coord*, enum e_particle_color, enum e_particle_define, float);
void	particle_cycle (struct s_particle*);
void	particle_draw (const struct s_particle*);
int		particle_init (struct s_particle*, struct s_surface*);
void	particle_stop (struct s_particle*);

#ifdef __cplusplus
}
#endif

#endif /* !PARTICLE_H_ */
