-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCheckerboardMaterial.py
More file actions
37 lines (30 loc) · 965 Bytes
/
CheckerboardMaterial.py
File metadata and controls
37 lines (30 loc) · 965 Bytes
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
from Vector import *
from Phongfarbe import *
class CheckerboardMaterial(object):
"""
"""
def __init__(self):
"""
"""
self.baseColor =Phongfarbe(255, 255, 255)
self.otherColor = Phongfarbe(0, 0, 0)
self.ambienteCoefficient = 1.0
self.diffuseCoefficient = 0.6
self.spectacularCoeffizient = 0.2
self.checkSize = 1
self.phongmaterial= Phongmaterial(self.ambienteCoefficient, self.diffuseCoefficient, self.spectacularCoeffizient,2)
def colorAtPoint(self, p):
"""
:param p:
:return:
"""
v = p
v.scale(1.0/self.checkSize)
if(int(abs(v.array[0]) + 0.5) + int(abs(v.array[1])+0.5) + int(abs(v.array[2])+0.5)) %2:
return self.otherColor
return self.baseColor
def getPhongmaterial(self):
"""
:return:
"""
return self.phongmaterial()