- fixed watcom build
[dosdemo] / src / cgmath / cgmray.inl
1 /* gph-cmath - C graphics math library
2  * Copyright (C) 2018 John Tsiombikas <nuclear@member.fsf.org>
3  *
4  * This program is free software. Feel free to use, modify, and/or redistribute
5  * it under the terms of the MIT/X11 license. See LICENSE for details.
6  * If you intend to redistribute parts of the code without the LICENSE file
7  * replace this paragraph with the full contents of the LICENSE file.
8  */
9 static inline void cgm_rcons(cgm_ray *r, float x, float y, float z, float dx, float dy, float dz)
10 {
11         r->origin.x = x;
12         r->origin.y = y;
13         r->origin.z = z;
14         r->dir.x = dx;
15         r->dir.y = dy;
16         r->dir.z = dz;
17 }
18
19 static inline void cgm_rmul_mr(cgm_ray *ray, const float *m)
20 {
21         cgm_vmul_m4v3(&ray->origin, m);
22         cgm_vmul_m3v3(&ray->dir, m);
23 }
24
25 static inline void cgm_rmul_rm(cgm_ray *ray, const float *m)
26 {
27         cgm_vmul_v3m4(&ray->origin, m);
28         cgm_vmul_v3m3(&ray->dir, m);
29 }
30
31 static inline void cgm_rreflect(cgm_ray *ray, const cgm_vec3 *n)
32 {
33         cgm_vreflect(&ray->dir, n);
34 }
35
36 static inline void cgm_rrefract(cgm_ray *ray, const cgm_vec3 *n, float ior)
37 {
38         cgm_vrefract(&ray->dir, n, ior);
39 }