gpuray_glsl
view vmath/ray.h @ 2:6e3a4daf3159
adding cones
author | John Tsiombikas <nuclear@mutantstargoat.com> |
---|---|
date | Sun, 09 Nov 2014 14:39:01 +0200 |
parents | |
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 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 void *user; /* store any random crap with the ray */
53 Ray();
54 Ray(const Vector3 &origin, const Vector3 &dir);
56 void transform(const Matrix4x4 &xform);
57 Ray transformed(const Matrix4x4 &xform) const;
58 };
60 inline Ray reflect_ray(const Ray &inray, const Vector3 &norm);
61 inline Ray refract_ray(const Ray &inray, const Vector3 &norm, scalar_t from_ior, scalar_t to_ior);
62 #endif /* __cplusplus */
64 #include "ray.inl"
66 #endif /* VMATH_RAY_H_ */