Files
OpenVulkano/openVulkanoCpp/Scene/Prefabs/ArBackgroundDrawable.hpp

53 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/.
*/
#pragma once
#include "Base/Event.hpp"
#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;
EventHandle m_eventHandle;
Ptr<AR::ArFrame> m_nextFrame, m_currentFrame, m_lastFrame;
const Texture* m_texture = nullptr;
void OnNewArFrame(const Ptr<AR::ArFrame>& frame);
public:
ArBackgroundDrawable(const Ptr<AR::ArSession>& arSession = nullptr);
~ArBackgroundDrawable() override { 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; }
};
}
}