X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=libs%2Fpsys%2Fpstrack.h;fp=libs%2Fpsys%2Fpstrack.h;h=e71f042d3bc694eef1030838278cb55798fd0387;hb=fca3f24e31b3bbbe81ce0ef00da901480a2a92cc;hp=0000000000000000000000000000000000000000;hpb=e808f24e718ba3eae01b20dc3dc9e1526fd20871;p=andemo diff --git a/libs/psys/pstrack.h b/libs/psys/pstrack.h new file mode 100644 index 0000000..e71f042 --- /dev/null +++ b/libs/psys/pstrack.h @@ -0,0 +1,66 @@ +/* +libpsys - reusable particle system library. +Copyright (C) 2011-2018 John Tsiombikas + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this program. If not, see . +*/ +#ifndef PSTRACK_H_ +#define PSTRACK_H_ + +#include + +struct psys_track { + struct anm_track trk; + + anm_time_t cache_tm; + float cache_val; +}; + +struct psys_track3 { + struct anm_track x, y, z; + + anm_time_t cache_tm; + float cache_vec[3]; +}; + +#ifdef __cplusplus +extern "C" { +#endif + +int psys_init_track(struct psys_track *track); +void psys_destroy_track(struct psys_track *track); + +int psys_init_track3(struct psys_track3 *track); +void psys_destroy_track3(struct psys_track3 *track); + +/* XXX dest must have been initialized first */ +void psys_copy_track(struct psys_track *dest, const struct psys_track *src); +void psys_copy_track3(struct psys_track3 *dest, const struct psys_track3 *src); + +void psys_eval_track(struct psys_track *track, anm_time_t tm); +void psys_set_value(struct psys_track *track, anm_time_t tm, float v); +float psys_get_value(struct psys_track *track, anm_time_t tm); +float psys_get_cur_value(struct psys_track *track); + +void psys_eval_track3(struct psys_track3 *track, anm_time_t tm); +void psys_set_value3(struct psys_track3 *track, anm_time_t tm, float x, float y, float z); +/* returns pointer to the internal cached value, and if vec is not null, also copies it there */ +float *psys_get_value3(struct psys_track3 *track, anm_time_t tm, float *vec); +float *psys_get_cur_value3(struct psys_track3 *track, float *vec); + +#ifdef __cplusplus +} +#endif + +#endif /* PSTRACK_H_ */