|
1
|
|
|
# Cook-Torance for diffuseType and Blinn-Phong |
|
2
|
|
|
# Figure out specular and frensel stuff |
|
3
|
|
|
# Emission? |
|
4
|
|
|
# Need to setup so it can send outputs to a shader |
|
5
|
|
|
# Inputs need to be defined a lot better |
|
6
|
|
|
class Material(object): |
|
7
|
|
|
def __init__(self): |
|
8
|
|
|
self.diffuse = None |
|
9
|
|
|
self.idiffuse = 0 # Intensity parameter |
|
10
|
|
|
|
|
11
|
|
|
self.ambient = None |
|
12
|
|
|
self.iambient = 0 # Intensity parameter |
|
13
|
|
|
|
|
14
|
|
|
self.specular = None |
|
15
|
|
|
self.roughness = None |
|
16
|
|
|
|
|
17
|
|
|
self.albedo = None |
|
18
|
|
|
|
|
19
|
|
|
self.diffuseType = None |
|
20
|
|
|
self.specularType = None |
|
21
|
|
|
|
|
22
|
|
|
self.normalMap = None |
|
23
|
|
|
self.specularMap = None |
|
24
|
|
|
self.displacementMap = None |
|
25
|
|
|
|
|
26
|
|
|
# Not sure if this is needed yet |
|
27
|
|
|
self.shader = None |
|
28
|
|
|
|
|
29
|
|
|
def setDiffuseColor(self, r, g, b, intensity): |
|
30
|
|
|
''' Sets the diffuse color of a material. ''' |
|
31
|
|
|
self.diffuse = [r, g, b] |
|
32
|
|
|
self.idiffuse = intensity |
|
33
|
|
|
|
|
34
|
|
|
def setAmbientColor(self, r, g, b, intensity): |
|
35
|
|
|
''' Sets the ambient color of a material. ''' |
|
36
|
|
|
self.ambient = [r, g, b] |
|
37
|
|
|
self.iambient = intensity |
|
38
|
|
|
|
|
39
|
|
|
def setSpecularColor(self, r, g, b, roughness): |
|
40
|
|
|
''' Sets the specular color and roughness of a material. ''' |
|
41
|
|
|
self.specular = [r, g, b] |
|
42
|
|
|
self.roughness = roughness |
|
43
|
|
|
|
|
44
|
|
|
def diffuseType(self, shader): |
|
45
|
|
|
pass |
|
46
|
|
|
|
|
47
|
|
|
def specularType(self, shader): |
|
48
|
|
|
pass |
|
49
|
|
|
|
|
50
|
|
|
# This will replace the texture assignment via Mesh class |
|
51
|
|
|
def addTexture(self, texture): |
|
52
|
|
|
''' This sets the diffuse albeo/texture of the material. ''' |
|
53
|
|
|
self.albedo = texture |
|
54
|
|
|
|