-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBox.h
40 lines (33 loc) · 877 Bytes
/
Box.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
#ifndef BOX_CLASS_H
#define BOX_CLASS_H
#include <glm/glm.hpp>
#include <vector>
#include "Line.h"
#include <algorithm>
// TO DO: Rename as AABBBox
class Box
{
private:
std::vector<Line> lines;
//int longestLineIndex;
public:
int longestAxisIndex;
std::vector<glm::vec3> bounds;
glm::vec3 color;
Box(const glm::vec3& vmin, const glm::vec3& vmax, const glm::vec3& color = glm::vec3(1.0, 1.0, 1.0));
bool IntersectsRay
(
const glm::vec3& origin,
const glm::vec3& direction,
float t0,
float t1,
glm::vec3& outNPoint,
glm::vec3& outFPoint
);
bool isValidBox(const glm::vec3& vmin, const glm::vec3& vmax);
void CalculateLines();
void DrawWireFrame(Shader& shader, Camera& camera);
int GetLongestAxis();
glm::vec3 GetLongestAxisMid();
};
#endif // !LINE_CLASS_H