a lot
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / character.h
index 83fdff36ff5ff1fd1369e0591b7c2cc35fd40857..e592a94cddb753285badc6a66d3906bee818150d 100644 (file)
@@ -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"