-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMaterial.py
31 lines (24 loc) · 998 Bytes
/
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
from Color import Color
import math
class MaterialMonochrome:
def __init__(self, color = Color.HexToRgb("#FFFFFF"), ambient=0.05, diffuse=1.0, specular=1.0, reflection=0.5,):
self.color = color
self.ambient = ambient
self.diffuse = diffuse
self.specular = specular
self.reflection = reflection
def colorBlendingProperties(self, position):
return self.color
class MaterialCheckered:
def __init__(self, color1 = Color.HexToRgb("#FFFFFF"), color2 = Color.HexToRgb("#000000"), ambient=0.05, diffuse=1.0, specular=1.0, reflection=0.5):
self.color1 = color1
self.color2 = color2
self.ambient = ambient
self.diffuse = diffuse
self.specular = specular
self.reflection = reflection
def colorBlendingProperties(self, position):
if math.floor((position.x + 5.0) * 3.0) % 2 == int(position.z * 3.0) % 2:
return self.color1
else:
return self.color2