console: Format tabs semi-intelligently
[attac-man.git] / include / object.h
blob902dd541626c346c46fd708538bd7aff24cf6a41
1 /*
2 Pacman Arena
3 Copyright (C) 2003 Nuno Subtil
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 /* $Id: object.h,v 1.2 2003/11/22 17:32:10 nsubtil Exp $ */
22 #ifndef _OBJECT_H
23 #define _OBJECT_H
25 #define X 0
26 #define Y 1
27 #define Z 2
28 #define W 3
30 #define R 0
31 #define G 1
32 #define B 2
33 #define A 3
35 struct face_tri
37 /* vértices */
38 float *a, *b, *c;
39 /* normais */
40 float na[3], nb[3], nc[3];
42 /* cor da face */
43 float color[4];
44 /* tag de cor */
45 int color_tag;
48 struct object
50 /* num de faces */
51 int num_fc;
52 /* lista de faces */
53 struct face_tri **fc_list;
55 /* display list deste objecto para polígonos de cor fixa*/
56 GLuint dlist_color;
57 /* polígonos de cor variável */
58 GLuint dlist_nocolor;
60 struct object *next;
63 /* caches */
64 struct ocache_entry
66 char *name;
67 struct object *objs;
68 int n_objs;
70 struct ocache_entry *next;
73 int object_hash_vertex(float vx[3]);
74 int object_hash_face(struct face_tri *face);
75 void object_add_face(struct object *obj, struct face_tri *face);
76 struct object *object_cache_find_file(char *fname, int *n_objs);
77 void object_cache_add_file(char *fname, struct object *objs, int n_objs);
78 int object_face_equal(struct face_tri *f1, struct face_tri *f2);
79 int object_get_vertex_index(float **vx_list, int num_vx, float vec[3]);
80 int object_get_face_index(struct face_tri **fc_list, int num_fc, struct face_tri *fc);
81 void object_write_file(char *fname, struct object *objs, int n_objs);
82 struct object *object_read_file(char *fname, int *n_objs);
83 void object_release_dlists(void);
84 void object_recompile_dlists(void);
86 #endif