diff options
| author | realtradam <[email protected]> | 2022-04-19 04:16:52 -0400 |
|---|---|---|
| committer | realtradam <[email protected]> | 2022-04-19 04:16:52 -0400 |
| commit | aa865376f6737393a7f089dda8e1254520af30ba (patch) | |
| tree | 10b5d70b03db52f731af9baf84af7ae83a5b0ed3 /shaders | |
| parent | 4cfbf59ab53ede8eb39a8317c504e7cee889a827 (diff) | |
| download | zig-chip-8-aa865376f6737393a7f089dda8e1254520af30ba.tar.gz zig-chip-8-aa865376f6737393a7f089dda8e1254520af30ba.zip | |
cleaned up some code
Diffstat (limited to 'shaders')
| -rw-r--r-- | shaders/pixalizer.fs (renamed from shaders/test.fs) | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/shaders/test.fs b/shaders/pixalizer.fs index cba5bfb..a215a73 100644 --- a/shaders/test.fs +++ b/shaders/pixalizer.fs @@ -5,7 +5,6 @@ // Input vertex attributes (from vertex shader) in vec2 fragTexCoord; in vec4 fragColor; -vec2 flipped = vec2(fragTexCoord.x, 1 - fragTexCoord.y); // Input uniform values uniform sampler2D texture0; @@ -14,12 +13,15 @@ uniform vec4 colDiffuse; // Output fragment color out vec4 finalColor; -// NOTE: Add here your custom variables +// Imported variables from code uniform float renderWidth; uniform float renderHeight; -vec2 textureResolution = vec2(renderWidth, renderHeight); uniform float grid_size; -//vec2 onePixel = vec2(1.0, 1.0) / textureResolution; + +// Variable set up +vec2 flipped = vec2(fragTexCoord.x, 1 - fragTexCoord.y); // flipping +vec2 textureResolution = vec2(renderWidth, renderHeight); +//vec2 onePixel = vec2(1.0, 1.0) / textureResolution; // distance of a single pixel in texels vec2 pixelCoor = flipped * textureResolution; float gridify(float coordinate, float spacing) { @@ -37,6 +39,5 @@ void main() texelColor.rbg *= is_pixel(pixelCoor, grid_size); // NOTE: Implement here your fragment shader code - finalColor = texelColor*colDiffuse; } |
