Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/audulus/mslview
Shadertoy-style SwiftUI view
https://github.com/audulus/mslview
ios macos metal swiftui
Last synced: 3 months ago
JSON representation
Shadertoy-style SwiftUI view
- Host: GitHub
- URL: https://github.com/audulus/mslview
- Owner: audulus
- License: mit
- Created: 2022-02-14T15:44:23.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-03-04T20:25:35.000Z (almost 3 years ago)
- Last Synced: 2023-02-27T11:50:52.752Z (almost 2 years ago)
- Topics: ios, macos, metal, swiftui
- Language: Swift
- Homepage:
- Size: 35.2 KB
- Stars: 41
- Watchers: 1
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MSLView
![build status](https://github.com/audulus/MSLView/actions/workflows/build.yml/badge.svg)
SwiftUI view for Shadertoy-style MSL shaders
```Swift
import MSLViewstruct Constants {
var r: Float
}struct ContentView: View {
@State var constants = Constants(r: 0)
let shader = """
struct Constants {
float r;
};
fragment float4 mainImage(FragmentIn input [[stage_in]],
constant Constants& c,
constant uint2& viewSize) {
return float4(c.r,
input.position.x/viewSize.x,
input.position.y/viewSize.y,1);
}
"""var body: some View {
VStack {
MSLView(shader: shader, constants: constants)
HStack {
Slider(value: $constants.r)
Text("\(constants.r)")
}.padding()
}
}}
```