/*
** struct.h for graviball in /u/a2/yousfi_r/projets/graviball/src/map
**
** Made by razik yousfi
** Login   <yousfi_r@epita.fr>
**
** Started on  Sat Nov 18 03:49:36 2006 razik yousfi
// Last update Thu Nov 23 23:11:54 2006 
*/

#ifndef STRUCT_HH_
# define STRUCT_HH_

# include <string>
# include <vector>
# include <GL/gl.h>

typedef void    (*move_function) (struct s_block&, struct s_move&);
typedef void    (*shader_function) (struct s_face&, struct s_shader&);

struct s_point
{
  float	x;
  float	y;
  float	z;
};

struct s_texcoord
{
  float	u;
  float	v;
};

struct s_move
{
  std::vector<float>    args;
  move_function         move;
  bool                  reverse;
  float                 startTime;
};

struct s_shader
{
  std::vector<float>	args;
  shader_function	shader;
};

struct s_face
{
  std::string				id;
  std::vector<struct s_point>		vertices;
  std::vector<struct s_texcoord>	texcoords;
  std::vector<struct s_point>		curVertices;
  std::vector<struct s_texcoord>	curTexcoords;
  std::vector<struct s_shader>		shaders;
  std::vector<std::string>		textures;
  std::vector<GLuint>			texturesid;
  float							color[4];
};

struct s_block
{
  bool                  alive;
  int                   hits;
  struct s_point        origin;
  struct s_point        curOrigin;
};

struct s_block_group
{
  std::vector<struct s_block>	blocks;
  std::vector<int>              faces;
  std::vector<std::string>	faceIds;
  int                           lives;
  std::vector<struct s_move>    moves;
  int                           numFaces;
  float                         x1, x2;
  float                         y1, y2;
  float                         z1, z2;
};

struct s_world
{
  int                           numFaces;
  std::vector<int>              faces;
  std::vector<std::string>      faceIds;
  std::vector<float>            limits;
};

struct s_map
{
  std::vector<struct s_block_group>	blockGroups;
  std::vector<struct s_face>            faces;
  struct s_world                        world;
};

#endif /* !STRUCT_HH_ */
