Skip to content

Instantly share code, notes, and snippets.

@vdc-lab
vdc-lab / ModelIOLoader.swift
Created October 14, 2025 07:33 — forked from Matt54/ModelIOLoader.swift
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"])
}