diff options
Diffstat (limited to 'gfx/gl/shaders')
-rw-r--r-- | gfx/gl/shaders/spotLight.fs | 6 | ||||
-rw-r--r-- | gfx/gl/shaders/spotLight.gs | 6 | ||||
-rw-r--r-- | gfx/gl/shaders/spotLight.vs | 20 |
3 files changed, 20 insertions, 12 deletions
diff --git a/gfx/gl/shaders/spotLight.fs b/gfx/gl/shaders/spotLight.fs index 937f922..6d5d332 100644 --- a/gfx/gl/shaders/spotLight.fs +++ b/gfx/gl/shaders/spotLight.fs @@ -6,8 +6,10 @@ out vec3 FragColor; layout(binding = 0) uniform isampler2D gPosition; layout(binding = 1) uniform sampler2D gNormal; uniform ivec4 viewPort; -uniform vec3 colour; -uniform float kq; +// uniform vec3 colour; +// uniform float kq; +const vec3 colour = vec3(1); +const float kq = 0.01; in vec4 geo_centre; in vec4 geo_direction; diff --git a/gfx/gl/shaders/spotLight.gs b/gfx/gl/shaders/spotLight.gs index b58c169..a2805fe 100644 --- a/gfx/gl/shaders/spotLight.gs +++ b/gfx/gl/shaders/spotLight.gs @@ -11,9 +11,9 @@ const vec3[] pyramid = vec3[]( // four-sided ); uniform mat4 viewProjection; uniform ivec3 viewPoint; -uniform float arc; - -in vec3 position[]; +// uniform float arc; +const float arc = 1; +in ivec3 position[]; in vec3 direction[]; in float size[]; in float cosarc[]; 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); |