This commit is contained in:
devZoGok
2021-10-19 19:06:41 +03:00
parent 33425cea47
commit dc03858585
12 changed files with 77 additions and 85 deletions
+8 -8
View File
@@ -8,15 +8,15 @@ uniform bool horizontal;
uniform sampler2D tex;
void main(){
int amount=5;
int amount = 5;
float weight[5] = float[] (0.227027, 0.1945946, 0.1216216, 0.054054,0.016216);
vec2 texel=1.0/textureSize(tex,0);
vec3 c=texture(tex,texCoords).rgb*weight[0];
vec2 texel = 1.0 / textureSize(tex, 0);
vec3 c = texture(tex, texCoords).rgb * weight[0];
for(int i=1;i<amount;i++){
vec2 offset=vec2(horizontal?texel.x:0,horizontal?0:texel.y);
c+=texture(tex,texCoords+offset*i).rgb*weight[i];
c+=texture(tex,texCoords-offset*i).rgb*weight[i];
for(int i = 1; i < amount; i++){
vec2 offset = vec2(horizontal ? texel.x : 0, horizontal ? 0 : texel.y);
c += texture(tex, texCoords + offset * i).rgb * weight[i];
c += texture(tex, texCoords - offset * i).rgb * weight[i];
}
FragColor=vec4(c,1);
FragColor = vec4(c, 1);
}
+7 -7
View File
@@ -1,16 +1,16 @@
#version 330 core
layout (location=0) in vec3 aVert;
layout (location=2) in vec2 aTexCoords;
layout (location = 0) in vec3 aVert;
layout (location = 2) in vec2 aTexCoords;
out vec2 texCoords;
uniform vec2 screen;
void main(){
float x,y;
x=(aVert.x-screen.x*.5)/(screen.x*.5);
y=(screen.y*.5-aVert.y)/(screen.y*.5);
gl_Position=vec4(x,y,aVert.z,1);
texCoords=aTexCoords;
float x, y;
x = (aVert.x - screen.x * .5) / (screen.x * .5);
y = (screen.y * .5 - aVert.y) / (screen.y * .5);
gl_Position = vec4(x, y, aVert.z, 1);
texCoords = aTexCoords;
}
+3 -3
View File
@@ -8,8 +8,8 @@ in vec4 fragPos;
void main(){
if(point){
float dist=length(lightPos-fragPos.xyz);
dist/=farPlane;
gl_FragDepth=dist;
float dist = length(lightPos - fragPos.xyz);
dist /= farPlane;
gl_FragDepth = dist;
}
}
+6 -6
View File
@@ -1,7 +1,7 @@
#version 330 core
layout (triangles) in;
layout (triangle_strip, max_vertices=18) out;
layout (triangle_strip, max_vertices = 18) out;
out vec4 fragPos;
@@ -10,11 +10,11 @@ uniform bool point;
void main(){
if(point)
for(int i=0;i<6;i++){
gl_Layer=i;
for(int j=0;j<3;j++){
fragPos=gl_in[j].gl_Position;
gl_Position=shadowMat[i]*fragPos;
for(int i = 0; i < 6; i++){
gl_Layer = i;
for(int j = 0; j < 3; j++){
fragPos = gl_in[j].gl_Position;
gl_Position = shadowMat[i] * fragPos;
EmitVertex();
}
EndPrimitive();
+4 -5
View File
@@ -1,14 +1,13 @@
#version 330 core
layout (location=0) in vec3 aPos;
layout (location = 0) in vec3 aPos;
uniform mat4 model;
uniform mat4 lightMat;
uniform mat4 model, lightMat;
uniform bool point;
void main(){
if(point)
gl_Position=model*vec4(aPos,1);
gl_Position = model * vec4(aPos, 1);
else
gl_Position=lightMat*model*vec4(aPos,1);
gl_Position = lightMat * model * vec4(aPos, 1);
}
+11 -14
View File
@@ -4,29 +4,26 @@ in vec2 texCoords;
out vec4 FragColor;
uniform sampler2D frag;
uniform sampler2D bright;
uniform bool hdr;
uniform bool bloom;
uniform float exposure;
uniform float gamma;
uniform sampler2D frag, bright;
uniform bool hdr, bloom;
uniform float exposure, gamma;
void main(){
vec4 hdrColor=texture(frag,texCoords);
vec4 brightColor=texture(bright,texCoords);
vec2 texel=1.0/textureSize(bright,0);
vec4 hdrColor = texture(frag, texCoords);
vec4 brightColor = texture(bright, texCoords);
vec2 texel = 1.0 / textureSize(bright, 0);
if(bloom)
hdrColor+=brightColor;
hdrColor += brightColor;
if(hdr){
//Reinhardt
//c.rgb=c.rgb/(c.rgb+vec3(1.));
//c.rgb = c.rgb / (c.rgb + vec3(1.));
//Exp
hdrColor.rgb=vec3(1.)-exp(-hdrColor.rgb*exposure);
hdrColor.rgb = vec3(1.) - exp(-hdrColor.rgb * exposure);
}
hdrColor.rgb=pow(hdrColor.rgb,vec3(1/gamma));
FragColor=hdrColor;
hdrColor.rgb = pow(hdrColor.rgb, vec3(1 / gamma));
FragColor = hdrColor;
}
+7 -7
View File
@@ -1,16 +1,16 @@
#version 330 core
layout (location=0) in vec3 aVert;
layout (location=2) in vec2 aTexCoords;
layout (location = 0) in vec3 aVert;
layout (location = 2) in vec2 aTexCoords;
out vec2 texCoords;
uniform vec2 screen;
void main(){
float x,y;
x=(aVert.x-screen.x*.5)/(screen.x*.5);
y=(screen.y*.5-aVert.y)/(screen.y*.5);
gl_Position=vec4(x,y,aVert.z,1);
texCoords=aTexCoords;
float x, y;
x = (aVert.x - screen.x * .5) / (screen.x * .5);
y = (screen.y * .5-aVert.y) / (screen.y * .5);
gl_Position = vec4(x, y, aVert.z, 1);
texCoords = aTexCoords;
}
+4 -4
View File
@@ -2,12 +2,12 @@
in vec3 texCoords;
layout (location=0) out vec4 FragColor;
layout (location=1) out vec4 BrightColor;
layout (location = 0) out vec4 FragColor;
layout (location = 1) out vec4 BrightColor;
uniform samplerCube skybox;
void main(){
BrightColor=vec4(0);
FragColor=texture(skybox,texCoords);
BrightColor = vec4(0);
FragColor = texture(skybox, texCoords);
}
+5 -6
View File
@@ -1,14 +1,13 @@
#version 330 core
layout (location=0) in vec3 aPos;
layout (location = 0) in vec3 aPos;
out vec3 texCoords;
uniform mat4 proj;
uniform mat4 view;
uniform mat4 proj, view;
void main(){
texCoords=aPos;
vec4 pos=proj*view*vec4(aPos,1);
gl_Position=pos;
texCoords = aPos;
vec4 pos = proj * view * vec4(aPos, 1);
gl_Position = pos;
}
+1 -1
View File
@@ -1,6 +1,6 @@
#version 330 core
layout (location=0) in vec4 aVert;
layout (location = 0) in vec4 aVert;
out vec2 texCoords;
+12 -12
View File
@@ -3,7 +3,7 @@
/*
*/
layout (triangles) in;
layout (triangle_strip, max_vertices=3) out;
layout (triangle_strip, max_vertices = 3) out;
in VS_OUT{
vec2 tCoords;
@@ -18,24 +18,24 @@ uniform bool environment;
void main(){
/*
if(environment)
for(int i=0;i<6;i++){
gl_Layer=i;
for(int j=0;j<3;j++){
FragPos=gl_in[j].gl_Position;
gl_Position=shadowMat[i]*FragPos;
for(int i = 0; i < 6; i++){
gl_Layer = i;
for(int j = 0; j < 3; j++){
FragPos = gl_in[j].gl_Position;
gl_Position = shadowMat[i] * FragPos;
EmitVertex();
}
EndPrimitive();
}
*/
gl_Position=gl_in[0].gl_Position;
texCoords=gs_in[0].tCoords;
gl_Position = gl_in[0].gl_Position;
texCoords = gs_in[0].tCoords;
EmitVertex();
gl_Position=gl_in[1].gl_Position;
texCoords=gs_in[1].tCoords;
gl_Position = gl_in[1].gl_Position;
texCoords = gs_in[1].tCoords;
EmitVertex();
gl_Position=gl_in[2].gl_Position;
texCoords=gs_in[2].tCoords;
gl_Position = gl_in[2].gl_Position;
texCoords = gs_in[2].tCoords;
EmitVertex();
EndPrimitive();
}
+9 -12
View File
@@ -8,19 +8,16 @@ const int numShapeKeys = 1;
mat4 transform[numBones];
mat4 poseTransform[numBones];
layout (location=0) in vec3 aPos;
layout (location=1) in vec3 aNorm;
layout (location=2) in vec2 aTexCoords;
layout (location=3) in vec3 aTan;
layout (location=4) in vec3 aBiTan;
layout (location=5) in vec4 aWeight;
layout (location=6) in ivec4 aBoneIndices;
layout (location=7) in vec3 aShapeKeyOffsets[numShapeKeys];
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec3 aNorm;
layout (location = 2) in vec2 aTexCoords;
layout (location = 3) in vec3 aTan;
layout (location = 4) in vec3 aBiTan;
layout (location = 5) in vec4 aWeight;
layout (location = 6) in ivec4 aBoneIndices;
layout (location = 7) in vec3 aShapeKeyOffsets[numShapeKeys];
out vec3 fragPos;
out vec3 norm;
out vec3 tan;
out vec3 biTan;
out vec3 fragPos, norm, tan, biTan;
out vec2 texCoords;
struct Bone{