{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "Shader Asset",
    "description": "The asset.json file for shaders.",
    "type": "object",
    "properties": {
        "asset_type": {
            "type": "string",
            "pattern": "shader"
        },
        "vert_source": {
            "description": "The source file for the GLSL vertex shader, relative to the current asset path. Defaults to vert.glsl",
            "type": "string"
        },
        "frag_source": {
            "description": "The source file for the GLSL frragment shader, relative to the current asset path. Defaults to frag.glsl",
            "type": "string"
        },
        "location_attribute_glsl_name": {
            "description": "The name of the vertex location attribute",
            "type": "string",
            "pattern": "\\w+"
        },
        "vertex_attributes": {
            "description": "The vertex attributes that this shader expects. These are to be added to a mesh.",
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "name": {
                        "description": "The name of the attribute in the mesh.",
                        "type": "string"
                    },
                    "glsl_name": {
                        "description": "The name of the attribute in GLSL",
                        "type": "string",
                        "pattern": "\\w+"
                    },
                    "type": {
                        "description": "The type of the data",
                        "type": "string",
                        "pattern": "int|float|vec2|vec3|vec4"
                    }
                },
                "required": [
                    "name",
                    "glsl_id",
                    "type"
                ]
            }
        },
        "parameters": {
            "description": "The parameters (uniforms in GLSL) for the shader.",
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "type": {
                        "description": "The type of the object",
                        "type": "string",
                        "pattern": "int|float|vec2|vec3|vec4|texture"
                    },
                    "glsl_name": {
                        "description": "The name of the uniorm in GLSL",
                        "type": "string",
                        "pattern": "\\w+"
                    },
                    "glsl_offset": {
                        "description": "The offset from the uniorm location fetched by glsl_name. Used for arrays, 0 by default",
                        "type": "integer",
                        "minimum": 0
                    },
                    "name": {
                        "description": "The name that will be exposed to the interface",
                        "type": "string"
                    },
                    "default": {
                        "description": "The default value for the parameter",
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "array",
                                "items": {
                                    "type": "number"
                                },
                                "minItems": 2,
                                "maxItems": 4
                            },
                            {
                                "type": "number"
                            }
                        ]
                    },
                    "description": {
                        "description": "A description of the parameter",
                        "type": "string"
                    }
                },
                "required": [
                    "type",
                    "glsl_name",
                    "name",
                    "defualt"
                ]
            }
        }
    },
    "required": [
        "asset_type"
    ]
}