forked from deermichel/raytracer.py
-
Notifications
You must be signed in to change notification settings - Fork 1
/
material.py
executable file
·44 lines (35 loc) · 1.25 KB
/
material.py
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
from vector3 import Vector3
class Material:
"""Material class"""
def __init__(self, surface_color=Vector3(), emission_color=Vector3(),
reflectivity=0.0, transparency=0.0, ior=1.0):
"""Creates a new material"""
self.__surface_color = surface_color
self.__emission_color = emission_color
self.__reflectivity = reflectivity
self.__transparency = transparency
self.__ior = ior
@property
def surface_color(self):
"""Returns the surface color of the material"""
return self.__surface_color
@property
def emission_color(self):
"""Returns the emission color of the material"""
return self.__emission_color
@property
def transparency(self):
"""Returns the transparency of the material"""
return self.__transparency
@property
def reflectivity(self):
"""Returns the reflectivity of the material"""
return self.__reflectivity
@property
def is_diffuse(self):
"""Returns whether the material is diffuse"""
return self.__reflectivity == 0.0 and self.__transparency == 0.0
@property
def ior(self):
"""Returns the index of refraction of the material"""
return self.__ior