X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=shaders%2Fcharacter.h;fp=shaders%2Fcharacter.h;h=e592a94cddb753285badc6a66d3906bee818150d;hb=6d66c67945f84476d6ac75a0497007cc30bcf58c;hp=83fdff36ff5ff1fd1369e0591b7c2cc35fd40857;hpb=d8b8c566831e15ef061a66409e1219f44a82097a;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/shaders/character.h b/shaders/character.h index 83fdff3..e592a94 100644 --- a/shaders/character.h +++ b/shaders/character.h @@ -24,6 +24,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,7 +36,8 @@ 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" ""}, @@ -53,6 +55,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 +111,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 +156,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"