[go: up one dir, main page]

Menu

[r21]: / include / world.h  Maximize  Restore  History

Download this file

133 lines (116 with data), 2.9 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/* 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