update the entite like crt shader it acc works and imrpoved blending of

the orverlay
its a lil dim but oh well
moved learning shader stuff to ShaderTestggvirw maybe integrate it
later?
This commit is contained in:
neon443
2025-08-26 17:44:06 +01:00
parent a5c6173951
commit a80ff66f6e
5 changed files with 72 additions and 75 deletions

View File

@@ -13,12 +13,19 @@ using namespace metal;
float2 uv = pos/size;
// scanwave
half3 newCol = 0.75 + 0.5 + 0.5 * sin(time*0.5 + uv.y*10);
half3 scanwave = 0.75 + 0.5 + 0.5 * sin(time*0.5 + uv.y*10);
//scanlines
newCol *= 0.5 + 0.5 * sin(uv.y * 1250.0);
half scanline = 0.5 + 0.5 * sin(uv.y * 1250.0);
scanline *= 0.5;
half3 newColor = scanwave*scanline;
half alpha = 1 - scanline;
alpha *= 0.75;
// half4 output = half4(layer.sample(pos).xyz*newCol, 1);
half4 output = half4(color.xyz*newCol*0.5, 0.5);
half4 output = half4(color.xyz*newColor*alpha, alpha);
return output;
}

View File

@@ -8,11 +8,67 @@
import SwiftUI
struct ShaderTestingView: View {
@State private var start = Date.now
var body: some View {
Image(systemName: "figure.walk.circle")
.font(.system(size: 300))
.foregroundStyle(.blue)
.colorEffect(ShaderLibrary.redify())
Section("Shaded") {
TimelineView(.animation) { tl in
let time = start.distance(to: tl.date)
Image(systemName: "figure.walk.circle")
.font(.system(size: 300))
.foregroundStyle(.blue)
.distortionEffect(
ShaderLibrary.wave(
.float(time)
),
maxSampleOffset: .zero
)
Rectangle()
.frame(width: 200, height: 100)
.padding(.vertical, 20)
.foregroundStyle(.red)
.compositingGroup()
.visualEffect {
content,
proxy in
content.distortionEffect(
ShaderLibrary.waveFlag(
.float(time),
.float2(proxy.size)
),
maxSampleOffset: CGSize(width: 0, height: 40)
)
}
}
}
Section("Shaded") {
TimelineView(.animation) { tl in
let time = start.distance(to: tl.date)
Rectangle()
.frame(width: 300, height: 200)
.colorEffect(
ShaderLibrary.sinebow(
.float2(300, 200),
.float(time)
)
)
Image(systemName: "figure.walk.circle")
.font(.system(size: 300))
.foregroundStyle(.blue)
.colorEffect(ShaderLibrary.rainbow(
.float(time)
))
}
}
Section("Original") {
Image(systemName: "figure.walk.circle")
.font(.system(size: 300))
.foregroundStyle(.blue)
}
}
}

View File

@@ -18,13 +18,6 @@ struct ContentView: View {
hostsManager.selectedTheme.background.suiColor.opacity(0.7)
.ignoresSafeArea(.all)
List {
ForEach(0..<6) {
Color.red.frame(width: 60, height: 60, alignment: .center)
.brightness(Double($0) * 0.2)
.overlay(Text("\(Double($0) * 0.2 * 100, specifier: "%.0f")%"),
alignment: .bottom)
.border(Color.gray)
}
SessionsListView(
handler: handler,
hostsManager: hostsManager,

View File

@@ -14,8 +14,6 @@ struct SettingsView: View {
@State private var blinkCursor: Int = 0
@State var blinkTimer: Timer?
@State private var start = Date.now
@State private var touch = CGPoint.zero
func startBlinkingIfNeeded() {
if hostsManager.settings.cursorType.blink {
@@ -40,66 +38,6 @@ struct SettingsView: View {
hostsManager.selectedTheme.background.suiColor.opacity(0.7)
.ignoresSafeArea(.all)
List {
Section("Shaded") {
TimelineView(.animation) { tl in
let time = start.distance(to: tl.date)
// Image(systemName: "figure.walk.circle")
// .font(.system(size: 300))
// .foregroundStyle(.blue)
// .distortionEffect(
// ShaderLibrary.wave(
// .float(time)
// ),
// maxSampleOffset: .zero
// )
// Rectangle()
// .frame(width: 200, height: 100)
// .padding(.vertical, 20)
// .foregroundStyle(.red)
// .compositingGroup()
// .visualEffect {
// content,
// proxy in
// content.distortionEffect(
// ShaderLibrary.waveFlag(
// .float(time),
// .float2(proxy.size)
// ),
// maxSampleOffset: CGSize(width: 0, height: 40)
// )
// }
// .gesture(
// DragGesture(minimumDistance: 0)
// .onChanged { touch = $0.location}
// )
}
}
Section("Shaded") {
TimelineView(.animation) { tl in
let time = start.distance(to: tl.date)
Rectangle()
.frame(width: 300, height: 200)
.colorEffect(
ShaderLibrary.sinebow(
.float2(300, 200),
.float(time)
)
)
// Image(systemName: "figure.walk.circle")
// .font(.system(size: 300))
// .foregroundStyle(.blue)
// .colorEffect(ShaderLibrary.rainbow(
// .float(time)
// ))
}
}
Section("Original") {
Image(systemName: "figure.walk.circle")
.font(.system(size: 300))
.foregroundStyle(.blue)
}
Section("Terminal") {
VStack(alignment: .leading) {
HStack {

View File

@@ -36,9 +36,12 @@ struct ShellView: View {
// maxSampleOffset: .zero
// )
// }
// .blendMode(.screen)
.overlay {
if hostsManager.settings.filter == .crt {
CRTView()
.opacity(0.75)
.allowsHitTesting(false)
}
}