-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRay.h
47 lines (38 loc) · 1.36 KB
/
Ray.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// *********************************************************
// Ray Class
// Author : Tamy Boubekeur ([email protected]).
// Copyright (C) 2010 Tamy Boubekeur.
// All rights reserved.
// *********************************************************
#ifndef RAY_H
#define RAY_H
#include <iostream>
#include <vector>
#include "Vec3D.h"
#include "BoundingBox.h"
#include "Triangle.h"
#include "Vertex.h"
class Ray {
public:
inline Ray () {}
inline Ray (const Vec3Df & origin, const Vec3Df & direction)
: origin (origin), direction (direction) {}
inline virtual ~Ray () {}
inline const Vec3Df & getOrigin () const { return origin; }
inline Vec3Df & getOrigin () { return origin; }
inline const Vec3Df & getDirection () const { return direction; }
inline Vec3Df & getDirection () { return direction; }
bool intersect (const BoundingBox & bbox, Vec3Df &intersectionPoint) const;
bool intersectTriangle (Vec3Df & intersectionPoint, Vec3Df p0, Vec3Df p1, Vec3Df p2, float & b0, float & b1, float & b2) const;
float brdfPhong (Vec3Df intersectionPoint, Vec3Df n0, Vec3Df n1, Vec3Df n2, float b0, float b1, float b2, float diffuse, float specular, Vec3Df lightpos) const;
private:
Vec3Df origin;
Vec3Df direction;
};
#endif // RAY_H
// Some Emacs-Hints -- please don't remove:
//
// Local Variables:
// mode:C++
// tab-width:4
// End: