update model format
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / character.h
index 83fdff36ff5ff1fd1369e0591b7c2cc35fd40857..8265c37ba44489da271579bcb814a364aba59408 100644 (file)
@@ -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"