diff options
Diffstat (limited to 'v3f.h')
-rw-r--r-- | v3f.h | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -237,6 +237,33 @@ static inline v3f_t * v3f_bilerp(v3f_t *res, const v3f_t *aa, const v3f_t *ab, c } +/* + * abb-------bbb + * /| /| + * aba-------bba| + * | | | | + * |aab------|bab + * |/ |/ + * aaa-------baa + */ +static inline v3f_t _v3f_trilerp(const v3f_t *aaa, const v3f_t *aba, const v3f_t *aab, const v3f_t *abb, const v3f_t *baa, const v3f_t *bba, const v3f_t *bab, const v3f_t *bbb, float t_x, float t_y, float t_z) +{ + v3f_t xya = _v3f_bilerp(aaa, aba, baa, bba, t_x, t_y); + v3f_t xyb = _v3f_bilerp(aab, abb, bab, bbb, t_x, t_y); + + return _v3f_lerp(&xya, &xyb, t_z); +} + + +static inline v3f_t * v3f_trilerp(v3f_t *res, const v3f_t *aaa, const v3f_t *aba, const v3f_t *aab, const v3f_t *abb, const v3f_t *baa, const v3f_t *bba, const v3f_t *bab, const v3f_t *bbb, float t_x, float t_y, float t_z) +{ + if (_v3f_allocated(&res)) + *res = _v3f_trilerp(aaa, aba, aab, abb, baa, bba, bab, bbb, t_x, t_y, t_z); + + return res; +} + + static inline v3f_t _v3f_cross(const v3f_t *a, const v3f_t *b) { return (v3f_t){ |