diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-01-13 10:05:44 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-01-13 10:05:44 +0000 |
commit | eb2094a1641c333a6e6f953e3b37aa962937cd59 (patch) | |
tree | 01908d3a3d5bf28a96784bbb2e931e46a53a5090 /gfx/gl/shaders/pointLight.vs | |
parent | Add model support for point lights (diff) | |
download | ilt-eb2094a1641c333a6e6f953e3b37aa962937cd59.tar.bz2 ilt-eb2094a1641c333a6e6f953e3b37aa962937cd59.tar.xz ilt-eb2094a1641c333a6e6f953e3b37aa962937cd59.zip |
Update point light shaders for instancing
Diffstat (limited to 'gfx/gl/shaders/pointLight.vs')
-rw-r--r-- | gfx/gl/shaders/pointLight.vs | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/gfx/gl/shaders/pointLight.vs b/gfx/gl/shaders/pointLight.vs index 00a34a3..c538207 100644 --- a/gfx/gl/shaders/pointLight.vs +++ b/gfx/gl/shaders/pointLight.vs @@ -1,18 +1,24 @@ #version 330 core -layout(location = 0) in vec3 position; +layout(location = 0) in vec3 v_position; +layout(location = 1) in vec3 v_colour; +layout(location = 2) in float v_kq; +layout(location = 3) in mat4 model; +layout(location = 7) in ivec3 modelPos; -uniform vec3 colour; -uniform float kq; uniform ivec3 viewPoint; -out vec3 centre; -out float size; +flat out vec3 position; +flat out vec3 colour; +flat out float size; +flat out float kq; void main() { - centre = position; - size = (8000 * sqrt(max(max(colour.r, colour.g), colour.b))) / sqrt(kq); - gl_Position = vec4(centre - viewPoint, 0); + position = modelPos + ivec3(mat3(model) * v_position); + kq = v_kq; + size = (8000 * sqrt(max(max(v_colour.r, v_colour.g), v_colour.b))) / sqrt(v_kq); + colour = v_colour; + gl_Position = vec4(position - viewPoint, 0); } |