Add initial ArKit support
This commit is contained in:
61
openVulkanoCpp/AR/Provider/ArKit/ArSessionArKitInternal.h
Normal file
61
openVulkanoCpp/AR/Provider/ArKit/ArSessionArKitInternal.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* 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 <atomic>
|
||||
|
||||
#import <ARKit/ARSession.h>
|
||||
#import <ARKit/ARConfiguration.h>
|
||||
|
||||
@class ArKitDelegate;
|
||||
|
||||
namespace openVulkanoCpp::AR::ArKit
|
||||
{
|
||||
class ArSessionArKitInternal final : public ArSessionArKit, public std::enable_shared_from_this<ArSessionArKitInternal>
|
||||
{
|
||||
public:
|
||||
ArSessionArKitInternal(const ArSessionConfig& config);
|
||||
|
||||
~ArSessionArKitInternal() override;
|
||||
|
||||
void Start() override;
|
||||
|
||||
void Stop() override;
|
||||
|
||||
void Pause() override;
|
||||
|
||||
[[nodiscard]] std::shared_ptr<ArFrame> 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<std::shared_ptr<ArFrame>> m_frame;
|
||||
#else
|
||||
SpintexProtectedObject<std::shared_ptr<ArFrame>> m_frame;
|
||||
#endif
|
||||
std::atomic_size_t m_frameId;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user