X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=shaders%2Fmodel_font.h;h=e3361ab8c6e91d199d9a3313416167472e7befae;hb=825c3bce18272c0f81659e0eac469709d0462836;hp=7de7971be0a42c9a34ed4453af9fa981d53c69b3;hpb=d6171f1c56789b2ca79efa3313fbbf74a13bda7a;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/shaders/model_font.h b/shaders/model_font.h index 7de7971..e3361ab 100644 --- a/shaders/model_font.h +++ b/shaders/model_font.h @@ -12,9 +12,6 @@ static struct vg_shader _shader_model_font = { "layout (location=0) in vec3 a_co;\n" "layout (location=1) in vec3 a_norm;\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 1 1 \n" "const float k_motion_lerp_amount = 0.01;\n" @@ -34,22 +31,21 @@ static struct vg_shader _shader_model_font = { " aMotionVec1 = vec3( vproj1.xy, vproj1.w );\n" "}\n" "\n" -"#line 9 0 \n" +"#line 6 0 \n" "\n" "uniform mat4x3 uMdl;\n" "uniform mat4 uPv;\n" "uniform mat4 uPvmPrev;\n" -"uniform vec3 uOffset;\n" +"uniform vec4 uOffset;\n" "\n" -"out vec4 aColour;\n" "out vec2 aUv;\n" -"out vec3 aNorm;\n" +"out vec4 aNorm;\n" "out vec3 aCo;\n" "out vec3 aWorldCo;\n" "\n" "void main()\n" "{\n" -" vec3 co = a_co+uOffset;\n" +" vec3 co = a_co*uOffset.w+uOffset.xyz;\n" " vec3 world_pos0 = uMdl * vec4( co, 1.0 );\n" " vec4 vproj0 = uPv * vec4( world_pos0, 1.0 );\n" " vec4 vproj1 = uPvmPrev * vec4( co, 1.0 );\n" @@ -57,25 +53,24 @@ static struct vg_shader _shader_model_font = { " vs_motion_out( vproj0, vproj1 );\n" "\n" " gl_Position = vproj0;\n" -" aWorldCo = world_pos0;\n" -" aColour = a_colour;\n" +"\n" " aUv = a_uv;\n" -" aNorm = mat3(uMdl) * a_norm;\n" -" aCo = a_co;\n" +" aNorm = vec4( mat3(uMdl) * a_norm, 0.0 );\n" +" aCo = co;\n" +" aWorldCo = world_pos0;\n" "}\n" ""}, .fs = { .orig_file = "shaders/model_font.fs", .static_src = -"out vec4 FragColor;\n" +"layout (location = 0) out vec4 oColour;\n" "\n" "uniform sampler2D uTexMain;\n" "uniform vec4 uColour;\n" "\n" -"in vec4 aColour;\n" "in vec2 aUv;\n" -"in vec3 aNorm;\n" +"in vec4 aNorm;\n" "in vec3 aCo;\n" "\n" "#line 1 1 \n" @@ -97,13 +92,12 @@ static struct vg_shader _shader_model_font = { " oMotionVec = (vmotion1-vmotion0) * (1.0/k_motion_lerp_amount);\n" "}\n" "\n" -"#line 12 0 \n" +"#line 11 0 \n" "\n" "void main()\n" "{\n" " compute_motion_vectors();\n" -" vec4 diffuse = texture( uTexMain, aUv );\n" -" FragColor = vec4( diffuse.rgb, 1.0 ) * uColour;\n" +" oColour = texture( uTexMain, aUv ) * uColour;\n" "}\n" ""}, }; @@ -123,8 +117,8 @@ static void shader_model_font_uPv(m4x4f m){ static void shader_model_font_uPvmPrev(m4x4f m){ glUniformMatrix4fv(_uniform_model_font_uPvmPrev,1,GL_FALSE,(float*)m); } -static void shader_model_font_uOffset(v3f v){ - glUniform3fv(_uniform_model_font_uOffset,1,v); +static void shader_model_font_uOffset(v4f v){ + glUniform4fv(_uniform_model_font_uOffset,1,v); } static void shader_model_font_uTexMain(int i){ glUniform1i(_uniform_model_font_uTexMain,i);