goat3d

view libs/vmath/ray.h @ 40:a5c5cec3cb88

- added mesh attribute and face append functions - added Int4 constructor - continued the blender exporter - fixed a bug in clean_filename which made it produce unterminated strings - renamed clean_filename to goat3d_clean_filename and made it extern - added call to goat3d_clean_filename in the mesh XML export code to cleanup ctm filenames
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 13 Oct 2013 10:14:19 +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_ */