🎉 Add initial magic lamp code

This commit is contained in:
Simon Schneegans
2023-03-29 20:00:11 +02:00
parent e051551747
commit 6eebcc6b8c
6 changed files with 282 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
//////////////////////////////////////////////////////////////////////////////////////////
// ) ( //
// ( /( ( ( ) ( ( ( ( )\ ) ( ( //
// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( //
// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ //
// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) //
// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< //
// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ //
// |__/ //
//////////////////////////////////////////////////////////////////////////////////////////
// SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de>
// SPDX-License-Identifier: GPL-3.0-or-later
// The content from common.glsl is automatically prepended to each shader effect.
uniform vec2 uActorScale;
uniform vec2 uPointerPos;
uniform vec2 uControlPointA;
uniform vec2 uControlPointB;
void main() {
float progress = uForOpening ? 1.0 - uProgress : uProgress;
vec2 texcoord = iTexCoord.st;
texcoord = texcoord * uActorScale + 0.5 - uActorScale * 0.5;
vec4 oColor = getInputColor(texcoord);
oColor.rgb *= vec3(1.0, 0.5, 0.5);
if (length(texcoord - uPointerPos) < 0.02) {
oColor = vec4(1.0);
}
if (length(texcoord - uControlPointA) < 0.02) {
oColor = vec4(1.0, 0.0, 0.0, 1.0);
}
if (length(texcoord - uControlPointB) < 0.02) {
oColor = vec4(0.0, 1.0, 0.0, 1.0);
}
setOutputColor(oColor);
}