goat3d

view libs/vmath/ray.h @ 38:60f2037680ee

split the exporter into two files to make it more readable (and maybe make an importer too at some point?)
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 07 Oct 2013 20:02:57 +0300
parents 4deb0b12fe14
children
line source
1 /*
2 libvmath - a vector math library
3 Copyright (C) 2004-2011 John Tsiombikas <nuclear@member.fsf.org>
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
7 by the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
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.
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 */
19 #ifndef VMATH_RAY_H_
20 #define VMATH_RAY_H_
22 #include "matrix.h"
23 #include "vector.h"
25 typedef struct {
26 vec3_t origin, dir;
27 } ray_t;
29 #ifdef __cplusplus
30 extern "C" {
31 #endif /* __cplusplus */
33 static VMATH_INLINE ray_t ray_cons(vec3_t origin, vec3_t dir);
34 ray_t ray_transform(ray_t r, mat4_t m);
36 #ifdef __cplusplus
37 } /* __cplusplus */
39 #include <stack>
41 class Ray {
42 public:
43 static scalar_t env_ior;
45 Vector3 origin, dir;
46 scalar_t energy;
47 int iter;
48 scalar_t ior;
49 long time;
51 Ray();
52 Ray(const Vector3 &origin, const Vector3 &dir);
54 void transform(const Matrix4x4 &xform);
55 Ray transformed(const Matrix4x4 &xform) const;
56 };
58 VMATH_INLINE Ray reflect_ray(const Ray &inray, const Vector3 &norm);
59 VMATH_INLINE Ray refract_ray(const Ray &inray, const Vector3 &norm, scalar_t from_ior, scalar_t to_ior);
60 #endif /* __cplusplus */
62 #include "ray.inl"
64 #endif /* VMATH_RAY_H_ */