<commit_before>from copy import copy
from cycgkit.cgtypes import *


class Material(object):
    def __init__(self):
        self._ID = ""
        self._difCol = vec4(.5, .5, .5, 1.0)
        self.emissiveColor = vec4(0.0, 0.0, 0.0, 1.0)
        self.specularColor = vec4(1.0, 1.0, 1.0, 1.0)
        self.specularPower = 40.0
        self._shaderID = "default"
        self.textureRepeat = 1.0
        self.diffuseTextureID = ""
        self.specularMapTextureID = ""
        self.emissiveMapTextureID = ""
        self.lightMapTextureID = ""
        self.normalMapTextureID = ""
        self.opacity = 1
        self.useDiffuseTexture = False
        self.useNormalMapTexture = False
        self.upSideDownTextures = False
        self.useSpecularMapTexture = False
        self.useEmissiveMapTexture = False
        self.useLightMapTexture = False
        self.isLightAffected = True
        self.uvOffset = (0, 0)

        self._shaderProps = ShaderPropertiesList()

    def setDefaultNormalMap(self):
        self.normalMapTextureID = '_defaultNM'
        self.useNormalMapTexture = True

    def _getShaderProps(self):
        return self._shaderProps

    shaderProperties = property(_getShaderProps)

    def _setDiffCol(self, value):
        """

        @type value: vec4
        """
        if isinstance(value, vec4):
            nvalue = value
        elif isinstance(value, list):
            nvalue = list(value)
            while len(nvalue) != 4:
                nvalue.append(value[0])
        elif isinstance(value, (int, float)):
            nvalue = [value] * 4
        else:
            raise TypeError('type {} not supported for color assigment'.format(str(type(value))))

        self._difCol = nvalue

    def _getDiffCol(self):
        return self._difCol

    diffuseColor = property(_getDiffCol, _setDiffCol, doc='Diffuse Color passed to the shader')<commit_msg>Store color always as vec4.<commit_after>from copy import copy
from cycgkit.cgtypes import *


class Material(object):
    def __init__(self):
        self._ID = ""
        self._difCol = vec4(.5, .5, .5, 1.0)
        self._emCol = vec4(0.0, 0.0, 0.0, 1.0)
        self._specCol = vec4(1.0, 1.0, 1.0, 1.0)
        self.specularPower = 40.0
        self._shaderID = "default"
        self.textureRepeat = 1.0
        self.diffuseTextureID = ""
        self.specularMapTextureID = ""
        self.emissiveMapTextureID = ""
        self.lightMapTextureID = ""
        self.normalMapTextureID = ""
        self.opacity = 1
        self.useDiffuseTexture = False
        self.useNormalMapTexture = False
        self.upSideDownTextures = False
        self.useSpecularMapTexture = False
        self.useEmissiveMapTexture = False
        self.useLightMapTexture = False
        self.isLightAffected = True
        self.uvOffset = (0, 0)

        self._shaderProps = ShaderPropertiesList()

    def setDefaultNormalMap(self):
        self.normalMapTextureID = '_defaultNM'
        self.useNormalMapTexture = True

    def _getShaderProps(self):
        return self._shaderProps

    shaderProperties = property(_getShaderProps)

    def _setDiffCol(self, value):
        self._difCol = Material._checkColor(value)

    def _getDiffCol(self):
        return self._difCol

    diffuseColor = property(_getDiffCol, _setDiffCol, doc='Diffuse color passed to the shader')

    def _setEmCol(self, value):
        self._emCol = Material._checkColor(value)

    def _getEmCol(self):
        return self._emCol

    emissiveColor = property(_getEmCol, _setEmCol, doc='Emissive color passed to the shader')

    def _setSpecCol(self, value):
        self._emCol = Material._checkColor(value)

    def _getSpecCol(self):
        return self._emCol

    specularColor = property(_getSpecCol, _setSpecCol, doc='Specular color passed to the shader')

    @staticmethod
    def _checkColor(value):
        if isinstance(value, vec4):
            nvalue = value
        elif isinstance(value, list):
            nvalue = list(value)
            while len(nvalue) != 4:
                nvalue.append(value[0])
        elif isinstance(value, (int, float)):
            nvalue = [value] * 4
        else:
            raise TypeError('type {} not supported for color assigment'.format(str(type(value))))

        return vec4(nvalue)
{'fraction_non_alphanumeric': 0.09960437514545031, 'fraction_numerical': 0.017454037700721434, 'mean_word_length': 2.3240525908739365, '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': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '233340', 'n_tokens_mistral': 1345, 'n_tokens_neox': 1283, 'n_words': 283}