initial commit
[shapestoy] / libs / psys / rndval.h
1 /*
2 libpsys - reusable particle system library.
3 Copyright (C) 2011-2018  John Tsiombikas <nuclear@member.fsf.org>
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
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 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef RNDVAL_H_
19 #define RNDVAL_H_
20
21 #include "pstrack.h"
22
23 struct psys_rnd {
24         float value, range;
25 };
26
27 struct psys_rnd3 {
28         float value[3], range[3];
29 };
30
31 struct psys_anm_rnd {
32         struct psys_track value, range;
33 };
34
35 struct psys_anm_rnd3 {
36         struct psys_track3 value, range;
37 };
38
39 #define PSYS_EVAL_CUR   ANM_TIME_INVAL
40
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44
45 int psys_init_anm_rnd(struct psys_anm_rnd *v);
46 void psys_destroy_anm_rnd(struct psys_anm_rnd *v);
47 int psys_init_anm_rnd3(struct psys_anm_rnd3 *v);
48 void psys_destroy_anm_rnd3(struct psys_anm_rnd3 *v);
49
50 void psys_copy_anm_rnd(struct psys_anm_rnd *dest, const struct psys_anm_rnd *src);
51 void psys_copy_anm_rnd3(struct psys_anm_rnd3 *dest, const struct psys_anm_rnd3 *src);
52
53 void psys_set_rnd(struct psys_rnd *r, float val, float range);
54 void psys_set_rnd3(struct psys_rnd3 *r, const float *val, const float *range);
55
56 void psys_set_anm_rnd(struct psys_anm_rnd *r, anm_time_t tm, float val, float range);
57 void psys_set_anm_rnd3(struct psys_anm_rnd3 *r, anm_time_t tm, const float *val, const float *range);
58
59 float psys_eval_rnd(struct psys_rnd *r);
60 void psys_eval_rnd3(struct psys_rnd3 *r, float *val);
61
62 float psys_eval_anm_rnd(struct psys_anm_rnd *r, anm_time_t tm);
63 void psys_eval_anm_rnd3(struct psys_anm_rnd3 *r, anm_time_t tm, float *val);
64
65 #ifdef __cplusplus
66 }
67 #endif
68
69 #endif  /* RNDVAL_H_ */