Fix for Bloom filter
This commit is contained in:
@@ -51,17 +51,18 @@ class Bloom(blur: Filter = ApproximateGaussianBlur()) : Filter(Shader.createFrom
|
|||||||
lastDownsampleRate = downsampleRate
|
lastDownsampleRate = downsampleRate
|
||||||
|
|
||||||
for (downsample in 0 until downsamples * 2 step 2) {
|
for (downsample in 0 until downsamples * 2 step 2) {
|
||||||
val bufferA = colorBuffer(dest.width, dest.height, 1.0 / (downsample + downsampleRate), target[0].format, ColorType.FLOAT16)
|
val div = downsample + downsampleRate
|
||||||
val bufferB = colorBuffer(dest.width, dest.height, 1.0 / (downsample + downsampleRate), target[0].format, ColorType.FLOAT16)
|
val bufferA = colorBuffer(dest.width/div, dest.height/div, 1.0, target[0].format, ColorType.FLOAT16)
|
||||||
|
val bufferB = colorBuffer(dest.width/div, dest.height/div, 1.0, target[0].format, ColorType.FLOAT16)
|
||||||
samplers.add(Pair(bufferA, bufferB))
|
samplers.add(Pair(bufferA, bufferB))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for ((bufferA) in samplers) {
|
for ((bufferA, _) in samplers) {
|
||||||
blur.apply(src, bufferA)
|
blur.apply(src, bufferA)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for ((index, buffers) in samplers.asReversed().withIndex()) {
|
for ((index, buffers) in samplers.asReversed().withIndex()) {
|
||||||
val (bufferCurrA) = buffers
|
val (bufferCurrA) = buffers
|
||||||
|
|
||||||
|
|||||||
@@ -13,8 +13,7 @@ uniform float gain;
|
|||||||
|
|
||||||
out vec4 o_color;
|
out vec4 o_color;
|
||||||
void main() {
|
void main() {
|
||||||
vec2 s = textureSize(tex0, 0).xy;
|
vec2 s = 1.0 / textureSize(tex0, 0).xy;
|
||||||
s = vec2(1.0/s.x, 1.0/s.y);
|
|
||||||
int w = window;
|
int w = window;
|
||||||
|
|
||||||
vec4 sum = vec4(0.0);
|
vec4 sum = vec4(0.0);
|
||||||
|
|||||||
Reference in New Issue
Block a user