rename shader variables to avoid keywords
This commit is contained in:
parent
565e0390f3
commit
ff838b8e85
@ -25,7 +25,7 @@ float fragDepthView;
|
||||
|
||||
|
||||
in vec2 fragPosScreen;
|
||||
layout (location = 0) out float output;
|
||||
layout (location = 0) out float outputColor;
|
||||
|
||||
|
||||
// A random number generator from the web.
|
||||
@ -74,5 +74,5 @@ void main() {
|
||||
occlusion += (sampleDepth >= viewpos.z/viewpos.w + bias ? 1.0 : 0.0) * rangeCheck;
|
||||
}
|
||||
|
||||
output = 1.0 - (occlusion / SSAO_SAMPLE_COUNT);
|
||||
outputColor = 1.0 - (occlusion / SSAO_SAMPLE_COUNT);
|
||||
}
|
||||
|
@ -1,21 +1,21 @@
|
||||
#version 330
|
||||
|
||||
uniform sampler2D input;
|
||||
uniform sampler2D tex;
|
||||
uniform vec2 screenSize;
|
||||
|
||||
|
||||
in vec2 fragPosScreen;
|
||||
layout (location = 0) out float output;
|
||||
layout (location = 0) out float outputColor;
|
||||
|
||||
|
||||
void main() {
|
||||
output = 0;
|
||||
outputColor = 0;
|
||||
|
||||
for (int i = -3; i <= 3; i++)
|
||||
for (int j = -3; j <= 3; j++)
|
||||
output += texture(input, fragPosScreen + vec2(i, j) / screenSize).r;
|
||||
outputColor += texture(tex, fragPosScreen + vec2(i, j) / screenSize).r;
|
||||
|
||||
output /= 49.0;
|
||||
output *= output;
|
||||
outputColor /= 49.0;
|
||||
outputColor *= outputColor;
|
||||
}
|
||||
|
||||
|
@ -233,7 +233,7 @@ func (r *WorldRenderer) Init(w *world.World) (err error) {
|
||||
gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST)
|
||||
gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST)
|
||||
gl.FramebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, r.ssao.ambient, 0)
|
||||
r.ssao.blur.shader.SetUniformTextureHandle("input", r.ssao.ambient)
|
||||
r.ssao.blur.shader.SetUniformTextureHandle("tex", r.ssao.ambient)
|
||||
// uniform buffer object for samples
|
||||
ssaoSamples := make([]itype.Vec4f, SSAOSampleCount)
|
||||
for i := range ssaoSamples {
|
||||
|
Loading…
Reference in New Issue
Block a user