Add ArRecorder logic

This commit is contained in:
2021-06-30 19:35:10 +02:00
parent b3284ae096
commit 5f85d07609
10 changed files with 263 additions and 38 deletions

View File

@@ -10,6 +10,7 @@
#include "ArConstans.hpp"
#include "ArTrackingState.hpp"
#include "ArSessionMetadata.hpp"
#include "ArRecorder.hpp"
#include "Math/Range.hpp"
#include "Base/Event.hpp"
#include <memory>
@@ -22,7 +23,6 @@ namespace openVulkanoCpp::AR
{
class ArSession;
class ArFrame;
class ArRecorder;
enum class ArSessionType
{
@@ -35,18 +35,16 @@ namespace openVulkanoCpp::AR
ArSessionType sessionType = ArSessionType::NATIVE;
bool uncompressed = true;
bool depthSupported = false;
bool recordingSupported = false;
public:
ArSessionCapabilities() = default;
ArSessionCapabilities(const ArType type, const ArSessionType sessionType, const bool uncompressed, const bool depthSupported, const bool recordingSupported)
: type(type), sessionType(sessionType), uncompressed(uncompressed), depthSupported(depthSupported), recordingSupported(recordingSupported)
: type(type), sessionType(sessionType), uncompressed(uncompressed), depthSupported(depthSupported)
{}
[[nodiscard]] bool IsUncompressed() const { return uncompressed; }
[[nodiscard]] bool IsDepthSupported() const { return depthSupported; }
[[nodiscard]] bool IsRecordingSupported() const { return recordingSupported; }
[[nodiscard]] bool IsNative() const { return sessionType == ArSessionType::NATIVE; }
[[nodiscard]] bool IsPlayback() const { return sessionType == ArSessionType::PLAYBACK; }
[[nodiscard]] bool IsStream() const { return sessionType == ArSessionType::NETWORK_STREAM; }
@@ -73,7 +71,7 @@ namespace openVulkanoCpp::AR
class ArSession
{
protected:
ArSession(const ArSessionMetadata& metadata) : metadata(metadata) {}
ArSession(const ArSessionMetadata& metadata) : metadata(metadata), recorder(this) {}
public:
/**
@@ -173,7 +171,7 @@ namespace openVulkanoCpp::AR
* The ArRecorder for this ArSession.
* @return ArRecorder instance or nullptr if the ArSession does not support recording.
*/
[[nodiscard]] virtual ArRecorder* GetRecorder() = 0;
[[nodiscard]] ArRecorder& GetRecorder() { return recorder; };
/**
* Gets the type of the AR session.
@@ -219,6 +217,8 @@ namespace openVulkanoCpp::AR
ArSessionMetadata metadata;
private:
ArRecorder recorder;
static std::vector<std::weak_ptr<ArSession>> sessions;
static std::weak_ptr<ArSession> nativeSession;
};