X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=shaders%2Fcharacter.h;h=8265c37ba44489da271579bcb814a364aba59408;hb=c88172d6968a02a4e643b74cc419c0ac8168d92a;hp=83fdff36ff5ff1fd1369e0591b7c2cc35fd40857;hpb=168eb5c363f510d60703498e01ffcdb52bf9fd07;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/shaders/character.h b/shaders/character.h index 83fdff3..8265c37 100644 --- a/shaders/character.h +++ b/shaders/character.h @@ -7,12 +7,14 @@ static struct vg_shader _shader_character = { .link = shader_character_link, .vs = { -.orig_file = "../shaders/character.vs", +.orig_file = "../../shaders/character.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" @@ -24,6 +26,7 @@ static struct vg_shader _shader_character = { "out vec2 aUv;\n" "out vec3 aNorm;\n" "out vec3 aCo;\n" +"out vec3 aWorldCo;\n" "out float aOpacity;\n" "\n" "void main()\n" @@ -35,13 +38,14 @@ static struct vg_shader _shader_character = { " aColour = a_colour;\n" " aUv = a_uv;\n" " aNorm = mat3(uMdl) * a_norm;\n" -" aCo = world_pos;\n" +" aWorldCo = world_pos;\n" +" aCo = a_co;\n" " aOpacity = max(clip_pos.w*3.0,0.1);// 1.0-(gl_Position.y+0.5)*uOpacity;\n" "}\n" ""}, .fs = { -.orig_file = "../shaders/character.fs", +.orig_file = "../../shaders/character.fs", .static_src = "out vec4 FragColor;\n" "\n" @@ -53,6 +57,7 @@ static struct vg_shader _shader_character = { "in vec2 aUv;\n" "in vec3 aNorm;\n" "in vec3 aCo;\n" +"in vec3 aWorldCo;\n" "in float aOpacity;\n" "\n" "#line 1 1 \n" @@ -108,7 +113,7 @@ static struct vg_shader _shader_character = { "\n" "float shadow_sample( vec3 vdir )\n" "{\n" -" vec3 sample_pos = aCo + vdir;\n" +" vec3 sample_pos = aWorldCo + vdir;\n" " float height_sample = world_depth_sample( sample_pos );\n" "\n" " float fdelta = height_sample - sample_pos.y;\n" @@ -153,14 +158,14 @@ static struct vg_shader _shader_character = { " return mix( vfrag, vec3(0.55,0.76,1.0), min( 1.0, dist ) );\n" "}\n" "\n" -"#line 14 0 \n" +"#line 15 0 \n" "\n" "void main()\n" "{\n" " vec3 vfrag = texture( uTexMain, aUv ).rgb;\n" "\n" " // Lighting\n" -" vec3 halfview = uCamera - aCo;\n" +" vec3 halfview = uCamera - aWorldCo;\n" " float fdist = length( halfview );\n" " halfview /= fdist;\n" "\n"