rev |
line source |
nuclear@5
|
1 #include "pstrack.h"
|
nuclear@5
|
2
|
nuclear@5
|
3 int psys_init_track(struct psys_track *track)
|
nuclear@5
|
4 {
|
nuclear@5
|
5 track->cache_tm = ANM_TIME_INVAL;
|
nuclear@5
|
6
|
nuclear@5
|
7 if(anm_init_track(&track->trk) == -1) {
|
nuclear@5
|
8 return -1;
|
nuclear@5
|
9 }
|
nuclear@5
|
10 return 0;
|
nuclear@5
|
11 }
|
nuclear@5
|
12
|
nuclear@5
|
13 void psys_destroy_track(struct psys_track *track)
|
nuclear@5
|
14 {
|
nuclear@5
|
15 anm_destroy_track(&track->trk);
|
nuclear@5
|
16 }
|
nuclear@5
|
17
|
nuclear@5
|
18 int psys_init_track3(struct psys_track3 *track)
|
nuclear@5
|
19 {
|
nuclear@5
|
20 track->cache_tm = ANM_TIME_INVAL;
|
nuclear@5
|
21
|
nuclear@5
|
22 if(anm_init_track(&track->x) == -1) {
|
nuclear@5
|
23 return -1;
|
nuclear@5
|
24 }
|
nuclear@5
|
25 if(anm_init_track(&track->y) == -1) {
|
nuclear@5
|
26 anm_destroy_track(&track->x);
|
nuclear@5
|
27 return -1;
|
nuclear@5
|
28 }
|
nuclear@5
|
29 if(anm_init_track(&track->z) == -1) {
|
nuclear@5
|
30 anm_destroy_track(&track->x);
|
nuclear@5
|
31 anm_destroy_track(&track->z);
|
nuclear@5
|
32 return -1;
|
nuclear@5
|
33 }
|
nuclear@5
|
34 return 0;
|
nuclear@5
|
35 }
|
nuclear@5
|
36
|
nuclear@5
|
37 void psys_destroy_track3(struct psys_track3 *track)
|
nuclear@5
|
38 {
|
nuclear@5
|
39 anm_destroy_track(&track->x);
|
nuclear@5
|
40 anm_destroy_track(&track->y);
|
nuclear@5
|
41 anm_destroy_track(&track->z);
|
nuclear@5
|
42 }
|
nuclear@5
|
43
|
nuclear@5
|
44 void psys_eval_track(struct psys_track *track, anm_time_t tm)
|
nuclear@5
|
45 {
|
nuclear@5
|
46 if(track->cache_tm != tm) {
|
nuclear@5
|
47 track->cache_tm = tm;
|
nuclear@5
|
48 track->cache_val = anm_get_value(&track->trk, tm);
|
nuclear@5
|
49 }
|
nuclear@5
|
50 }
|
nuclear@5
|
51
|
nuclear@5
|
52 void psys_set_value(struct psys_track *track, anm_time_t tm, float v)
|
nuclear@5
|
53 {
|
nuclear@5
|
54 anm_set_value(&track->trk, tm, v);
|
nuclear@5
|
55 track->cache_tm = ANM_TIME_INVAL;
|
nuclear@5
|
56 }
|
nuclear@5
|
57
|
nuclear@5
|
58 float psys_get_value(struct psys_track *track, anm_time_t tm)
|
nuclear@5
|
59 {
|
nuclear@5
|
60 psys_eval_track(track, tm);
|
nuclear@5
|
61 return track->cache_val;
|
nuclear@5
|
62 }
|
nuclear@5
|
63
|
nuclear@5
|
64 float psys_get_cur_value(struct psys_track *track)
|
nuclear@5
|
65 {
|
nuclear@5
|
66 return track->cache_val;
|
nuclear@5
|
67 }
|
nuclear@5
|
68
|
nuclear@5
|
69
|
nuclear@5
|
70 void psys_eval_track3(struct psys_track3 *track, anm_time_t tm)
|
nuclear@5
|
71 {
|
nuclear@5
|
72 if(track->cache_tm != tm) {
|
nuclear@5
|
73 track->cache_tm = tm;
|
nuclear@5
|
74 track->cache_vec.x = anm_get_value(&track->x, tm);
|
nuclear@5
|
75 track->cache_vec.y = anm_get_value(&track->y, tm);
|
nuclear@5
|
76 track->cache_vec.z = anm_get_value(&track->z, tm);
|
nuclear@5
|
77 }
|
nuclear@5
|
78 }
|
nuclear@5
|
79
|
nuclear@5
|
80 void psys_set_value3(struct psys_track3 *track, anm_time_t tm, vec3_t v)
|
nuclear@5
|
81 {
|
nuclear@5
|
82 anm_set_value(&track->x, tm, v.x);
|
nuclear@5
|
83 anm_set_value(&track->y, tm, v.y);
|
nuclear@5
|
84 anm_set_value(&track->z, tm, v.z);
|
nuclear@5
|
85 track->cache_tm = ANM_TIME_INVAL;
|
nuclear@5
|
86 }
|
nuclear@5
|
87
|
nuclear@5
|
88 vec3_t psys_get_value3(struct psys_track3 *track, anm_time_t tm)
|
nuclear@5
|
89 {
|
nuclear@5
|
90 psys_eval_track3(track, tm);
|
nuclear@5
|
91 return track->cache_vec;
|
nuclear@5
|
92 }
|
nuclear@5
|
93
|
nuclear@5
|
94 vec3_t psys_get_cur_value3(struct psys_track3 *track)
|
nuclear@5
|
95 {
|
nuclear@5
|
96 return track->cache_vec;
|
nuclear@5
|
97 }
|