/* WORLD: The world!!
*
* Copyright (C) 2007 Fixi Studios.
*
* Authors:
* Marvin Stockl Garcia <durmieu@users.sourceforge.net>
* Jeremies Perez Morata <jeremiespm@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef WORLD_H_
#define WORLD_H_
#define OBJ_NADA -1
#define OBJ_HIERBA 0
#define OBJ_ARBOL 1
#define OBJ_ROAD_VER 2
#define OBJ_ROAD_HOR 3
#define OBJ_CURV_DR 4
#define OBJ_CURV_DL 5
#define OBJ_CURV_UR 6
#define OBJ_CURV_UL 7
#define OBJ_CRUCE 8
#define OBJ_MOLINO 9
#define OBJ_TRAMP_L 10
#define OBJ_TRAMP_R 11
#define OBJ_TRAMP_U 12
#define OBJ_TRAMP_D 13
#define OBJ_HIGH_H 14
#define OBJ_HIGH_V 15
#define OBJ_HIGH_HC 16
#define OBJ_HIGH_VC 17
#define OBJ_PELOTA 18
#define OBJ_BONYO 19
#define OBJ_CASA 20
#define OBJ_SALIDA 21
#define OBJ_CPOINT_H 22
#define OBJ_CPOINT_V 23
#define OBJ_CAJAS 24
#define OBJ_INTER_U 25
#define OBJ_INTER_D 26
#define OBJ_INTER_L 27
#define OBJ_INTER_R 28
#define NUM_OBJS 29
struct Geom
{
int type;
dGeomID geom;
};
struct Body
{
int type;
dBodyID body;
dGeomID geom;
ObjModel model;
};
struct Object
{
int type;
int posx,posy;
int num_geoms;
int num_bodies;
ObjModel model;
Geom *geom;
Body *body;
};
struct Map
{
int length;
int area;
int *data;
};
class World
{
public:
World();
~World();
dJointGroupID contactgroup;
dSpaceID space;
dWorldID world_id;
float step_size, real_step_size, time_speed;
static void nearCallback (void *pData, dGeomID o1, dGeomID o2);
void nearCallback (dGeomID o1, dGeomID o2);
void prestep ();
void step ();
void create();
void destroy();
void draw();
void load_map(char *filename);
Map map;
Object *object;
private:
dGeomID muro[4];
dGeomID ground;
void draw_object(int i);
void draw_object_gllist(int i);
void draw_toys(int i);
void draw_sky();
void draw_muros();
void draw_mountain_side();
bool object_is_in_sphere(int o);
GLuint *objs_list,muros_list;
int lists_created_obj, lists_created_muros;
};
#endif