From 7ab932db932e13244623fc5598b16a6f33789bbb Mon Sep 17 00:00:00 2001 From: jgk Date: Thu, 24 Jun 2021 17:35:50 +0200 Subject: [PATCH] Update twoD shaders --- shader/lighting/floor.vert | 7 ------- shader/twoD/arc.vert | 6 ++---- shader/twoD/basic.vert | 4 ---- shader/twoD/bezierQuad.vert | 6 ++---- shader/twoD/character.vert | 7 ++----- shader/twoD/ellipse.vert | 6 ++---- 6 files changed, 8 insertions(+), 28 deletions(-) diff --git a/shader/lighting/floor.vert b/shader/lighting/floor.vert index 8637c6826..6d5720315 100644 --- a/shader/lighting/floor.vert +++ b/shader/lighting/floor.vert @@ -1,13 +1,6 @@ #version 430 core layout (location = 0) in vec4 position; -//out vec2 vParams; - -uniform vec2 winSize; -uniform float zoom; -uniform vec2 translation; -uniform float rotation; uniform mat4 worldMat; - void main() { gl_Position = position; diff --git a/shader/twoD/arc.vert b/shader/twoD/arc.vert index fd48180aa..cd30492ac 100644 --- a/shader/twoD/arc.vert +++ b/shader/twoD/arc.vert @@ -2,14 +2,12 @@ layout (location = 0) in vec3 position; layout (location = 1) in vec4 color; layout (location = 2) in vec3 boxXboxYwidth; +layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ; out vec4 vColor; out vec3 vparams; - -uniform mat4 worldMat; - void main() { - gl_Position = worldMat * vec4(position.xyz,1); + gl_Position = theMat * vec4(position.xyz,1); vColor = color; vparams = boxXboxYwidth; } diff --git a/shader/twoD/basic.vert b/shader/twoD/basic.vert index b874437fe..16472176c 100644 --- a/shader/twoD/basic.vert +++ b/shader/twoD/basic.vert @@ -1,12 +1,8 @@ #version 430 core layout (location = 0) in vec3 position; layout (location = 1) in vec4 color; - layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ; out vec4 vColor; - -uniform mat4 worldMat; - void main() { gl_Position = theMat * vec4(position,1); diff --git a/shader/twoD/bezierQuad.vert b/shader/twoD/bezierQuad.vert index 9265ea4d4..efa5da739 100644 --- a/shader/twoD/bezierQuad.vert +++ b/shader/twoD/bezierQuad.vert @@ -2,15 +2,13 @@ layout (location = 0) in vec3 position; layout (location = 1) in vec4 color; layout (location = 2) in vec4 boxes; +layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ; out vec4 vColor; out vec2 boxOut; out vec2 boxIn; - -uniform mat4 worldMat; - void main() { - gl_Position = worldMat * vec4(position.xyz,1); + gl_Position = theMat * vec4(position.xyz,1); vColor = color; boxOut = boxes.xy ; boxIn = boxes.zw ; diff --git a/shader/twoD/character.vert b/shader/twoD/character.vert index 36e679b43..342ad1acf 100644 --- a/shader/twoD/character.vert +++ b/shader/twoD/character.vert @@ -2,15 +2,12 @@ layout (location = 0) in vec3 aPos; layout (location = 1) in vec4 aColor; layout (location = 2) in vec2 aTexCoord; - -uniform mat4 worldMat; - +layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ; out vec4 gColor; out vec2 gTexCoord; - void main() { - gl_Position = worldMat * vec4(aPos, 1.0); + gl_Position = theMat * vec4(aPos, 1.0); gColor = aColor; gTexCoord = aTexCoord; } diff --git a/shader/twoD/ellipse.vert b/shader/twoD/ellipse.vert index 42aed9d78..4335e3588 100644 --- a/shader/twoD/ellipse.vert +++ b/shader/twoD/ellipse.vert @@ -1,12 +1,10 @@ #version 430 core layout (location = 0) in vec3 position; layout (location = 1) in vec4 col; +layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ; out vec4 vCol; - -uniform mat4 worldMat; - void main() { - gl_Position = worldMat * vec4(position,1); + gl_Position = theMat * vec4(position,1); vCol = col; }