Skip to content

Instantly share code, notes, and snippets.

View ManjitBedi's full-sized avatar
💭
working on some projects using Unity & coding in c#

Manjit Bedi ManjitBedi

💭
working on some projects using Unity & coding in c#
View GitHub Profile
@tomkrikorian
tomkrikorian / AGENTS.MD
Last active December 8, 2025 17:56
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.

#include <metal_stdlib>
#include <SwiftUI/SwiftUI.h>
using namespace metal;
// 画面の曲面歪みを適用する関数
// この関数は、CRTモニターの曲面ガラスによる画像の歪みをシミュレートします。
// UV座標(0.0〜1.0の正規化座標)を入力とし、中央からの距離に基づいて
// バレル歪み(barrel distortion)を適用します。これにより、画面の端が
// 外側に膨張するような効果が生まれ、レトロなCRTの視覚を再現します。
// - Parameters:
@Matt54
Matt54 / ModelIOLoader.swift
Last active October 14, 2025 07:33
PLY to RealityKit with Grid-Based Decimation (Example: HD Skeleton Scan)
import Foundation
import ModelIO
import simd
nonisolated func loadMeshWithModelIO(from url: URL) throws -> TriangleMesh {
let asset = MDLAsset(url: url)
guard asset.count > 0 else {
throw NSError(domain: "ModelIO", code: 1, userInfo: [NSLocalizedDescriptionKey: "No objects found in file"])
}
@Matt54
Matt54 / EasingCurve.swift
Created October 2, 2025 04:22
RealityKit SDF Falling Sand Animation (Metal + LowLevelMesh + Marching Cubes)
import Foundation
enum EasingCurve {
case linear
case easeIn(Float)
case easeOut(Float)
case easeInOut(Float)
func apply(_ t: Float) -> Float {
let t = max(0, min(1, t))
@Matt54
Matt54 / ExtrudedTextLowLevelMeshView.swift
Created September 25, 2025 02:50
RealityKit Extruded Text to LowLevelMesh animated by Metal compute shader
import Metal
import RealityKit
import SwiftUI
#Preview { ExtrudedTextLowLevelMeshView() }
struct ExtrudedTextLowLevelMeshView: View {
@State var lowLevelMesh: LowLevelMesh?
@State var originalVerticesBuffer: MTLBuffer?
@State var timer: Timer?
@Matt54
Matt54 / EasingCurve.swift
Last active October 5, 2025 18:27
RealityKit Explode and Assemble SDF Shape (Metal + LowLevelMesh + Marching Cubes)
import Foundation
enum EasingCurve {
case linear
case easeIn(Float)
case easeOut(Float)
case easeInOut(Float)
func apply(_ t: Float) -> Float {
let t = max(0, min(1, t))
@Matt54
Matt54 / MarchingCubesColorBlobParams.h
Last active November 21, 2025 20:55
RealityKit Color-Blending Metaballs (Metal + LowLevelMesh + Marching Cubes)
#ifndef MarchingCubesColorBlobParams_h
#define MarchingCubesColorBlobParams_h
#include <simd/simd.h>
typedef struct {
simd_float3 center;
float radius;
simd_float3 color;
float _pad;
@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 / HeightMapParams.h
Last active June 18, 2025 12:19
RealityKit HeightMap Image to Terrain with LowLevelMesh and LowLevelTexture
#ifndef HeightMapParams_h
#define HeightMapParams_h
struct HeightMapParams {
simd_float2 size;
simd_uint2 dimensions;
};
#endif /* HeightMapParams_h */
@Matt54
Matt54 / MorphSphere.metal
Last active May 26, 2025 16:41
RealityView - organic, wave-like sphere morphing using LowLevelMesh and Metal
#include <metal_stdlib>
using namespace metal;
struct VertexData {
float3 position;
float3 normal;
float2 uv;
};
struct MorphingSphereParams {