/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ #pragma once #include "ArSessionArKit.h" #include "Data/Concurent/MutexProtectedObject.hpp" #include #import #import @class ArKitDelegate; namespace OpenVulkano::AR::ArKit { class ArSessionArKitInternal final : public ArSessionArKit, public std::enable_shared_from_this { public: ArSessionArKitInternal(const ArSessionConfig& config); ~ArSessionArKitInternal() override; void Start() override; void Stop() override; void Pause() override; [[nodiscard]] std::shared_ptr GetFrame() override; void RequestHighResolutionFrame() override; size_t GetFrameId() { return m_frameId++; } // AR Kit delegate events void OnArNewFrame(ARSession* session, ARFrame* frame); void OnArSessionInterruptedChanged(ARSession* session, bool interrupted); void OnArSessionFailed(ARSession* session, NSError* error); void OnArCameraTrackingChange(ARSession* session, ARCamera* camera); void OnArAnchorsUpdate(NSArray<__kindof ARAnchor*>* anchors); bool ArShouldAttemptRelocalization(); private: ArKitDelegate* m_arKitDelegate; ARWorldTrackingConfiguration* m_arConfig; ARSession* m_arSession; #if (__cplusplus >= 202002L) std::atomic> m_frame; #else SpintexProtectedObject> m_frame; #endif std::atomic_size_t m_frameId; }; }