summaryrefslogtreecommitdiff
path: root/gfx/gl/shaders/spotLight.vs
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-01-13 11:31:13 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2024-01-13 11:31:13 +0000
commit332355a9f4a4199e0ddb51852546d44ec54e176f (patch)
tree4998cde56004f53a0218dc5f00d578f939ffea08 /gfx/gl/shaders/spotLight.vs
parentInteger support in persistence (diff)
parentOnly create VAOs for the light type(s) in use (diff)
downloadilt-332355a9f4a4199e0ddb51852546d44ec54e176f.tar.bz2
ilt-332355a9f4a4199e0ddb51852546d44ec54e176f.tar.xz
ilt-332355a9f4a4199e0ddb51852546d44ec54e176f.zip
Merge branch 'model-lights'
Diffstat (limited to 'gfx/gl/shaders/spotLight.vs')
-rw-r--r--gfx/gl/shaders/spotLight.vs28
1 files changed, 17 insertions, 11 deletions
diff --git a/gfx/gl/shaders/spotLight.vs b/gfx/gl/shaders/spotLight.vs
index ac1d1db..eed8778 100644
--- a/gfx/gl/shaders/spotLight.vs
+++ b/gfx/gl/shaders/spotLight.vs
@@ -1,24 +1,30 @@
#version 330 core
layout(location = 0) in vec3 v_position;
+layout(location = 1) in vec3 v_direction;
+layout(location = 2) in vec3 v_colour;
+layout(location = 3) in float v_kq;
+layout(location = 4) in float v_arc;
+layout(location = 5) in mat4 model;
+layout(location = 9) in ivec3 modelPos;
-uniform vec3 v_direction;
-uniform vec3 colour;
-uniform float kq;
-uniform float arc;
uniform ivec3 viewPoint;
-out vec3 position;
-out vec3 direction;
-out float size;
-out float cosarc;
+flat out ivec3 position;
+flat out vec3 direction;
+flat out float size;
+flat out vec2 arc; // cos,tan (v_arc/2)
+flat out vec3 colour;
+flat out float kq;
void
main()
{
- position = v_position;
- direction = normalize(v_direction);
+ position = modelPos + ivec3(mat3(model) * v_position);
+ direction = normalize(mat3(model) * v_direction);
+ colour = v_colour;
+ kq = v_kq;
size = (8000 * sqrt(max(max(colour.r, colour.g), colour.b))) / sqrt(kq);
- cosarc = cos(arc / 2);
+ arc = vec2(cos(v_arc / 2), tan(v_arc / 2));
gl_Position = vec4(position - viewPoint, 0);
}