aboutsummaryrefslogtreecommitdiff
path: root/wiki/Configuration:-Animations.md
diff options
context:
space:
mode:
Diffstat (limited to 'wiki/Configuration:-Animations.md')
-rw-r--r--wiki/Configuration:-Animations.md22
1 files changed, 7 insertions, 15 deletions
diff --git a/wiki/Configuration:-Animations.md b/wiki/Configuration:-Animations.md
index 8c933fdd..440d10fa 100644
--- a/wiki/Configuration:-Animations.md
+++ b/wiki/Configuration:-Animations.md
@@ -234,31 +234,23 @@ See [this example shader](./examples/resize-custom-shader.frag) for a full docum
If a custom shader fails to compile, niri will print a warning and fall back to the default, or previous successfully compiled shader.
-> [!NOTE]
+> [!WARNING]
>
> Custom shaders do not have a backwards compatibility guarantee.
> I may need to change their interface as I'm developing new features.
+Example: resize will show the next (after resize) window texture right away, stretched to the current geometry.
+
```
animations {
window-resize {
spring damping-ratio=1.0 stiffness=800 epsilon=0.0001
custom-shader r"
- #version 100
- precision mediump float;
-
- varying vec2 v_coords;
- uniform mat3 input_to_curr_geo;
- uniform sampler2D tex_next;
- uniform mat3 geo_to_tex_next;
- uniform float alpha;
-
- void main() {
- vec3 coords_curr_geo = input_to_curr_geo * vec3(v_coords, 1.0);
- vec3 coords_tex_next = geo_to_tex_next * coords_curr_geo;
- vec4 color = texture2D(tex_next, vec2(coords_tex_next));
- gl_FragColor = color * alpha;
+ vec4 resize_color(vec3 coords_curr_geo, vec3 size_curr_geo) {
+ vec3 coords_tex_next = niri_geo_to_tex_next * coords_curr_geo;
+ vec4 color = texture2D(niri_tex_next, coords_tex_next.st);
+ return color;
}
"
}