ejeinc / MetalScope

Metal-backed 360° panorama view for iOS
MIT License
324 stars 72 forks source link

eyeView indicator #27

Open turk-jk opened 7 years ago

turk-jk commented 7 years ago

how to show the eyeView indictor that we can see at the Top.Right of the GIF you included in the README

screen shot 2017-08-03 at 6 39 51 pm

amazing work. thanks

junpluse commented 7 years ago

Hi @turk-jk,

I'm really sorry for the late reply 🙇 For presenting eye (sight) indicator, use OrientationIndicatorView in MetalScope.

First, add new OrientationIndicatorView to your view.

let indicator = OrientationIndicatorView(frame: CGRect(x: 0, y: 0, width: 48, height: 48))
indicator.dataSource = panoramaView
view.addSubview(indicator)

Then update OrientationIndicatorView every frame. Using SCNSceneDelegate is the easiest way.

extension ViewController: SCNSceneRendererDelegate {
    func renderer(_ renderer: SCNSceneRenderer, updateAtTime time: TimeInterval) {
        // please make sure to update the indicator on main thread
        DispatchQueue.main.async { [weak self] in
            self?.orientationIndicator?.updateOrientation()
        }
    }
}