-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ErkMkd
committed
Jun 17, 2022
1 parent
82de89e
commit 0723f7e
Showing
58 changed files
with
553 additions
and
978 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,35 @@ | ||
$input v_texcoord0 | ||
|
||
// HARFANG(R) Copyright (C) 2022 Emmanuel Julien, NWNC HARFANG. Released under GPL/LGPL/Commercial Licence, see licence.txt for details. | ||
#include <forward_pipeline.sh> | ||
|
||
SAMPLER2D(u_source, 0); | ||
|
||
uniform vec4 u_source_rect; | ||
uniform vec4 u_params; | ||
|
||
vec2 compute_texel(vec2 uv, vec2 center, vec4 bounds) { | ||
vec4 w = vec4(step(bounds.xy, uv), step(uv, bounds.zw)); | ||
return mix(center, uv, vec2(w.x*w.z, w.y*w.w)); | ||
} | ||
|
||
void main() { | ||
vec2 uv = v_texcoord0.xy; | ||
vec4 offset = vec4(-1., 1., 1., 0.) / uResolution.xxyy; | ||
|
||
vec4 t0 = texture2D(u_source, uv - offset.yz); | ||
vec4 t1 = texture2D(u_source, uv - offset.wz); | ||
vec4 t2 = texture2D(u_source, uv - offset.xz); | ||
vec2 center = (floor(v_texcoord0.xy * uResolution.xy) + vec2_splat(0.5)) / uResolution.xy; | ||
vec4 bounds = (floor(u_source_rect.xyzw) + vec4(1.,1.,-1.,-1.)) / uResolution.xyxy; | ||
|
||
vec4 t0 = texture2D(u_source, compute_texel(uv - offset.yz, center, bounds)); // -1,-1 | ||
vec4 t1 = texture2D(u_source, compute_texel(uv - offset.wz, center, bounds)); // 0,-1 | ||
vec4 t2 = texture2D(u_source, compute_texel(uv - offset.xz, center, bounds)); // 1,-1 | ||
|
||
vec4 t3 = texture2D(u_source, uv + offset.xw); | ||
vec4 t4 = texture2D(u_source, uv); | ||
vec4 t5 = texture2D(u_source, uv + offset.yw); | ||
vec4 t3 = texture2D(u_source, compute_texel(uv + offset.xw, center, bounds)); // -1, 0 | ||
vec4 t4 = texture2D(u_source, compute_texel(uv, center, bounds)); | ||
vec4 t5 = texture2D(u_source, compute_texel(uv + offset.yw, center, bounds)); // 1, 0 | ||
|
||
vec4 t6 = texture2D(u_source, uv + offset.xz); | ||
vec4 t7 = texture2D(u_source, uv + offset.wz); | ||
vec4 t8 = texture2D(u_source, uv + offset.yz); | ||
vec4 t6 = texture2D(u_source, compute_texel(uv + offset.xz, center, bounds)); // -1, 1 | ||
vec4 t7 = texture2D(u_source, compute_texel(uv + offset.wz, center, bounds)); // 0, 1 | ||
vec4 t8 = texture2D(u_source, compute_texel(uv + offset.yz, center, bounds)); // 1, 1 | ||
|
||
gl_FragColor = u_params.z * (t0 + t2 + t6 + t8 + 2. * (t1 + t3 + t5 + t7) + 4. * t4) / 16.; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.