2017-09-26 01:06:29 +02:00
|
|
|
#version 420
|
|
|
|
#extension GL_ARB_texture_gather : enable
|
2017-10-13 05:48:39 +02:00
|
|
|
// shader cb0e6e8cbec4502a // dof blur
|
2017-09-26 01:06:29 +02:00
|
|
|
layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf5c7b800 res 1280x720x1 dim 1 tm: 4 format 0816 compSel: 0 1 2 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler0 ClampX/Y/Z: 2 2 2 border: 1
|
|
|
|
layout(location = 0) in vec4 passParameterSem3;
|
|
|
|
layout(location = 0) out vec4 passPixelColor0;
|
|
|
|
uniform vec2 uf_fragCoordScale;
|
2017-09-30 00:01:54 +02:00
|
|
|
|
2017-09-26 01:06:29 +02:00
|
|
|
void main()
|
|
|
|
{
|
2017-10-13 05:48:39 +02:00
|
|
|
vec2 R0f = vec2((passParameterSem3.x + passParameterSem3.z)/2, (passParameterSem3.y + passParameterSem3.w)/2); //center point
|
|
|
|
vec2 res = vec2( passParameterSem3.x - passParameterSem3.z, passParameterSem3.w - passParameterSem3.y ) * uf_fragCoordScale;
|
|
|
|
int r = int(floor(1.0 / uf_fragCoordScale.y + 0.5));
|
2017-09-26 01:06:29 +02:00
|
|
|
vec4 R1f = vec4(0.0);
|
2017-10-01 22:40:58 +02:00
|
|
|
float count = 0.0;
|
|
|
|
for( int x=-r; x<=r; x++ ) {
|
|
|
|
for( int y=-r; y<=r; y++ ) {
|
|
|
|
if( pow(x,2) + pow(y,2) <= pow(r,2) ) {
|
2017-10-13 05:48:39 +02:00
|
|
|
R1f += texture( textureUnitPS0, R0f + vec2(x,y)*res );
|
2017-10-01 22:40:58 +02:00
|
|
|
count += 1.0;
|
|
|
|
}
|
2017-09-30 00:01:54 +02:00
|
|
|
}
|
|
|
|
}
|
2017-10-01 22:40:58 +02:00
|
|
|
passPixelColor0 = R1f/count;
|
2017-09-26 01:06:29 +02:00
|
|
|
}
|
2017-10-01 22:40:58 +02:00
|
|
|
|