X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=shaders%2Froute.h;h=44fc21316d4845fe5c6addc404e4842d5a163924;hb=3d8eaabcfd3b87fb52127eaa1241673e8d197bea;hp=cbdbeb44740e3a835d31b62001c346f1b7308adb;hpb=60b0d8af679396c857f8c5f9a7a518b092a2f416;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/shaders/route.h b/shaders/route.h index cbdbeb4..44fc213 100644 --- a/shaders/route.h +++ b/shaders/route.h @@ -7,17 +7,18 @@ static struct vg_shader _shader_route = { .link = shader_route_link, .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 +39,6 @@ static struct vg_shader _shader_route = { ""}, .fs = { -.orig_file = "../../shaders/route.fs", .static_src = "out vec4 FragColor;\n" "\n" @@ -65,6 +65,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 +130,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,41 +203,41 @@ 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 ); + 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 ); + glUniform1i(_uniform_route_uTexGarbage,i); } static void shader_route_uTexGradients(int i){ - glUniform1i( _uniform_route_uTexGradients, i ); + glUniform1i(_uniform_route_uTexGradients,i); } static void shader_route_uCamera(v3f v){ - glUniform3fv( _uniform_route_uCamera, 1, v ); + glUniform3fv(_uniform_route_uCamera,1,v); } static void shader_route_uColour(v4f v){ - glUniform4fv( _uniform_route_uColour, 1, v ); + glUniform4fv(_uniform_route_uColour,1,v); } static void shader_route_g_world_depth(int i){ - glUniform1i( _uniform_route_g_world_depth, i ); + glUniform1i(_uniform_route_g_world_depth,i); } static void shader_route_register(void){ vg_shader_register( &_shader_route ); } 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" );