<commit_before># Cook-Torance for diffuseType and Blinn-Phong
# Figure out specular and frensel stuff
# Emission?
# Need to setup so it can send outputs to a shader
# Inputs need to be defined a lot better
from ed2d import texture
from ed2d import files

class Material(object):
    def __init__(self, program):
        self.diffuse = None
        self.idiffuse = 0 # Intensity parameter

        self.ambient = None
        self.iambient = 0 # Intensity parameter

        self.specular = None
        self.roughness = None

        # This is the diffuse texture
        self.albedo = None

        self.diffuseType = None
        self.specularType = None

        self.normalMap = None
        self.specularMap = None
        self.displacementMap = None

        # Assign the shader that will render the Material
        self.program = program

    def setDiffuseColor(self, r, g, b, intensity):
        ''' Sets the diffuse color of a material. '''
        self.diffuse = [r, g, b]
        self.idiffuse = intensity

    def setAmbientColor(self, r, g, b, intensity):
        ''' Sets the ambient color of a material. '''
        self.ambient = [r, g, b]
        self.iambient = intensity

    def setSpecularColor(self, r, g, b, roughness):
        ''' Sets the specular color and roughness of a material. '''
        self.specular = [r, g, b]
        self.roughness = roughness

    def setDiffuseType(self, shader):
        pass

    def setSpecularType(self, shader):
        pass

    def addTextures(self, textureDict):
        # This will replace the crap underneath this function
        pass

    # This will replace the texture assignment via Mesh class
    def addTexture(self, textureFileName):
        ''' This sets the diffuse albeo/texture of the material. '''
        imagePath = files.resolve_path('data', 'images', textureFileName)
        self.albedo = texture.Texture(imagePath, self.program)

    def addNormalMap(self, textureFileName):
        imagePath = files.resolve_path('data', 'images', textureFileName)
        self.normalMap = texture.Texture(imagePath, self.program)

    def addSpecularMap(self, textureFileName):
        imagePath = files.resolve_path('data', 'images', textureFileName)
        self.specularMap = texture.Texture(imagePath, self.program)

    def addDisplacementMap(self, textureFileName):
        imagePath = files.resolve_path('data', 'images', textureFileName)
        self.displacementMap = texture.Texture(imagePath, self.program)<commit_msg>Material Class update. Using a dict to load textures.<commit_after># Cook-Torance for diffuseType and Blinn-Phong
# Figure out specular and frensel stuff
# Emission?
# Need to setup so it can send outputs to a shader
# Inputs need to be defined a lot better
from ed2d import texture
from ed2d import files

class Material(object):
    def __init__(self, program):
        self.diffuse = None
        self.idiffuse = 0 # Intensity parameter

        self.ambient = None
        self.iambient = 0 # Intensity parameter

        self.specular = None
        self.roughness = None

        # This is the diffuse textures
        self.albedoLayers = {}

        self.diffuseType = None
        self.specularType = None

        self.normalMap = None
        self.specularMap = None
        self.displacementMap = None

        # Assign the shader that will render the Material
        self.program = program

    def setDiffuseColor(self, r, g, b, intensity):
        ''' Sets the diffuse color of a material. '''
        self.diffuse = [r, g, b]
        self.idiffuse = intensity

    def setAmbientColor(self, r, g, b, intensity):
        ''' Sets the ambient color of a material. '''
        self.ambient = [r, g, b]
        self.iambient = intensity

    def setSpecularColor(self, r, g, b, roughness):
        ''' Sets the specular color and roughness of a material. '''
        self.specular = [r, g, b]
        self.roughness = roughness

    def setDiffuseType(self, shader):
        pass

    def setSpecularType(self, shader):
        pass

    def addTextures(self, textureDict):
        # Format is {A: [albedo0, albedo1, ...], N: [normal1, normal2, ...], S: [specular1, specular2, ...]}
        # This will replace the crap underneath this function
        for key, value in textureDict.iteritems():
            if key is 'A':
                for i in range(len(value)):
                    imagePath = files.resolve_path('data', 'images', value[i])
                    self.albedoLayers['Layer' + i] = texture.Texture(imagePath, self.program)
            if key is 'N':
                for i in range(len(value)):
                    imagePath = files.resolve_path('data', 'images', value[i])
                    self.normalMapLayers['Layer' + i] = texture.Texture(imagePath, self.program)
            if key is 'S':
                for i in range(len(value)):
                    imagePath = files.resolve_path('data', 'images', value[i])
                    self.specularMapLayers['Layer' + i] = texture.Texture(imagePath, self.program)
{'fraction_non_alphanumeric': 0.09528526148969889, 'fraction_numerical': 0.0027733755942947703, 'mean_word_length': 2.4091829844699526, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 2, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4070703', 'n_tokens_mistral': 1462, 'n_tokens_neox': 1384, 'n_words': 460}