-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSphere.h
More file actions
33 lines (27 loc) · 1 KB
/
Copy pathSphere.h
File metadata and controls
33 lines (27 loc) · 1 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
#pragma once
#include "Object.h"
#include "Vector.h"
class Sphere : public Object
{
private:
float m_radius = 1.0f; // Radius of the Sphere - defaults to 1.0f
Vector m_forward = Vector(); // 3D "forward" vector of the sphere - defaults to (0,0,0)
// going to need a rotation matrix at some point... I THINK.
public:
// Constructors
Sphere();
Sphere(Vector position);
Sphere(Vector position, Vector color);
Sphere(float radius, Vector position);
Sphere(float radius, Vector position, Vector color);
Sphere(float radius, Vector position, Vector color, Vector forward);
// Setters
void setRadius(float new_radius); // Set radius of sphere
void setForward(Vector new_forward); // Set 3D "forward" vector fo the sphere (used for rotation)
void scale(float scalar); // Scale the sphere by multiplying current radius by given value.
// Getters
float getRadius();
Vector getForward();
// Sphere intersection test
bool intersects(const Ray& ray, IntersectInfo& IsectInfo);
};