From 1cf8383ebad534f74cf98feb2536f3bc47543fde Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Sun, 21 Jul 2019 18:57:25 +0100 Subject: [PATCH] Moved lighting uniforms into light.glsl --- voxygen/shaders/figure.frag | 10 ---------- voxygen/shaders/figure.vert | 10 ---------- voxygen/shaders/include/light.glsl | 10 ++++++++++ voxygen/shaders/terrain.frag | 10 ---------- voxygen/shaders/terrain.vert | 10 ---------- 5 files changed, 10 insertions(+), 40 deletions(-) diff --git a/voxygen/shaders/figure.frag b/voxygen/shaders/figure.frag index 57e776e56e..d797e12032 100644 --- a/voxygen/shaders/figure.frag +++ b/voxygen/shaders/figure.frag @@ -22,16 +22,6 @@ uniform u_bones { BoneData bones[16]; }; -struct Light { - vec4 light_pos; - vec4 light_col; -}; - -layout (std140) -uniform u_lights { - Light lights[32]; -}; - #include #include diff --git a/voxygen/shaders/figure.vert b/voxygen/shaders/figure.vert index 9bc98b1a4c..a33dc8004c 100644 --- a/voxygen/shaders/figure.vert +++ b/voxygen/shaders/figure.vert @@ -22,16 +22,6 @@ uniform u_bones { BoneData bones[16]; }; -struct Light { - vec4 light_pos; - vec4 light_col; -}; - -layout (std140) -uniform u_lights { - Light lights[32]; -}; - out vec3 f_pos; out vec3 f_norm; out vec3 f_col; diff --git a/voxygen/shaders/include/light.glsl b/voxygen/shaders/include/light.glsl index ff7c4089a7..43380077fe 100644 --- a/voxygen/shaders/include/light.glsl +++ b/voxygen/shaders/include/light.glsl @@ -1,3 +1,13 @@ +struct Light { + vec4 light_pos; + vec4 light_col; +}; + +layout (std140) +uniform u_lights { + Light lights[32]; +}; + float attenuation_strength(vec3 rpos) { return 1.0 / (rpos.x * rpos.x + rpos.y * rpos.y + rpos.z * rpos.z); } diff --git a/voxygen/shaders/terrain.frag b/voxygen/shaders/terrain.frag index f7dc38bd98..75bc338d6f 100644 --- a/voxygen/shaders/terrain.frag +++ b/voxygen/shaders/terrain.frag @@ -12,16 +12,6 @@ uniform u_locals { vec3 model_offs; }; -struct Light { - vec4 light_pos; - vec4 light_col; -}; - -layout (std140) -uniform u_lights { - Light lights[32]; -}; - out vec4 tgt_color; #include diff --git a/voxygen/shaders/terrain.vert b/voxygen/shaders/terrain.vert index c07432567b..7b1d416925 100644 --- a/voxygen/shaders/terrain.vert +++ b/voxygen/shaders/terrain.vert @@ -10,16 +10,6 @@ uniform u_locals { vec3 model_offs; }; -struct Light { - vec4 light_pos; - vec4 light_col; -}; - -layout (std140) -uniform u_lights { - Light lights[32]; -}; - out vec3 f_pos; flat out uint f_pos_norm; out vec3 f_col;