summaryrefslogtreecommitdiff
path: root/gfx/gl/shaders/spotLight.vs
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/gl/shaders/spotLight.vs')
-rw-r--r--gfx/gl/shaders/spotLight.vs20
1 files changed, 13 insertions, 7 deletions
diff --git a/gfx/gl/shaders/spotLight.vs b/gfx/gl/shaders/spotLight.vs
index ac1d1db..a2b755d 100644
--- a/gfx/gl/shaders/spotLight.vs
+++ b/gfx/gl/shaders/spotLight.vs
@@ -1,14 +1,20 @@
#version 330 core
layout(location = 0) in vec3 v_position;
+layout(location = 1) in vec3 v_direction;
+// layout(location = 2) in vec3 colour;
+// layout(location = 3) in float kq;
+// layout(location = 4) in float arc;
+layout(location = 5) in mat4 model;
+layout(location = 9) in ivec3 modelPos;
+
+const vec3 colour = vec3(1);
+const float kq = 0.01;
+const float arc = 1;
-uniform vec3 v_direction;
-uniform vec3 colour;
-uniform float kq;
-uniform float arc;
uniform ivec3 viewPoint;
-out vec3 position;
+out ivec3 position;
out vec3 direction;
out float size;
out float cosarc;
@@ -16,8 +22,8 @@ out float cosarc;
void
main()
{
- position = v_position;
- direction = normalize(v_direction);
+ position = modelPos + ivec3(v_position * mat3(model));
+ direction = normalize(v_direction * mat3(model));
size = (8000 * sqrt(max(max(colour.r, colour.g), colour.b))) / sqrt(kq);
cosarc = cos(arc / 2);
gl_Position = vec4(position - viewPoint, 0);