diff --git a/scripts/gameplay/crit_line.lua b/scripts/gameplay/crit_line.lua index 0541641..b429551 100644 --- a/scripts/gameplay/crit_line.lua +++ b/scripts/gameplay/crit_line.lua @@ -18,6 +18,9 @@ local cursorGlowTopImages = { gfx.CreateSkinImage("gameplay/crit_line/cursor_glow_top_right.png", 0), } +local cursorGlowWhite = gfx.CreateSkinImage("gameplay/crit_line/cursor_glow_white.png", 0); +local cursorGlowColor = gfx.CreateSkinImage("gameplay/crit_line/cursor_glow_color.png", 0); + local CRITBAR_W = 1080 local CRITBAR_H = 251 @@ -39,6 +42,11 @@ local drawCursors = function (centerX, centerY,cursors) local cursorX = cursor.pos * (1 / scale) - cursorW / 2; local cursorY = -cursorH / 2; + local glowAlpha = cursor.alpha; + if (i == 1) then glowAlpha = glowAlpha * 0.7; end + + local r, g, b = game.GetLaserColor(i); + gfx.ImageRect( cursorX, cursorY, @@ -54,11 +62,23 @@ local drawCursors = function (centerX, centerY,cursors) cursorY, cursorW, cursorH, - cursorGlowBottomImages[i+1], - cursor.alpha, + cursorGlowWhite, + glowAlpha, 0 ); + gfx.SetImageTint(r, g, b); + gfx.ImageRect( + cursorX, + cursorY, + cursorW, + cursorH, + cursorGlowColor, + glowAlpha, + 0 + ); + + gfx.SetImageTint(255, 255, 255); gfx.ImageRect( cursorX, cursorY, @@ -74,11 +94,23 @@ local drawCursors = function (centerX, centerY,cursors) cursorY, cursorW, cursorH, - cursorGlowTopImages[i+1], - cursor.alpha, + cursorGlowWhite, + glowAlpha, 0 ); - + + gfx.SetImageTint(r, g, b); + gfx.ImageRect( + cursorX, + cursorY, + cursorW, + cursorH, + cursorGlowColor, + glowAlpha, + 0 + ); + + gfx.SetImageTint(255, 255, 255); gfx.Restore(); end end diff --git a/shaders/laser.fs b/shaders/laser.fs index 0914f58..079bdc0 100644 --- a/shaders/laser.fs +++ b/shaders/laser.fs @@ -20,10 +20,27 @@ uniform int hitState; const float laserSize = 1.0675; +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() { if (laserPart == 1) { target = texture(mainTex, fsTex); - return; } @@ -40,8 +57,26 @@ void main() { x += (laserSize / 2); float y = 0.25 * ceil(float(hitState)) + 0.01; + vec4 channels = texture(mainTex, vec2(x, y)); - float visiblityMultiplier = 1; + vec3 baseColor = color.rgb * channels.g; + vec3 baseHsv = rgb2hsv(baseColor); - target = texture(mainTex, vec2(x, y)) * vec4(visiblityMultiplier,visiblityMultiplier,visiblityMultiplier,1); + float h = baseHsv.x; + + float hilightHue = 0.0; + if (h < 2.0 / 12.0) + hilightHue = 1.0 - smoothstep(0, 1.0 / 12.0, h); + else hilightHue = smoothstep(2.0 / 12.0, 6.0 / 12.0, h); + + hilightHue = mod((280.0 / 360.0) + (hilightHue * 140.0 / 360.0), 1.0); + vec3 hilightColor = hsv2rgb(vec3(hilightHue, 1, 1)); + + baseColor = baseColor * (1.0 - channels.b) + vec3(channels.b); + + //hilightColor = hilightColor * channels.r; + + vec3 mixedColor = clamp(mix(baseColor, hilightColor, channels.r), 0.0, 1.0); + + target = vec4(mixedColor, 1); } \ No newline at end of file diff --git a/textures/gameplay/crit_line/cursor_glow_color.png b/textures/gameplay/crit_line/cursor_glow_color.png new file mode 100644 index 0000000..6159d5f Binary files /dev/null and b/textures/gameplay/crit_line/cursor_glow_color.png differ diff --git a/textures/gameplay/crit_line/cursor_glow_white.png b/textures/gameplay/crit_line/cursor_glow_white.png new file mode 100644 index 0000000..e4e003c Binary files /dev/null and b/textures/gameplay/crit_line/cursor_glow_white.png differ diff --git a/textures/laser_entry_l.png b/textures/laser_entry_l.png index d36a9ea..7e9ccfd 100644 Binary files a/textures/laser_entry_l.png and b/textures/laser_entry_l.png differ diff --git a/textures/laser_entry_r.png b/textures/laser_entry_r.png index 20427ce..1be755f 100644 Binary files a/textures/laser_entry_r.png and b/textures/laser_entry_r.png differ diff --git a/textures/laser_exit_l.png b/textures/laser_exit_l.png index ebbb650..43b71c0 100644 Binary files a/textures/laser_exit_l.png and b/textures/laser_exit_l.png differ diff --git a/textures/laser_exit_r.png b/textures/laser_exit_r.png index 8996a4f..43b71c0 100644 Binary files a/textures/laser_exit_r.png and b/textures/laser_exit_r.png differ diff --git a/textures/laser_l.png b/textures/laser_l.png index 2979412..b36e12b 100644 Binary files a/textures/laser_l.png and b/textures/laser_l.png differ diff --git a/textures/laser_r.png b/textures/laser_r.png index 49848b2..b36e12b 100644 Binary files a/textures/laser_r.png and b/textures/laser_r.png differ diff --git a/textures/track - Copy.png b/textures/track - Copy.png new file mode 100644 index 0000000..a51f6b3 Binary files /dev/null and b/textures/track - Copy.png differ