-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRay.h
44 lines (37 loc) · 957 Bytes
/
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
/*----------------------------------------------------------
* COSC363 Ray Tracer
*
* The ray class
-------------------------------------------------------------*/
#ifndef H_RAY
#define H_RAY
#include <glm/glm.hpp>
#include <vector>
#include "SceneObject.h"
class Ray
{
public:
glm::vec3 pt; //The source point of the ray
glm::vec3 dir; //The UNIT direction of the ray
glm::vec3 xpt; //The closest point of intersection on the ray
int xindex; //The index of the object that gives the closet point of intersection
float xdist; //The distance from the source to xpt along the ray.
Ray()
{
pt = glm::vec3(0, 0, 0);
dir = glm::vec3(0, 0, -1);
xpt = glm::vec3(0, 0, 0);
xindex = -1;
xdist = 0;
} ;
Ray(glm::vec3 point, glm::vec3 direction)
: pt(point), dir(direction)
{
xpt = glm::vec3(0, 0, 0);
xindex = -1;
xdist = 0;
} ;
void normalize();
void closestPt(std::vector<SceneObject*> &sceneObjects);
};
#endif