mirror of
https://github.com/neon443/ShhShell.git
synced 2026-03-11 13:26:16 +00:00
okay actually got scanlines
but fucked it over when applying it to the app
This commit is contained in:
@@ -9,6 +9,18 @@
|
||||
#include <SwiftUI/SwiftUI_Metal.h>
|
||||
using namespace metal;
|
||||
|
||||
[[ stitchable ]] half4 crt(float2 pos, half4 color, float2 size, float time) {
|
||||
float2 uv = pos/size;
|
||||
|
||||
// scanwave
|
||||
half3 newCol = 0.75 + 0.5 + 0.5 * sin(time + uv.y*10 + half3(0));
|
||||
|
||||
//scanlines
|
||||
newCol *= 0.5 + 0.5 * sin(uv.y * 1000.0 + half3(0));
|
||||
half4 output = half4(color.xyz*newCol, 1);
|
||||
return output;
|
||||
}
|
||||
|
||||
//learning shaders stuff here
|
||||
[[ stitchable ]] half4 sinebow(float2 pos, half4 color, float2 size, float time) {
|
||||
float2 uv = (pos/size.x) * 2.0 - 1.0;
|
||||
|
||||
@@ -12,7 +12,11 @@ struct ContentView: View {
|
||||
@ObservedObject var hostsManager: HostsManager
|
||||
@ObservedObject var keyManager: KeyManager
|
||||
|
||||
@State private var spawnTime: Date = .now
|
||||
|
||||
var body: some View {
|
||||
TimelineView(.animation) { tl in
|
||||
let time = tl.date.distance(to: spawnTime)
|
||||
NavigationStack {
|
||||
ZStack {
|
||||
hostsManager.selectedTheme.background.suiColor.opacity(0.7)
|
||||
@@ -98,6 +102,14 @@ struct ContentView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
.visualEffect { content, proxy in
|
||||
content
|
||||
.colorEffect(ShaderLibrary.crt(
|
||||
.float2(proxy.size),
|
||||
.float(time)
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user