X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=shaders%2Froute.h;h=6ee4761560e7649bdc36843292e987517c58eb3f;hb=d8fc0acce1b39466038284aa6f1941ebe98c8348;hp=650f8a957d0f583fb59567518ff3ed16b4e3cdb8;hpb=1030b1e134d422a3cbc1e06102053447da59ceba;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/shaders/route.h b/shaders/route.h index 650f8a9..6ee4761 100644 --- a/shaders/route.h +++ b/shaders/route.h @@ -7,17 +7,19 @@ static struct vg_shader _shader_route = { .link = shader_route_link, .vs = { -.orig_file = "../shaders/standard.vs", +.orig_file = "../../shaders/standard.vs", .static_src = "layout (location=0) in vec3 a_co;\n" "layout (location=1) in vec3 a_norm;\n" -"layout (location=2) in vec4 a_colour;\n" -"layout (location=3) in vec2 a_uv;\n" +"layout (location=2) in vec2 a_uv;\n" +"layout (location=3) in vec4 a_colour;\n" +"layout (location=4) in vec4 a_weights;\n" +"layout (location=5) in ivec4 a_groups;\n" "\n" "#line 2 0 \n" "\n" -"uniform mat4 uPv;\n" "uniform mat4x3 uMdl;\n" +"uniform mat4 uPv;\n" "\n" "out vec4 aColour;\n" "out vec2 aUv;\n" @@ -38,7 +40,7 @@ static struct vg_shader _shader_route = { ""}, .fs = { -.orig_file = "../shaders/route.fs", +.orig_file = "../../shaders/route.fs", .static_src = "out vec4 FragColor;\n" "\n" @@ -65,6 +67,7 @@ static struct vg_shader _shader_route = { " float g_water_fog;\n" " int g_light_count;\n" " int g_light_preview;\n" +" int g_shadow_samples;\n" "};\n" "\n" "uniform sampler2D g_world_depth;\n" @@ -129,6 +132,11 @@ static struct vg_shader _shader_route = { "\n" "vec3 do_light_shadowing( vec3 vfrag )\n" "{\n" +" if( g_shadow_samples == 0 )\n" +" {\n" +" return vfrag;\n" +" }\n" +"\n" " float fspread = g_light_colours[0].w;\n" " vec3 vdir = g_light_directions[0].xyz;\n" " float flength = g_light_directions[0].w;\n" @@ -197,19 +205,19 @@ static struct vg_shader _shader_route = { ""}, }; -static GLuint _uniform_route_uPv; static GLuint _uniform_route_uMdl; +static GLuint _uniform_route_uPv; static GLuint _uniform_route_uTexGarbage; static GLuint _uniform_route_uTexGradients; static GLuint _uniform_route_uCamera; static GLuint _uniform_route_uColour; static GLuint _uniform_route_g_world_depth; -static void shader_route_uPv(m4x4f m){ - glUniformMatrix4fv( _uniform_route_uPv, 1, GL_FALSE, (float *)m ); -} static void shader_route_uMdl(m4x3f m){ glUniformMatrix4x3fv( _uniform_route_uMdl, 1, GL_FALSE, (float *)m ); } +static void shader_route_uPv(m4x4f m){ + glUniformMatrix4fv( _uniform_route_uPv, 1, GL_FALSE, (float *)m ); +} static void shader_route_uTexGarbage(int i){ glUniform1i( _uniform_route_uTexGarbage, i ); } @@ -230,8 +238,8 @@ static void shader_route_register(void){ } static void shader_route_use(void){ glUseProgram(_shader_route.id); } static void shader_route_link(void){ - _uniform_route_uPv = glGetUniformLocation( _shader_route.id, "uPv" ); _uniform_route_uMdl = glGetUniformLocation( _shader_route.id, "uMdl" ); + _uniform_route_uPv = glGetUniformLocation( _shader_route.id, "uPv" ); _uniform_route_uTexGarbage = glGetUniformLocation( _shader_route.id, "uTexGarbage" ); _uniform_route_uTexGradients = glGetUniformLocation( _shader_route.id, "uTexGradients" ); _uniform_route_uCamera = glGetUniformLocation( _shader_route.id, "uCamera" );