MetalScope
Metal-backed 360° panorama view for iOS
Install / Use
/learn @ejeinc/MetalScopeREADME
MetalScope
Metal-backed 360° panorama view for iOS.
| | Features |--------------------------|--------- | :metal: | Built on top of SceneKit + Metal | :eyes: | Distorted stereo view for Cardboard | :globe_with_meridians: | Support mono/stereo equirectangular images/videos | :arrow_forward: | Direct access to AVPlayer for video control | :point_up_2: | Smooth touch rotation and re-centering | :sunrise_over_mountains: | Custom SCNScene presentation | :bird: | Written in Swift 3
Usage
PanoramaView
Use PanoramaView to display an equirectangular image or video.
import MetalScope
import Metal
import AVFoundation
guard let device = MTLCreateSystemDefaultDevice() else {
fatalError("MetalScope requires Metal 🤘")
}
let panoramaView = PanoramaView(frame: ..., device: device)
// load monoscopic panorama image
let panoramaImage = UIImage(...)
panoramaView.load(panoramaImage, format: .mono)
// load stereoscopic panorama video
let videoURL = URL(...)
let player = AVPlayer(url: videoURL)
panoramaView.load(player, format: .stereoOverUnder)
player.play()
// load any SCNScene
panoramaView.scene = ...
PanoramaView rotates the point of view by device motions and user's pan gesture. To reset rotation, just call setNeedsResetRotation()
let panoramaView: PanoramaView = ...
// double tap to re-center the scene
let recognizer = UITapGestureRecognizer(
target: panoramaView,
action: #selector(PanoramaView.setNeedsResetRotation(_:)))
recognizer.numberOfTapsRequired = 2
panoramaView.addGestureRecognizer(recognizer)
// if you want to disable pan gesture:
panoramaView.panGestureRecognizer.isEnabled = false

60 FPS demo on YouTube
StereoView
For stereo display for Google's Cardboard, use StereoView or StereoViewController instead.
let stereoViewController = StereoViewController(device: ...)
// load media
stereoViewController.load(image, format: .stereoOverUnder)
// or any SCNScene
stereoViewController.scene = panoramaView.scene
// customize stereo parameters if needed
stereoViewController.stereoParameters = StereoParameters(
screenModel: .default,
viewerModel: .cardboardMay2015)
present(stereoViewController, animated: true, completion: nil)

Check example apps for more samples.
Simulator
PanoramaView, StereoView and StereoViewController can also be used on iOS simulator by using alternative initializers.
#if arch(arm) || arch(arm64)
let panoramaView = PanoramaView(frame: view.bounds, device: device)
#else
let panoramaView = PanoramaView(frame: view.bounds) // simulator
#endif
Please note that these classes are significantly limited in functionality on the simulator. For example, PanoramaView can display photos, but cannot display videos. For StereoView and StereoViewController, it is a placeholder and nothing is displayed.
Requirements
- Xcode 8.2+
- iOS 9.0+
- Swift 3.0+
- Metal (Apple A7+)
NOTE: Metal is not supported in the iOS Simulator 😢
Installation
Carthage
If you use Carthage to manage your dependencies, add MetalScope to your Cartfile:
github "ejeinc/MetalScope"
CocoaPods
If you use CocoaPods to manage your dependencies, add MetalScope to your Podfile:
pod 'MetalScope'
Manually
You can also manually install the framework by dragging and dropping the MetalScope.xcodeproj into your project or workspace.
License
MetalScope is released under the MIT license. See LICENSE for details.
Related Skills
qqbot-channel
345.9kQQ 频道管理技能。查询频道列表、子频道、成员、发帖、公告、日程等操作。使用 qqbot_channel_api 工具代理 QQ 开放平台 HTTP 接口,自动处理 Token 鉴权。当用户需要查看频道、管理子频道、查询成员、发布帖子/公告/日程时使用。
docs-writer
100.0k`docs-writer` skill instructions As an expert technical writer and editor for the Gemini CLI project, you produce accurate, clear, and consistent documentation. When asked to write, edit, or revie
model-usage
345.9kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
arscontexta
2.9kClaude Code plugin that generates individualized knowledge systems from conversation. You describe how you think and work, have a conversation and get a complete second brain as markdown files you own.
