rename shader variables to avoid keywords
This commit is contained in:
parent
565e0390f3
commit
ff838b8e85
@ -25,7 +25,7 @@ float fragDepthView;
|
|||||||
|
|
||||||
|
|
||||||
in vec2 fragPosScreen;
|
in vec2 fragPosScreen;
|
||||||
layout (location = 0) out float output;
|
layout (location = 0) out float outputColor;
|
||||||
|
|
||||||
|
|
||||||
// A random number generator from the web.
|
// 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;
|
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
|
#version 330
|
||||||
|
|
||||||
uniform sampler2D input;
|
uniform sampler2D tex;
|
||||||
uniform vec2 screenSize;
|
uniform vec2 screenSize;
|
||||||
|
|
||||||
|
|
||||||
in vec2 fragPosScreen;
|
in vec2 fragPosScreen;
|
||||||
layout (location = 0) out float output;
|
layout (location = 0) out float outputColor;
|
||||||
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
output = 0;
|
outputColor = 0;
|
||||||
|
|
||||||
for (int i = -3; i <= 3; i++)
|
for (int i = -3; i <= 3; i++)
|
||||||
for (int j = -3; j <= 3; j++)
|
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;
|
outputColor /= 49.0;
|
||||||
output *= output;
|
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_MIN_FILTER, gl.NEAREST)
|
||||||
gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_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)
|
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
|
// uniform buffer object for samples
|
||||||
ssaoSamples := make([]itype.Vec4f, SSAOSampleCount)
|
ssaoSamples := make([]itype.Vec4f, SSAOSampleCount)
|
||||||
for i := range ssaoSamples {
|
for i := range ssaoSamples {
|
||||||
|
Loading…
Reference in New Issue
Block a user