X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=shaders%2Fplaneinf.h;h=1054aa4541d76b54456c4cfe5c9755e9dde7d9d4;hb=60b0d8af679396c857f8c5f9a7a518b092a2f416;hp=0cc17cd2ec95e1e59464994855efeb6414264b79;hpb=3bb0287d544a4cb75de9afe2927ac8e946f3a18e;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/shaders/planeinf.h b/shaders/planeinf.h index 0cc17cd..1054aa4 100644 --- a/shaders/planeinf.h +++ b/shaders/planeinf.h @@ -7,7 +7,7 @@ static struct vg_shader _shader_planeinf = { .link = shader_planeinf_link, .vs = { -.orig_file = "../shaders/standard.vs", +.orig_file = "../../shaders/standard.vs", .static_src = "layout (location=0) in vec3 a_co;\n" "layout (location=1) in vec3 a_norm;\n" @@ -23,42 +23,23 @@ static struct vg_shader _shader_planeinf = { "out vec2 aUv;\n" "out vec3 aNorm;\n" "out vec3 aCo;\n" +"out vec3 aWorldCo;\n" "\n" "void main()\n" "{\n" -" gl_Position = uPv * vec4( uMdl * vec4(a_co,1.0), 1.0 );\n" +" vec3 world_pos = uMdl * vec4(a_co,1.0);\n" +" gl_Position = uPv * vec4( world_pos, 1.0 );\n" " aColour = a_colour;\n" " aUv = a_uv;\n" " aNorm = mat3(uMdl) * a_norm;\n" " aCo = a_co;\n" +" aWorldCo = world_pos;\n" "}\n" ""}, .fs = { -.orig_file = "../shaders/planeinf.fs", +.orig_file = "../../shaders/planeinf.fs", .static_src = -"vec4 water_surf( vec3 halfview, vec3 vnorm, float depthvalue, \n" -" vec4 beneath, vec4 above )\n" -"{\n" -" vec3 colour_shore = vec3( 0.21, 0.6, 0.8 );\n" -" vec3 colour_ocean = vec3( 0.01, 0.1, 0.2 );\n" -" vec3 surface_tint = mix(colour_shore, colour_ocean, depthvalue);\n" -"\n" -" float ffresnel = pow(1.0-dot( vnorm, halfview ),5.0);\n" -"\n" -" vec3 lightdir = vec3(0.95,0.0,-0.3);\n" -" vec3 specdir = reflect( -lightdir, vnorm );\n" -" float spec = pow(max(dot(halfview,specdir),0.0),20.0)*0.3;\n" -" \n" -" // Depth \n" -" float depthblend = pow( beneath.a,0.8 );\n" -"\n" -" // Composite\n" -" vec3 vsurface = mix(surface_tint, above.rgb, ffresnel );\n" -" //vsurface += spec;\n" -"\n" -" return vec4( vsurface,depthblend );\n" -"}\n" "\n" "#line 2 0 \n" "\n"