Replace explicit matrix uniforms with single ubo
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
#version 430 core
|
||||
layout (location = 0) in vec4 params;
|
||||
layout (location = 1) in vec2 texCoor;
|
||||
uniform mat4 worldMat;
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(0,0,0,0);
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
#version 430 core
|
||||
layout (points) in;
|
||||
layout (triangle_strip, max_vertices = 4) out;
|
||||
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
|
||||
out float lum;
|
||||
out vec2 dField;
|
||||
|
||||
uniform mat4 worldMat;
|
||||
|
||||
void main()
|
||||
{
|
||||
lum = gl_in[0].gl_Position.w;
|
||||
@@ -13,16 +11,16 @@ void main()
|
||||
float gRad = gl_in[0].gl_Position.z;
|
||||
|
||||
dField = vec2 ( 1, 1);
|
||||
gl_Position = worldMat * vec4 (cenPos.x + gRad, cenPos.y + gRad, -0 , 1);
|
||||
gl_Position = theMat * vec4 (cenPos.x + gRad, cenPos.y + gRad, -0 , 1);
|
||||
EmitVertex();
|
||||
dField = vec2 (-1, 1);
|
||||
gl_Position = worldMat * vec4 (cenPos.x - gRad, cenPos.y + gRad, -0 , 1);
|
||||
gl_Position = theMat * vec4 (cenPos.x - gRad, cenPos.y + gRad, -0 , 1);
|
||||
EmitVertex();
|
||||
dField = vec2 ( 1,-1);
|
||||
gl_Position = worldMat * vec4 (cenPos.x + gRad, cenPos.y - gRad, -0 , 1);
|
||||
gl_Position = theMat * vec4 (cenPos.x + gRad, cenPos.y - gRad, -0 , 1);
|
||||
EmitVertex();
|
||||
dField = vec2 (-1,-1);
|
||||
gl_Position = worldMat * vec4 (cenPos.x - gRad, cenPos.y - gRad, -0 , 1);
|
||||
gl_Position = theMat * vec4 (cenPos.x - gRad, cenPos.y - gRad, -0 , 1);
|
||||
EmitVertex();
|
||||
|
||||
EndPrimitive();
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#version 430 core
|
||||
layout (location = 0) in vec4 position;
|
||||
uniform mat4 worldMat;
|
||||
void main()
|
||||
{
|
||||
gl_Position = position;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#version 430 core
|
||||
out vec4 fColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
fColor = vec4 (0.9,0.5,0,0);
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
#version 430 core
|
||||
layout (points) in;
|
||||
layout (triangle_strip, max_vertices = 11) out;
|
||||
|
||||
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
|
||||
uniform vec2 lightPos;
|
||||
uniform mat4 worldMat;
|
||||
|
||||
vec2 lightPosa = ( worldMat * vec4(lightPos,0,1) ).xy;
|
||||
vec2 lightPosa = ( theMat * vec4(lightPos,0,1) ).xy;
|
||||
|
||||
vec4 shift (vec4 p)
|
||||
{ return vec4 (p.xy + (200 * (p.xy-lightPos)), 0 , 1);
|
||||
@@ -28,14 +26,14 @@ vec4 p6 = shift(p2);
|
||||
vec4 p7 = vec4 (p6.xy,-0.5,1);
|
||||
vec4 p8 = vec4 (p5.xy,-0.5,1);
|
||||
|
||||
vec4 a1 = worldMat * p1;
|
||||
vec4 a2 = worldMat * p2;
|
||||
vec4 a3 = worldMat * p3;
|
||||
vec4 a4 = worldMat * p4;
|
||||
vec4 a5 = worldMat * p5;
|
||||
vec4 a6 = worldMat * p6;
|
||||
vec4 a7 = worldMat * p7;
|
||||
vec4 a8 = worldMat * p8;
|
||||
vec4 a1 = theMat * p1;
|
||||
vec4 a2 = theMat * p2;
|
||||
vec4 a3 = theMat * p3;
|
||||
vec4 a4 = theMat * p4;
|
||||
vec4 a5 = theMat * p5;
|
||||
vec4 a6 = theMat * p6;
|
||||
vec4 a7 = theMat * p7;
|
||||
vec4 a8 = theMat * p8;
|
||||
|
||||
gl_Position = a4; EmitVertex();
|
||||
gl_Position = a3; EmitVertex();
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#version 430 core
|
||||
layout (location = 0) in vec4 poss;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = poss;
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
#version 430 core
|
||||
in vec2 cenPosT;
|
||||
in float lum;
|
||||
|
||||
in vec3 dField;
|
||||
|
||||
out vec4 fColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
float c = pow (1 - min(1, dot(dField,dField)) , 2) * lum ;
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
#version 430 core
|
||||
layout (points) in;
|
||||
layout (triangle_strip, max_vertices = 4) out;
|
||||
|
||||
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
|
||||
out vec3 dField;
|
||||
out float lum;
|
||||
|
||||
uniform vec2 lightPos;
|
||||
uniform mat4 worldMat;
|
||||
uniform vec2 radLum;
|
||||
|
||||
float isLHS (vec2 startV, vec2 testV)
|
||||
{
|
||||
return sign( -startV.x * testV.y + startV.y * testV.x);
|
||||
@@ -31,10 +28,10 @@ if (isLHS (p1.xy - lightPos, p2.xy - lightPos) < 0)
|
||||
vec2 d1 = p1.xy - lightPos;
|
||||
vec2 d2 = p2.xy - lightPos;
|
||||
|
||||
vec4 a1 = shiftCloser( worldMat * p1 );
|
||||
vec4 a2 = shiftCloser( worldMat * p2 );
|
||||
vec4 a3 = shiftCloser( worldMat * p3 );
|
||||
vec4 a4 = shiftCloser( worldMat * p4 );
|
||||
vec4 a1 = shiftCloser( theMat * p1 );
|
||||
vec4 a2 = shiftCloser( theMat * p2 );
|
||||
vec4 a3 = shiftCloser( theMat * p3 );
|
||||
vec4 a4 = shiftCloser( theMat * p4 );
|
||||
|
||||
dField = vec3( d1.x/rad, d1.y/rad, 0);
|
||||
gl_Position = a1;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#version 430 core
|
||||
layout (location = 0) in vec4 poss;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = poss;
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#version 430 core
|
||||
in vec3 vTexPos;
|
||||
out vec4 fColor;
|
||||
|
||||
uniform sampler2DArray tilesetSampler;
|
||||
|
||||
void main()
|
||||
{
|
||||
fColor = texture(tilesetSampler, vTexPos);
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#version 430 core
|
||||
layout (location = 0) in vec3 pos;
|
||||
layout (location = 1) in vec3 texPos;
|
||||
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
|
||||
out vec3 vTexPos;
|
||||
|
||||
uniform mat4 worldMat;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = worldMat * vec4(pos,1.0) ;
|
||||
gl_Position = theMat * vec4(pos,1.0) ;
|
||||
vTexPos = texPos;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
layout (location = 0) in vec2 pos;
|
||||
layout (location = 1) in vec2 texPos;
|
||||
out vec2 vTexPos;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(pos,0,1);
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
layout (location = 0) in vec2 pos;
|
||||
layout (location = 1) in vec2 texPos;
|
||||
out vec2 vTexPos;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(pos,0,1);
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
layout (location = 0) in vec2 pos;
|
||||
layout (location = 1) in vec2 texPos;
|
||||
out vec2 vTexPos;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(pos,0,1);
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#version 430 core
|
||||
layout (location = 0) in vec3 pos;
|
||||
layout (location = 1) in vec2 texPos;
|
||||
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
|
||||
out vec2 vTexPos;
|
||||
|
||||
uniform mat4 worldMat;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = worldMat * vec4(pos,1.0) ;
|
||||
gl_Position = theMat * vec4(pos,1.0) ;
|
||||
vTexPos = texPos;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
#version 430 core
|
||||
layout (points) in;
|
||||
layout (triangle_strip, max_vertices = 4) out;
|
||||
|
||||
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
|
||||
in vec4 vColor [];
|
||||
out vec4 gColor;
|
||||
|
||||
uniform mat4 worldMat;
|
||||
|
||||
// consider using isLHS to check if the wall is facing the center
|
||||
// this needs the view from point
|
||||
float isLHS (vec2 startV, vec2 testV)
|
||||
@@ -21,16 +18,16 @@ void main()
|
||||
vec4 p1 = vec4 (gl_in[0].gl_Position.xy,0,1);
|
||||
vec4 p2 = vec4 (gl_in[0].gl_Position.zw,0,1);
|
||||
|
||||
vec4 a1 = worldMat * p1;
|
||||
vec4 a2 = worldMat * p2;
|
||||
vec4 a1 = theMat * p1;
|
||||
vec4 a2 = theMat * p2;
|
||||
|
||||
// if (0 > isLHS (a1.xy - a2.xy, a1.xy - "viewFromPoint")) {
|
||||
|
||||
vec4 p3 = vec4 (p1.xy,-0.5,1);
|
||||
vec4 p4 = vec4 (p2.xy,-0.5,1);
|
||||
|
||||
vec4 a3 = worldMat * p3;
|
||||
vec4 a4 = worldMat * p4;
|
||||
vec4 a3 = theMat * p3;
|
||||
vec4 a4 = theMat * p4;
|
||||
|
||||
gl_Position = a1; EmitVertex();
|
||||
gl_Position = a3; EmitVertex();
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#version 430 core
|
||||
layout (location = 0) in vec4 poss;
|
||||
layout (location = 1) in vec4 color;
|
||||
|
||||
out vec4 vColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = poss;
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
#version 430 core
|
||||
in vec2 tPos;
|
||||
in vec4 gColor;
|
||||
|
||||
uniform sampler2D tex;
|
||||
|
||||
out vec4 fColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
fColor = gColor * texture(tex,tPos);
|
||||
// fColor = gColor;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
#version 430 core
|
||||
layout (points) in;
|
||||
layout (triangle_strip, max_vertices = 4) out;
|
||||
|
||||
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
|
||||
in vec4 vColor [];
|
||||
out vec4 gColor;
|
||||
out vec2 tPos;
|
||||
|
||||
uniform mat4 worldMat;
|
||||
|
||||
// consider using isLHS to check if the wall is facing the center
|
||||
float isLHS (vec2 startV, vec2 testV)
|
||||
{
|
||||
@@ -23,10 +20,10 @@ vec4 p2 = vec4 (gl_in[0].gl_Position.zw,0,1);
|
||||
vec4 p3 = vec4 (p1.xy,-0.3,1);
|
||||
vec4 p4 = vec4 (p2.xy,-0.3,1);
|
||||
|
||||
vec4 a1 = worldMat * p1;
|
||||
vec4 a2 = worldMat * p2;
|
||||
vec4 a3 = worldMat * p3;
|
||||
vec4 a4 = worldMat * p4;
|
||||
vec4 a1 = theMat * p1;
|
||||
vec4 a2 = theMat * p2;
|
||||
vec4 a3 = theMat * p3;
|
||||
vec4 a4 = theMat * p4;
|
||||
|
||||
tPos = vec2 ( 1,-1) ; gl_Position = a1; EmitVertex();
|
||||
tPos = vec2 ( 1, 1) ; gl_Position = a3; EmitVertex();
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#version 430 core
|
||||
layout (location = 0) in vec4 poss;
|
||||
layout (location = 1) in vec4 color;
|
||||
|
||||
out vec4 vColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = poss;
|
||||
|
||||
Reference in New Issue
Block a user