Skip to content

Instantly share code, notes, and snippets.

@tomkrikorian
tomkrikorian / AGENTS.MD
Last active January 31, 2026 07:03
AGENTS.MD for visionOS 26 & Swift 6.2 development
name description
visionos-agent
Senior visionOS Engineer and Spatial Computing Expert for Apple Vision Pro development.

VISIONOS AGENT GUIDE

ROLE & PERSONA

You are a Senior visionOS Engineer and Spatial Computing Expert. You specialize in SwiftUI, RealityKit, and ARKit for Apple Vision Pro. Your code is optimized for the platform, adhering strictly to Apple's Human Interface Guidelines for spatial design.

@Matt54
Matt54 / MarchingCubesBlobParams.h
Created August 19, 2025 23:21
RealityKit Marching Cubes Blob (Metal + LowLevelMesh)
#ifndef MarchingCubesBlobParams_h
#define MarchingCubesBlobParams_h
#include <simd/simd.h>
typedef struct {
simd_float3 center;
float radius;
} Sphere;
@Matt54
Matt54 / ApplePlaneExample.swift
Last active June 10, 2025 00:57
RealityKit comparison of Apple's LowLevelMesh plane example on CPU to a Metal GPU implementation
import Foundation
import RealityKit
import SwiftUI
// See: https://developer.apple.com/documentation/realitykit/creating-a-plane-with-low-level-mesh
struct ApplePlaneExample: View {
var body: some View {
RealityView { content in
// Create a plane mesh.
if let planeMesh = try? PlaneMesh(size: [0.2, 0.2], dimensions: [16, 16]), let mesh = try? MeshResource(from: planeMesh.mesh) {
@Matt54
Matt54 / SphereMeshTextureComparisonView.swift
Created August 10, 2024 23:00
RealityView comparing built-in generateSphere with LowLevelMesh implementation - both having and excluding uv data in vertex attributes
import SwiftUI
import RealityKit
struct SphereMeshTextureComparisonView: View {
let latitudeBands = 128
let longitudeBands = 80
let radius: Float = 0.1
// Metal-related properties
let device: MTLDevice
@Matt54
Matt54 / LightBeamSynthView.swift
Last active September 22, 2025 17:22
RealityView of light beam synth with touch gesture interactions
import AVFoundation
import SwiftUI
import RealityKit
#Preview { LightBeamSynthView() }
struct LightBeamSynthView: View {
@Environment(\.physicalMetrics) var physicalMetrics
@State var outerCylinderEntity: Entity?
@State var innerCylinderEntity: Entity?
@State var touchEntity: Entity?
@Matt54
Matt54 / LaserSynthView.swift
Last active March 14, 2025 10:01
RealityView where a cylinder's detected SpatialEventGesture modulates a signal generator's output
import AVFoundation
import SwiftUI
import RealityKit
struct LaserSynthView: View {
@Environment(\.physicalMetrics) var physicalMetrics
let signalGenerator = SignalGenerator()
@State var outerCylinderEntity: Entity?
@State var innerCylinderEntity: Entity?
@Matt54
Matt54 / FireballCirclesAddBlendView.swift
Created August 6, 2024 02:16
RealityView resembling a fireball spell created from many low opacity spheres swarming around with add blend mode applied
import RealityKit
import SwiftUI
struct FireballCirclesAddBlendView: View {
@State var rootEntity: Entity?
@State var sphereTargets: [Entity: SIMD3<Float>] = [:]
@State private var rotationAngles: SIMD3<Float> = [0, 0, 0]
@State private var modulationTimer: Timer?
@State private var lastRotationUpdateTime = CACurrentMediaTime()
@Matt54
Matt54 / LowLevelMeshNormalsComparisonView.swift
Created August 4, 2024 14:48
RealityView comparing LowLevelMesh spheres with and without surface normal data
import SwiftUI
import RealityKit
struct LowLevelMeshNormalsComparisonView: View {
var body: some View {
RealityView { content in
let sphereWithoutNormals = try! sphereEntity(includeNormals: false)
sphereWithoutNormals.position.x = -0.11
let sphereWithNormals = try! sphereEntity(includeNormals: true)
@Matt54
Matt54 / MetalWavyPlaneView.swift
Created July 31, 2024 04:23
RealityView comparing a wave plane animation of a LowLevelMesh between a pure Swift and a Metal shader implementation
import SwiftUI
import RealityKit
import Metal
struct MetalWavyPlaneView: View {
@State private var phase: Float = 0.0
@State private var mesh: LowLevelMesh?
@State private var timer: Timer?
let resolution = 250
@Matt54
Matt54 / WavyPlaneView.swift
Created July 29, 2024 04:05
RealityView with a plane (modulated by a sine wave) and a point light
import SwiftUI
import RealityKit
struct WavyPlaneView: View {
@State private var phase: Float = 0.0
@State private var mesh: LowLevelMesh?
@State private var timer: Timer?
let resolution = 60
var body: some View {