-
-
Notifications
You must be signed in to change notification settings - Fork 165
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
1 parent
dc60c38
commit 3d79c59
Showing
5 changed files
with
74 additions
and
16 deletions.
There are no files selected for viewing
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,44 +1,43 @@ | ||
precision mediump float; | ||
|
||
varying vec2 vTextureCoord; | ||
in vec2 vTextureCoord; | ||
out vec4 finalColor; | ||
|
||
uniform sampler2D uSampler; | ||
|
||
void main(void) | ||
{ | ||
float lum = length(texture2D(uSampler, vTextureCoord.xy).rgb); | ||
float lum = length(texture(uSampler, vTextureCoord.xy).rgb); | ||
|
||
gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0); | ||
finalColor = vec4(1.0, 1.0, 1.0, 1.0); | ||
|
||
if (lum < 1.00) | ||
{ | ||
if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0) | ||
{ | ||
gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0); | ||
finalColor = vec4(0.0, 0.0, 0.0, 1.0); | ||
} | ||
} | ||
|
||
if (lum < 0.75) | ||
{ | ||
if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0) | ||
{ | ||
gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0); | ||
finalColor = vec4(0.0, 0.0, 0.0, 1.0); | ||
} | ||
} | ||
|
||
if (lum < 0.50) | ||
{ | ||
if (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0) | ||
{ | ||
gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0); | ||
finalColor = vec4(0.0, 0.0, 0.0, 1.0); | ||
} | ||
} | ||
|
||
if (lum < 0.3) | ||
{ | ||
if (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0) | ||
{ | ||
gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0); | ||
finalColor = vec4(0.0, 0.0, 0.0, 1.0); | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
@group(0) @binding(1) var uSampler: texture_2d<f32>; | ||
|
||
@fragment | ||
fn mainFragment( | ||
@location(0) uv: vec2<f32>, | ||
@builtin(position) position: vec4<f32> | ||
) -> @location(0) vec4<f32> { | ||
let lum: f32 = length(textureSample(uSampler, uSampler, uv).rgb); | ||
|
||
if (lum < 1.00) | ||
{ | ||
if (modulo(position.x + position.y, 10.0) == 0.0) | ||
{ | ||
return vec4<f32>(0.0, 0.0, 0.0, 1.0); | ||
} | ||
} | ||
|
||
if (lum < 0.75) | ||
{ | ||
if (modulo(position.x - position.y, 10.0) == 0.0) | ||
{ | ||
return vec4<f32>(0.0, 0.0, 0.0, 1.0); | ||
} | ||
} | ||
|
||
if (lum < 0.50) | ||
{ | ||
if (modulo(position.x + position.y - 5.0, 10.0) == 0.0) | ||
{ | ||
return vec4<f32>(0.0, 0.0, 0.0, 1.0); | ||
} | ||
} | ||
|
||
if (lum < 0.3) | ||
{ | ||
if (modulo(position.x - position.y - 5.0, 10.0) == 0.0) | ||
{ | ||
return vec4<f32>(0.0, 0.0, 0.0, 1.0); | ||
} | ||
} | ||
|
||
return vec4<f32>(1.0); | ||
} |
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