This commit is contained in:
2024-06-01 20:14:53 +02:00
parent 72adfd9506
commit 29ed9d2f6b
16 changed files with 975 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,13 @@
{
"images" : [
{
"idiom" : "universal",
"platform" : "watchos",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,29 @@
//
// ContentView.swift
// watchos_glsl Watch App
//
// Created by Beppe Vanrolleghem on 01/06/2024.
//
import SwiftUI
import SceneKit
struct ContentView: View {
var gameScene:SCNScene = SCNScene()
var cameraNode:SCNNode = SCNNode()
var shader:SCNTechnique = SCNTechnique(dictionary: ["program" : "./test.fsh"])!
var targetCreationTime:TimeInterval = 0
var body: some View {
VStack {
SceneView(scene:gameScene, technique:shader)
}
.padding()
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}

View File

@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,29 @@
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;
#define PI 3.14159265359
const vec3 uAColor = vec3(.5,.5,.5);
const vec3 uBColor = vec3(.5,.5,.5);
const vec3 uCColor = vec3(1.,1.,1.);
const vec3 uDColor = vec3(.0,.33,.67);
//get colors from http://dev.thi.ng/gradients/
vec3 cosPalette(float t) {
return uAColor + uBColor*cos(6.28318*(uCColor*t+uDColor));
}
void main() {
vec2 st = gl_FragCoord.xy/u_resolution;
vec3 color = vec3(0.0,0.0,0.0);
float alpha = 1.0;
gl_FragColor = vec4(color, alpha);
}

View File

@@ -0,0 +1,33 @@
//
// test1.metal
// watchos_glsl Watch App
//
// Created by Beppe Vanrolleghem on 01/06/2024.
//
#include <metal_stdlib>
using namespace metal;
#include <SceneKit/scn_metal>
struct Uniforms {
float2 resolution;
float time;
};
struct FragmentIn {
float4 position [[position]];
float2 st;
};
[[fragment]]
float4 fragment_main(FragmentIn in [[stage_in]],
constant Uniforms &uniforms [[buffer(0)]]) {
float3 color = float3(1.,.0,.0);
return float4(color, 1.);
}
[[stitchable]]
half4 testfn(float2 position, half4 color) {
return color;
}

View File

@@ -0,0 +1,17 @@
//
// watchos_glslApp.swift
// watchos_glsl Watch App
//
// Created by Beppe Vanrolleghem on 01/06/2024.
//
import SwiftUI
@main
struct watchos_glsl_Watch_AppApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}