This repository was archived by the owner on Jan 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSceneObject.cpp
More file actions
66 lines (57 loc) · 1.27 KB
/
SceneObject.cpp
File metadata and controls
66 lines (57 loc) · 1.27 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
60
61
62
63
64
65
66
#include "Vector3D.h"
#include "ColorRGB.h"
#include "Ray.h"
#include "SceneObject.h"
#include <cassert>
//Creates generic SceneObject with grey color
SceneObject::SceneObject()
{
surface_color = new ColorRGB(.5,.5,.5);
reflectivity = .5;
}
//Creates generic with color cRGB
SceneObject::SceneObject(const ColorRGB& cRGB, const float refl_num)
{
assert(refl_num >= 0 && refl_num <= 1);
surface_color = new ColorRGB(cRGB);
reflectivity = refl_num;
}
//Deletes SceneObject
SceneObject::~SceneObject()
{
delete surface_color;
}
//Sets color to cRGB
void SceneObject::set_color(const ColorRGB& cRGB)
{
surface_color = new ColorRGB(cRGB);
}
//Returns color of object
const ColorRGB SceneObject::get_color() const
{
return *surface_color;
}
void SceneObject::set_reflectivity(const float refl_num)
{
assert(refl_num >= 0 && refl_num <= 1);
reflectivity = refl_num;
}
const float SceneObject::get_reflectivity() const
{
return reflectivity;
}
//Calculates intersection
const float SceneObject::intersection(const Ray&) const
{
return NO_INTERSECT;
}
//Returns surface normal of object
const Vector3D SceneObject::surface_normal(const Vector3D&) const
{
return Vector3D();
}
//gets Color at the point
const ColorRGB SceneObject::getColorAt(const Vector3D&) const
{
return *surface_color;
}