def _load_shader_str(shaderpath, defines=None):
    """
    Load the shader as string from the shaders dir (instead of shaders.py)
    Args:
        shaderpath:
        defines:

    Returns:

    """
    if shaders:
        shaderstr = shaders[shaderpath]
    else:
        shader_dir = os.path.join(os.path.dirname(__file__), 'shaders')

        with open(os.path.join(shader_dir, shaderpath + ".glsl")) as shaderfile:
            shaderstr = shaderfile.read()

    if defines is None:
        defines = {}

    defines['p3d_TextureBaseColor'] = 'p3d_TextureModulate'
    defines['p3d_TextureMetalRoughness'] = 'p3d_TextureSelector'
    defines['p3d_TextureNormal'] = 'p3d_TextureNormal'
    defines['p3d_TextureEmission'] = 'p3d_TextureEmission'

    shaderstr = _add_shader_defines(shaderstr, defines)

    if 'USE_330' in defines:
        shaderstr = shaderstr.replace('#version 120', '#version 330')
        if shaderpath.endswith('vert'):
            shaderstr = shaderstr.replace('varying ', 'out ')
            shaderstr = shaderstr.replace('attribute ', 'in ')
        else:
            shaderstr = shaderstr.replace('varying ', 'in ')

    return shaderstr

    Load the shader as string from the shaders dir (instead of shaders.py)
    Args:
        shaderpath:
        defines:

    Returns:

    
metadrive/third_party/simplepbr/__init__.py