summaryrefslogtreecommitdiff
path: root/gfx/gl/shaders/spotLight.gs
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.gs
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.gs')
-rw-r--r--gfx/gl/shaders/spotLight.gs24
1 files changed, 14 insertions, 10 deletions
diff --git a/gfx/gl/shaders/spotLight.gs b/gfx/gl/shaders/spotLight.gs
index b58c169..194812a 100644
--- a/gfx/gl/shaders/spotLight.gs
+++ b/gfx/gl/shaders/spotLight.gs
@@ -11,17 +11,19 @@ const vec3[] pyramid = vec3[]( // four-sided
);
uniform mat4 viewProjection;
uniform ivec3 viewPoint;
-uniform float arc;
-
-in vec3 position[];
-in vec3 direction[];
-in float size[];
-in float cosarc[];
+flat in ivec3 position[];
+flat in vec3 direction[];
+flat in vec3 colour[];
+flat in float size[];
+flat in float kq[];
+flat in vec2 arc[];
layout(points) in;
layout(triangle_strip, max_vertices = 8) out;
-out vec4 geo_centre;
-out vec4 geo_direction;
+flat out vec4 geo_centre;
+flat out vec4 geo_direction;
+flat out vec3 geo_colour;
+flat out float geo_kq;
vec3
perp(vec3 a)
@@ -36,14 +38,16 @@ doVertex(vec4 ndcpos)
{
gl_Position = ndcpos;
geo_centre = vec4(position[0], size[0]);
- geo_direction = vec4(direction[0], cosarc[0]);
+ geo_direction = vec4(direction[0], arc[0].x);
+ geo_colour = colour[0];
+ geo_kq = kq[0];
EmitVertex();
}
void
main()
{
- const float base = size[0] * tan(arc / 2);
+ const float base = size[0] * arc[0].y;
const vec3 offx = perp(direction[0]);
const vec3 offy = cross(direction[0], offx);
vec4 out_py[pyramid.length()];