#pragma once

inline const char* vertT = R"(
    #version 330 core

    layout (location = 0) in vec3 position;
    layout (location = 1) in vec4 color;
    layout (location = 2) in vec2 uv;
    layout (location = 3) in float tid;


    uniform mat4 prMatrix;
    uniform mat4 camMatrix;

    out DATA
    {
        vec4 color_out;
        vec2 uv_out;
        float tid_out;
    } vs_out;


    void main()
    {
        gl_Position = prMatrix * camMatrix * vec4(position.x, position.y, position.z, 1.0);
        vs_out.color_out = color;
        vs_out.uv_out = uv;
        vs_out.tid_out = tid;
    }
)";

inline const char* fragT = R"(
    #version 330 core
    layout (location = 0) out vec4 color;

    uniform sampler2D textures[32];

    in DATA
    {
        vec4 color_out;
        vec2 uv_out;
        float tid_out;
    } fs_in;
    void main()
    {
        vec4 texColor = vec4(0,0,0,0);
        int tid = int(fs_in.tid_out);
        switch(tid)
        {
            case 0:
                texColor = texture(textures[0], fs_in.uv_out);
                break;
            case 1:
                texColor = texture(textures[1], fs_in.uv_out);
                break;
            case 2:
                texColor = texture(textures[2], fs_in.uv_out);
                break;
            case 3:
                texColor = texture(textures[3], fs_in.uv_out);
                break;
            case 4:
                texColor = texture(textures[4], fs_in.uv_out);
                break;
            case 5:
                texColor = texture(textures[5], fs_in.uv_out);
                break;
            case 6:
                texColor = texture(textures[6], fs_in.uv_out);
                break;
            case 7:
                texColor = texture(textures[7], fs_in.uv_out);
                break;
            case 8:
                texColor = texture(textures[8], fs_in.uv_out);
                break;
            case 9:
                texColor = texture(textures[9], fs_in.uv_out);
                break;
            case 10:
                texColor = texture(textures[10], fs_in.uv_out);
                break;
            case 11:
                texColor = texture(textures[11], fs_in.uv_out);
                break;
            case 12:
                texColor = texture(textures[12], fs_in.uv_out);
                break;
            case 13:
                texColor = texture(textures[13], fs_in.uv_out);
                break;
            case 14:
                texColor = texture(textures[14], fs_in.uv_out);
                break;
            case 15:
                texColor = texture(textures[15], fs_in.uv_out);
                break;
            case 16:
                texColor = texture(textures[16], fs_in.uv_out);
                break;
            case 17:
                texColor = texture(textures[17], fs_in.uv_out);
                break;
            case 18:
                texColor = texture(textures[18], fs_in.uv_out);
                break;
            case 19:
                texColor = texture(textures[19], fs_in.uv_out);
                break;
            case 20:
                texColor = texture(textures[20], fs_in.uv_out);
                break;
            case 21:
                texColor = texture(textures[21], fs_in.uv_out);
                break;
            case 22:
                texColor = texture(textures[22], fs_in.uv_out);
                break;
            case 23:
                texColor = texture(textures[23], fs_in.uv_out);
                break;
            case 24:
                texColor = texture(textures[24], fs_in.uv_out);
                break;
            case 25:
                texColor = texture(textures[25], fs_in.uv_out);
                break;
            case 26:
                texColor = texture(textures[26], fs_in.uv_out);
                break;
            case 27:
                texColor = texture(textures[27], fs_in.uv_out);
                break;
            case 28:
                texColor = texture(textures[28], fs_in.uv_out);
                break;
            case 29:
                texColor = texture(textures[29], fs_in.uv_out);
                break;
            case 30:
                texColor = texture(textures[30], fs_in.uv_out);
                break;
            case 31:
                texColor = texture(textures[31], fs_in.uv_out);
                break;
            default:
                texColor = vec4(1,1,1,1);
                break;
        }
        vec4 res = texColor * fs_in.color_out;

        if(res.a < 0.1)
        {
            discard;
        }

        color = res;
    } 
)";
