def _unparse_material(material):
    '\n    Turn a trimesh material into a COLLADA material.\n    '
    if isinstance(material, visual.material.PBRMaterial):
        diffuse = material.baseColorFactor
        if (diffuse is not None):
            diffuse = list(diffuse)
        emission = material.emissiveFactor
        if (emission is not None):
            emission = [float(emission[0]), float(emission[1]), float(emission[2]), 1.0]
        shininess = material.roughnessFactor
        if (shininess is not None):
            shininess = ((2.0 / (shininess ** 2)) - 2.0)
        effect = collada.material.Effect(uuid.uuid4().hex, params=[], shadingtype='phong', diffuse=diffuse, emission=emission, specular=[1.0, 1.0, 1.0, 1.0], shininess=float(shininess))
        material = collada.material.Material(uuid.uuid4().hex, 'pbrmaterial', effect)
    else:
        effect = collada.material.Effect(uuid.uuid4().hex, params=[], shadingtype='phong')
        material = collada.material.Material(uuid.uuid4().hex, 'defaultmaterial', effect)
    return material
Turn a trimesh material into a COLLADA material.
def _unparse_material(material):
    '\n    \n    '
    if isinstance(material, visual.material.PBRMaterial):
        diffuse = material.baseColorFactor
        if (diffuse is not None):
            diffuse = list(diffuse)
        emission = material.emissiveFactor
        if (emission is not None):
            emission = [float(emission[0]), float(emission[1]), float(emission[2]), 1.0]
        shininess = material.roughnessFactor
        if (shininess is not None):
            shininess = ((2.0 / (shininess ** 2)) - 2.0)
        effect = collada.material.Effect(uuid.uuid4().hex, params=[], shadingtype='phong', diffuse=diffuse, emission=emission, specular=[1.0, 1.0, 1.0, 1.0], shininess=float(shininess))
        material = collada.material.Material(uuid.uuid4().hex, 'pbrmaterial', effect)
    else:
        effect = collada.material.Effect(uuid.uuid4().hex, params=[], shadingtype='phong')
        material = collada.material.Material(uuid.uuid4().hex, 'defaultmaterial', effect)
    return material