From 5766ed2fbfd3929e72f520345d00fdb08efc38f2 Mon Sep 17 00:00:00 2001 From: Antonio Orefice Date: Wed, 27 Sep 2023 11:14:32 +0200 Subject: [PATCH] =?UTF-8?q?Add=20a=20fast=20curvature=20function=20that=20?= =?UTF-8?q?try=20to=20survive=20"Dolby=20ears=C2=AE"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/img/curvature.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/img/curvature.h b/include/img/curvature.h index a5773f5..a0dd8f4 100644 --- a/include/img/curvature.h +++ b/include/img/curvature.h @@ -29,6 +29,20 @@ vec2 tl_warp(vec2 pos) return pos*0.5 + 0.5; } +/* Curvature by kokoko3k, GPL-3.0 license + * w.x and w.y are global warp parameters + * protrusion is the rounded shape near the middle + * keep protrusion higher than ~0.5 +*/ +vec2 Warp_koko(vec2 co, vec2 w, float protrusion) { + float czoom = 1 - distance(co, vec2(0.5)); + czoom = mix(czoom, czoom * protrusion, czoom); + vec2 czoom2d = mix(vec2(1.0), vec2(czoom), w); + vec2 coff = mix( vec2(0.0), vec2(0.625), w); + return zoomxy(co, coff + czoom2d ); +} + + // cgwg's geom // license: GPLv2 @@ -99,6 +113,8 @@ vec2 cgwg_warp(vec2 coord) vec2(1.0, 1.0)/aspect + vec2(0.5, 0.5)); } + + float corner(vec2 coord) { coord = (coord - vec2(0.5)) + vec2(0.5, 0.5);