44 lines
1.2 KiB
C++
44 lines
1.2 KiB
C++
/*
|
|
* 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/.
|
|
*/
|
|
|
|
#include "ArFrame.hpp"
|
|
#include "ArSession.hpp"
|
|
#include "ArRecorder.hpp"
|
|
#include <iostream>
|
|
#include <fstream>
|
|
|
|
namespace OpenVulkano::AR
|
|
{
|
|
ArFrame::ArFrame(const std::shared_ptr<ArSession>& session, size_t frameId)
|
|
: m_session(session), m_frameId(frameId)
|
|
, m_confidenceNormalisationFactor(session ? session->GetSessionMetadata().GetConfidenceNormalisationFactor() : 0.5f)
|
|
{}
|
|
|
|
void ArFrame::Save()
|
|
{
|
|
if (m_highRes)
|
|
m_session->GetRecorder().SaveHighResolution(shared_from_this());
|
|
else
|
|
m_session->GetRecorder().Save(shared_from_this());
|
|
}
|
|
|
|
void ArFrame::SaveToFile(const std::filesystem::path& path, bool downsample, bool includeAux)
|
|
{
|
|
m_session->GetRecorder().SaveToFile(shared_from_this(), path, downsample, includeAux);
|
|
}
|
|
|
|
const Scene::Texture* ArFrame::GetImageTexture()
|
|
{
|
|
if (!m_texture) m_texture = m_session->MakeTexture(this);
|
|
return m_texture;
|
|
}
|
|
|
|
ArFrame::~ArFrame()
|
|
{
|
|
if (m_texture) m_session->ReturnTexture(m_texture);
|
|
}
|
|
}
|