-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBox.h
More file actions
59 lines (43 loc) · 1.7 KB
/
Copy pathBox.h
File metadata and controls
59 lines (43 loc) · 1.7 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
#pragma once
#include "Object.h"
#include "Vector.h"
class Box : public Object
{
private:
// Note: the Box will be drawn with half of the width and length sprouting from the sides of the position point. Height is undecided.
// This is done to simplify rotational purposes.
Vector m_forward = Vector(); // 3D "forward" vector - currently unused.
float m_width = 1.0f; // Width of box (along its x-axis) - defaults to 1.0f
float m_length = 1.0f; // Length of box (along its y-axis) - defaults to 1.0f
float m_height = 1.0f; // Height of box (along its z-axis) - defaults to 1.0f
Vector m_bound_min; // mininum boundary field - currently unused
Vector m_bound_max; // maximum boundary field - currently unused
public:
Box();
Box(float width, float length, Vector position);
Box(float width, float length, Vector position, Vector forward);
Box(float width, float length, float height, Vector position);
Box(float width, float length, float height, Vector position, Vector forward);
// Unused constructors
Box(Vector min_bound, Vector max_bound);
Box(Vector min_bound, Vector max_bound, Vector position);
// Setters
void setWidth(float new_width);
void setLength(float new_length);
void setHeight(float new_height);
void scaleWidth(float scalar);
void scaleLength(float scalar);
void scaleHeight(float scalar);
void scale(float scalar);
void setBounds(Vector min, Vector max);
void setForward(Vector new_forward);
//Getters
float getWidth();
float getLength();
float getHeight();
Vector getForward();
Vector getMinBound();
Vector getMaxBound();
// Intersection test
bool intersects(const Ray& ray, IntersectInfo &t);
};