mirror of
https://github.com/bvanroll/watchos_glsl.git
synced 2025-08-29 03:52:41 +00:00
init
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"colors" : [
|
||||
{
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"platform" : "watchos",
|
||||
"size" : "1024x1024"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
6
watchos_glsl Watch App/Assets.xcassets/Contents.json
Normal file
6
watchos_glsl Watch App/Assets.xcassets/Contents.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
29
watchos_glsl Watch App/ContentView.swift
Normal file
29
watchos_glsl Watch App/ContentView.swift
Normal 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()
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
29
watchos_glsl Watch App/test.fsh
Normal file
29
watchos_glsl Watch App/test.fsh
Normal 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);
|
||||
}
|
33
watchos_glsl Watch App/test1.metal
Normal file
33
watchos_glsl Watch App/test1.metal
Normal 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;
|
||||
}
|
17
watchos_glsl Watch App/watchos_glslApp.swift
Normal file
17
watchos_glsl Watch App/watchos_glslApp.swift
Normal 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()
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user