X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=shaders%2Fscene_depth.fs;h=d805441c70a0a1fb0d0776d0376e4104048282ed;hb=refs%2Fheads%2Fmaster;hp=05d886bf1d0069b87a5a30184b5ce93986475953;hpb=aa4c26eae2208872824e0eb5b71bc05c16d43242;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/shaders/scene_depth.fs b/shaders/scene_depth.fs index 05d886b..d805441 100644 --- a/shaders/scene_depth.fs +++ b/shaders/scene_depth.fs @@ -4,13 +4,8 @@ uniform vec3 uCamera; uniform vec3 uBoard0; uniform vec3 uBoard1; -in vec2 aUv; -in vec4 aNorm; -in vec3 aCo; -in vec3 aWorldCo; -flat in ivec4 aLights; - -#include "common_world.glsl" +#include "light_clearskies_stddef.glsl" +#include "common_scene.glsl" // Water blending // ============== @@ -22,12 +17,14 @@ float water_depth( vec3 pos, vec3 halfview ) float d = dot( pnorm, halfview ); float t = dot((pnorm*pdist - pos), pnorm) / d; + + // TODO: Make g_water_fog a material param return t * g_water_fog; } void main() { - vec3 halfview = normalize( uCamera - aCo ); - vec3 world_pos = vec3( aCo.y, aCo.x, aCo.z ); - FragColor = vec4( world_pos, water_depth( aCo, halfview ) ); + vec3 halfview = normalize( uCamera - aWorldCo ); + float depth = water_depth( aWorldCo, halfview ); + FragColor = vec4( depth, 0.0, 0.0, 0.0 ); }