2 * Copyright (C) 2003 Robert Kooima
4 * NEVERBALL is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published
6 * by the Free Software Foundation; either version 2 of the License,
7 * or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
24 * Some might be taken aback at the terseness of the names of the
25 * structure members and the variables used by the functions that
26 * access them. Yes, yes, I know: readability. I contend that once
27 * the naming convention is embraced, the names become more readable
28 * than any verbose alternative, and their brevity and uniformity do
29 * more to augment readability than longVariableNames ever could.
31 * Members and variables are named XY. X determines the type of
32 * structure to which the variable refers. Y determines the usage of
35 * The Xs are as documented by struct s_file:
37 * m Material (struct s_mtrl)
38 * v Vertex (struct s_vert)
39 * e Edge (struct s_edge)
40 * s Side (struct s_side)
41 * t Texture coord (struct s_texc)
42 * g Geometry (struct s_geom)
43 * l Lump (struct s_lump)
44 * n Node (struct s_node)
45 * p Path (struct s_path)
46 * b Body (struct s_body)
47 * c Coin (struct s_coin)
48 * z Goal (struct s_goal)
49 * u User (struct s_ball)
53 * The Ys are as follows:
58 * 0 Index of the first
63 * Thus "up" is a pointer to a user structure. "lc" is the number of
64 * lumps. "ei" and "ej" are edge indices into some "ev" edge vector.
65 * An edge is defined by two vertices, so an edge structure consists
66 * of "vi" and "vj". And so on.
68 * Those members that do not conform to this convention are explicitly
69 * documented with a comment.
72 /*---------------------------------------------------------------------------*/
76 float a
[4]; /* ambient color */
77 float d
[4]; /* diffuse color */
78 float s
[4]; /* specular color */
79 float e
[4]; /* emission color */
80 float h
[1]; /* specular exponent */
82 char f
[PATHMAX
]; /* texture file name */
83 GLuint o
; /* OpenGL texture object */
88 double p
[3]; /* vertex position */
99 double n
[3]; /* plane normal vector */
100 double d
; /* distance from origin */
105 double u
[2]; /* texture coordinate */
119 int fl
; /* lump flags */
141 double p
[3]; /* starting position */
142 double t
; /* travel time */
149 double t
; /* time on current path */
151 GLuint ol
; /* opaque geometry list */
152 GLuint tl
; /* transparent geometry list */
162 double p
[3]; /* position */
168 double p
[3]; /* position */
169 double r
; /* radius */
174 double p
[3]; /* position */
175 double q
[3]; /* target position */
176 double r
; /* radius */
181 double e
[3][3]; /* basis of orientation */
182 double p
[3]; /* position vector */
183 double v
[3]; /* velocity vector */
184 double w
[3]; /* angular velocity vector */
185 double r
; /* radius */
233 /*---------------------------------------------------------------------------*/
235 int sol_load(struct s_file
*, const char *, int);
236 int sol_stor(struct s_file
*, const char *);
237 void sol_free(struct s_file
*);
239 void sol_draw(const struct s_file
*);
240 double sol_step(struct s_file
*, const double *, double);
242 int sol_coin_test(struct s_file
*, double *, double);
243 int sol_goal_test(struct s_file
*, double *);
244 int sol_jump_test(struct s_file
*, double *);
246 /*---------------------------------------------------------------------------*/