goat3d

view libs/vmath/ray.cc @ 29:3d669155709d

- switched the unix build to use the internal vmath/anim as well - fixed a memory corruption issue which was caused by including the system-wide installed version of the anim.h header file - started the ass2goat assimp->goat3d converter
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 29 Sep 2013 21:53:03 +0300
parents
children
line source
1 #include "ray.h"
2 #include "vector.h"
4 scalar_t Ray::env_ior = 1.0;
6 Ray::Ray()
7 {
8 ior = env_ior;
9 energy = 1.0;
10 time = 0;
11 iter = 0;
12 }
14 Ray::Ray(const Vector3 &origin, const Vector3 &dir)
15 {
16 this->origin = origin;
17 this->dir = dir;
18 ior = env_ior;
19 energy = 1.0;
20 time = 0;
21 iter = 0;
22 }
24 void Ray::transform(const Matrix4x4 &xform)
25 {
26 Matrix4x4 upper = xform;
27 upper[0][3] = upper[1][3] = upper[2][3] = upper[3][0] = upper[3][1] = upper[3][2] = 0.0;
28 upper[3][3] = 1.0;
30 dir.transform(upper);
31 origin.transform(xform);
32 }
34 Ray Ray::transformed(const Matrix4x4 &xform) const
35 {
36 Ray foo = *this;
37 foo.transform(xform);
38 return foo;
39 }