Add ArCameraController
This commit is contained in:
57
openVulkanoCpp/Controller/ArCameraController.hpp
Normal file
57
openVulkanoCpp/Controller/ArCameraController.hpp
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* 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/ITickable.hpp"
|
||||
#include "Base/ICloseable.hpp"
|
||||
#include "Math/Math.hpp"
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <atomic>
|
||||
|
||||
namespace openVulkanoCpp
|
||||
{
|
||||
namespace AR
|
||||
{
|
||||
class ArSession;
|
||||
}
|
||||
|
||||
namespace Scene
|
||||
{
|
||||
class Camera;
|
||||
}
|
||||
|
||||
class ArCameraController final : public ITickable, public ICloseable
|
||||
{
|
||||
std::shared_ptr<AR::ArSession> m_arSession;
|
||||
Scene::Camera* m_camera;
|
||||
Math::Matrix4f m_registration;
|
||||
Math::Matrix4f m_matrixToUpdate;
|
||||
std::mutex m_mutex;
|
||||
std::atomic<bool> m_updated;
|
||||
|
||||
public:
|
||||
ArCameraController();
|
||||
|
||||
ArCameraController(Scene::Camera* camera, const std::shared_ptr<AR::ArSession>& session = nullptr, const Math::Matrix4f& registration = Math::Matrix4f (1));
|
||||
|
||||
~ArCameraController() override;
|
||||
|
||||
void Init(Scene::Camera* camera, const std::shared_ptr<AR::ArSession>& session = nullptr, const Math::Matrix4f& registration = Math::Matrix4f (1));
|
||||
|
||||
void Tick() override;
|
||||
|
||||
void Close() override;
|
||||
|
||||
[[nodiscard]] std::shared_ptr<AR::ArSession> GetArSession() const { return m_arSession; }
|
||||
|
||||
private:
|
||||
void Init();
|
||||
|
||||
void UpdateCameraTransformation(const Math::Matrix4f& transform);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user