mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
Fix shaders
This commit is contained in:
@ -1,12 +1,6 @@
|
|||||||
#version 330 core
|
#version 330 core
|
||||||
|
|
||||||
const uint MODE_ZOOMED = 0u;
|
|
||||||
const uint MODE_STRETCHED = 1u;
|
|
||||||
const uint MODE_TILED = 2u;
|
|
||||||
const uint MODE_CENTERED = 3u;
|
|
||||||
|
|
||||||
in vec2 tex_coord;
|
in vec2 tex_coord;
|
||||||
flat in uint mode;
|
|
||||||
|
|
||||||
layout(location = 0) out vec4 out_FragColor;
|
layout(location = 0) out vec4 out_FragColor;
|
||||||
|
|
||||||
@ -14,11 +8,8 @@ uniform sampler2D image;
|
|||||||
uniform float opacity;
|
uniform float opacity;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
// Normalize the coordinate if we are tiling
|
// Normalize the coordinates
|
||||||
vec2 norm_coord = tex_coord;
|
vec2 norm_coord = tex_coord;
|
||||||
// if (mode == MODE_TILED) {
|
|
||||||
// norm_coord = fract(tex_coord);
|
|
||||||
// }
|
|
||||||
norm_coord = fract(tex_coord);
|
norm_coord = fract(tex_coord);
|
||||||
vec4 color = texture(image, norm_coord);
|
vec4 color = texture(image, norm_coord);
|
||||||
out_FragColor = vec4(color.rgb * color.a * opacity, color.a * opacity);
|
out_FragColor = vec4(color.rgb * color.a * opacity, color.a * opacity);
|
||||||
|
@ -6,18 +6,14 @@ const uint MODE_TILED = 2u;
|
|||||||
const uint MODE_CENTERED = 3u;
|
const uint MODE_CENTERED = 3u;
|
||||||
|
|
||||||
layout (location = 0) in vec2 terminal_size;
|
layout (location = 0) in vec2 terminal_size;
|
||||||
layout (location = 1) in uint mode_in;
|
layout (location = 1) in uint mode;
|
||||||
|
|
||||||
out vec2 tex_coord;
|
out vec2 tex_coord;
|
||||||
flat out uint mode;
|
|
||||||
|
|
||||||
uniform sampler2D image;
|
uniform sampler2D image;
|
||||||
uniform mat4 projection;
|
uniform mat4 projection;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
// Set mode so that we can use it in the fragment shader
|
|
||||||
mode = mode_in;
|
|
||||||
|
|
||||||
// Calculate the position of the image
|
// Calculate the position of the image
|
||||||
vec2 position;
|
vec2 position;
|
||||||
position.x = (gl_VertexID == 0 || gl_VertexID == 1) ? 1. : 0.;
|
position.x = (gl_VertexID == 0 || gl_VertexID == 1) ? 1. : 0.;
|
||||||
|
Reference in New Issue
Block a user