51 lines
1.1 KiB
C++
51 lines
1.1 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/.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "Base/Wrapper.hpp"
|
|
#include "Scene/Drawable.hpp"
|
|
#include "Scene/Shader/Shader.hpp"
|
|
#include "Scene/Texture.hpp"
|
|
#include "Scene/UniformBuffer.hpp"
|
|
|
|
namespace OpenVulkano
|
|
{
|
|
namespace AR
|
|
{
|
|
class ArSession;
|
|
class ArFrame;
|
|
}
|
|
|
|
namespace Scene
|
|
{
|
|
class ArBackgroundDrawable final : public Drawable
|
|
{
|
|
Shader m_shader;
|
|
UniformBuffer m_intrinsicsBuffer;
|
|
Ptr<AR::ArSession> m_arSession;
|
|
Ptr<AR::ArFrame> m_nextFrame, m_currentFrame, m_lastFrame;
|
|
const Texture* m_texture;
|
|
|
|
void OnNewArFrame(const Ptr<AR::ArFrame>& frame);
|
|
|
|
public:
|
|
ArBackgroundDrawable(const Ptr<AR::ArSession>& arSession = nullptr);
|
|
|
|
~ArBackgroundDrawable() override { if (m_arSession) ArBackgroundDrawable::Close(); }
|
|
|
|
void Init(const Ptr<AR::ArSession>& arSession);
|
|
|
|
void Tick();
|
|
|
|
void Close() override;
|
|
|
|
const Texture* GetTexture() const { return m_texture; }
|
|
|
|
UniformBuffer& GetBuffer() { return m_intrinsicsBuffer; }
|
|
};
|
|
}
|
|
} |