49 lines
1.2 KiB
C++
49 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
|
|
{
|
|
float ArFrame::GetConfidenceNormalisationFactor() const
|
|
{
|
|
return m_session->GetSessionMetadata().GetConfidenceNormalisationFactor();
|
|
}
|
|
|
|
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)
|
|
{
|
|
m_session->GetRecorder().SaveToFile(shared_from_this(), path, downsample);
|
|
std::string metaContent = GetFrameMetadata().ToXML();
|
|
std::string metaPath = path.string() + std::string(".meta");
|
|
std::ofstream file (metaPath, std::ios::out);
|
|
file << metaContent;
|
|
file.close();
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|