Merge pull request #489 from kokoko3k/master

Add a fast curvature function that tries to survive "Dolby ears®"
This commit is contained in:
hizzlekizzle 2023-09-27 14:09:22 -05:00 committed by GitHub
commit 44f1a2d85f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -29,6 +29,20 @@ vec2 tl_warp(vec2 pos)
return pos*0.5 + 0.5; 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 // cgwg's geom
// license: GPLv2 // license: GPLv2
@ -99,6 +113,8 @@ vec2 cgwg_warp(vec2 coord)
vec2(1.0, 1.0)/aspect + vec2(0.5, 0.5)); vec2(1.0, 1.0)/aspect + vec2(0.5, 0.5));
} }
float corner(vec2 coord) float corner(vec2 coord)
{ {
coord = (coord - vec2(0.5)) + vec2(0.5, 0.5); coord = (coord - vec2(0.5)) + vec2(0.5, 0.5);