-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCsg.h
40 lines (29 loc) · 871 Bytes
/
Csg.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
/*----------------------------------------------------------
* COSC363 Ray Tracer
*
* The sphere class
* This is a subclass of SceneObject, and hence implements the
* methods intersect() and normal().
-------------------------------------------------------------*/
#ifndef H_CSG
#define H_CSG
#include <glm/glm.hpp>
#include "SceneObject.h"
/**
* Defines a simple Sphere located at 'center'
* with the specified radius
*/
class Csg : public SceneObject
{
private:
glm::vec3 center = glm::vec3(0);
float radius = 1;
public:
Csg() {}; //Default constructor creates a unit sphere
Csg(glm::vec3 c, float r) : center(c), radius(r) {}
float intersect(glm::vec3 p0, glm::vec3 dir);
float* intersectMain(glm::vec3 p0, glm::vec3 dir);
float* intersectSecondary(glm::vec3 p0, glm::vec3 dir);
glm::vec3 normal(glm::vec3 p);
};
#endif //!H_CSG