Skip to content

着色器程序定义文件规范(Shader Program Defination File Specification)

Mouse edited this page Oct 7, 2019 · 2 revisions

shader.json

{
    "Parent": "<继承的着色器文件>",
    "Enable": ["<启用的GL功能>"],
    "Blend": {
        "SFactor": "",
        "DFactor": ""
    },
    "CullFace": "",
    "Vertex": "<顶点着色器文件名或着色器预处理JavaScript文件名>",
    "Fragment": "<片元着色器文件名或着色器预处理JavaScript文件名>"
}

示例Shader(world.json):

{
    "Parent": "default.json",
    "Enable": ["CULL_FACE", "DEPTH_TEST", "BLEND", "TEXTURE0"],
    "Blend": {
        "SFactor": "SRC_ALPHA",
        "DFactor": "ONE_MINUS_SRC_ALPHA"
    },
    "CullFace": "BACK",
    "Vertex": "world.vert",
    "Fragment": "world.frag"
}