charter progress

This commit is contained in:
Yoshman29
2023-03-20 13:57:33 +01:00
parent 139d5daefa
commit 2232d19fa2
15 changed files with 221 additions and 25 deletions
+3
View File
@@ -0,0 +1,3 @@
THOSE SHADERS ARE USED INTERNALLY BY THE ENGINE
MODIFY THEM AT YOUR OWN RISK!! IF IT CRASHES IT AINT MY FAULT
+9
View File
@@ -0,0 +1,9 @@
#pragma header
uniform vec3 noteColor;
void main() {
vec4 finalColor = flixel_texture2D(bitmap, openfl_TextureCoordv);
float diff = finalColor.r - ((finalColor.g + finalColor.b) / 2.0);
gl_FragColor = vec4(((finalColor.g + finalColor.b) / 2.0) + (noteColor.r * diff), finalColor.g + (noteColor.g * diff), finalColor.b + (noteColor.b * diff), finalColor.a);
}
@@ -0,0 +1,11 @@
#pragma header
// shader used in GitHub credits
void main() {
float len = length(openfl_TextureCoordv - vec2(0.5, 0.5));
float r = 0.5 - (1.0 / openfl_TextureSize.x);
vec4 c = flixel_texture2D(bitmap, openfl_TextureCoordv);
vec4 color = mix(vec4(0, 0, 0, 0.5), c, c.a);
gl_FragColor = color * clamp(1 - ((len - r) * openfl_TextureSize.x), 0, 1);
}
+30
View File
@@ -0,0 +1,30 @@
#pragma header
#define PI 3.14159265359
int steps = 16;
int stepsInside = 2;
float strength = 0.0075;
vec4 getColor(vec2 pos) {
if (pos.x < 0) pos.x = 0;
else if (pos.x > 1.0 - (1.0 / openfl_TextureSize.x)) pos.x = 1.0 - (1.0 / openfl_TextureSize.x);
if (pos.y < 0) pos.y = 0;
else if (pos.y > 1.0 - (1.0 / openfl_TextureSize.y)) pos.y = 1.0 - (1.0 / openfl_TextureSize.y);
return textureCam(bitmap, pos);
}
void main() {
vec2 camPos = getCamPos(openfl_TextureCoordv);
if (camPos.x < 0 || camPos.x > 1 || camPos.y < 0 || camPos.y > 1)
return;
vec4 color = getColor(camPos);
float fsteps = steps;
for(float inside = 1; inside < stepsInside+1; inside++) {
for(int i = 0; i < steps; i++) {
float fi = i;
color += getColor(camPos + vec2(strength * (inside / stepsInside) * cos(fi / fsteps * (PI * 2.0)), strength * (inside / stepsInside) * sin(fi / fsteps * (PI * 2.0))));
}
}
color /= steps * stepsInside;
gl_FragColor = color;
}
+34
View File
@@ -0,0 +1,34 @@
#pragma header
uniform float elapsed;
uniform float strength;
vec3 rgb2hsv(vec3 c)
{
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
float d = q.x - min(q.w, q.y);
float e = 1.0e-10;
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
}
vec3 hsv2rgb(vec3 c)
{
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}
void main() {
vec2 coords = getCamPos(openfl_TextureCoordv);
vec4 color = flixel_texture2D(bitmap, openfl_TextureCoordv);
vec3 hsv = rgb2hsv(color.rgb);
hsv.g = (1.0/3.0) * strength * coords.y;
hsv.r = mod(elapsed + coords.x + coords.y, 1);
gl_FragColor = vec4(hsv2rgb(hsv), color.a);
}