X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=gph-math;a=blobdiff_plain;f=src%2Fray.h;h=72dfc2650cb733078d888a302602a6d06f4111e4;hp=25740363be9260f491581f31cc2df39252abd086;hb=016badf08fbd4db92e6ee6e2ad74e7e61c5505e3;hpb=bdeb1048917667c00f540c17f397443e8f6f76bf diff --git a/src/ray.h b/src/ray.h index 2574036..72dfc26 100644 --- a/src/ray.h +++ b/src/ray.h @@ -11,7 +11,7 @@ public: Vector3 origin, dir; Ray() : dir(0, 0, 1) {} - Ray(const Vector3 &o, const Vector3 &d) : o(origin), d(dir) {} + Ray(const Vector3 &o, const Vector3 &d) : origin(o), dir(d) {} }; inline Ray operator *(const Ray &r, const Matrix4x4 &m) @@ -20,7 +20,7 @@ inline Ray operator *(const Ray &r, const Matrix4x4 &m) up[0][3] = up[1][3] = up[2][3] = up[3][0] = up[3][1] = up[3][2] = 0.0; up[3][3] = 1.0; - return Ray(origin * m, dir * up); + return Ray(r.origin * m, r.dir * up); } inline Ray operator *(const Matrix4x4 &m, const Ray &r) @@ -29,7 +29,7 @@ inline Ray operator *(const Matrix4x4 &m, const Ray &r) up[0][3] = up[1][3] = up[2][3] = up[3][0] = up[3][1] = up[3][2] = 0.0; up[3][3] = 1.0; - return Ray(m * origin, m * dir); + return Ray(m * r.origin, m * r.dir); } @@ -49,6 +49,6 @@ inline Ray refract(const Ray &ray, const Vector3 &n, float from_ior, float to_io } -} +} // namespace gph #endif // GMATH_RAY_H_