Split SOL data structures into base, varying and rendering parts
[neverball] / share / solid_vary.h
1 /*
2  * Copyright (C) 2003 Robert Kooima
3  *
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.
8  *
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.
13  */
14
15 #ifndef SOLID_VARY_H
16 #define SOLID_VARY_H
17
18 #include "base_config.h"
19 #include "solid_base.h"
20
21 /*
22  * Varying solid data.
23  */
24
25 /*---------------------------------------------------------------------------*/
26
27 struct v_path
28 {
29     const struct b_path *base;
30
31     int f;                                     /* enable flag                */
32 };
33
34 struct v_body
35 {
36     const struct b_body *base;
37
38     float t;                                   /* time on current path       */
39     int   tm;                                  /* milliseconds               */
40
41     int pi;
42 };
43
44 struct v_item
45 {
46     float p[3];                                /* position                   */
47     int   t;                                   /* type                       */
48     int   n;                                   /* value                      */
49 };
50
51 struct v_swch
52 {
53     const struct b_swch *base;
54
55     float t;                                   /* current timer              */
56     int   tm;                                  /* milliseconds               */
57     int   f;                                   /* current state              */
58     int   e;                                   /* is a ball inside it?       */
59 };
60
61 struct v_ball
62 {
63     float e[3][3];                             /* basis of orientation       */
64     float p[3];                                /* position vector            */
65     float v[3];                                /* velocity vector            */
66     float w[3];                                /* angular velocity vector    */
67     float E[3][3];                             /* basis of pendulum          */
68     float W[3];                                /* angular pendulum velocity  */
69     float r;                                   /* radius                     */
70 };
71
72 struct s_vary
73 {
74     const struct s_base *base;
75
76     int pc;
77     int bc;
78     int hc;
79     int xc;
80     int uc;
81
82     struct v_path *pv;
83     struct v_body *bv;
84     struct v_item *hv;
85     struct v_swch *xv;
86     struct v_ball *uv;
87 };
88
89 /*---------------------------------------------------------------------------*/
90
91 int  sol_load_vary(struct s_vary *, const struct s_base *);
92 void sol_free_vary(struct s_vary *);
93
94 /*---------------------------------------------------------------------------*/
95
96 #endif