50 lines
1.0 KiB
C++
50 lines
1.0 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/ICloseable.hpp"
|
|
#include "DrawEncoder.hpp"
|
|
#include <vector>
|
|
|
|
namespace openVulkanoCpp::Scene
|
|
{
|
|
class Node;
|
|
class Scene;
|
|
|
|
class Drawable
|
|
{
|
|
std::vector<Node*> m_nodes;
|
|
Scene* m_scene = nullptr;
|
|
const DrawEncoder m_encoder;
|
|
|
|
public:
|
|
explicit Drawable(const DrawEncoder& encoder) : m_encoder(encoder) {}
|
|
|
|
~Drawable() { if (m_scene) Drawable::Close(); }
|
|
|
|
void Close();
|
|
|
|
[[nodiscard]] virtual Drawable* Copy() = 0;
|
|
|
|
[[nodiscard]] Scene* GetScene() const { return m_scene; }
|
|
|
|
[[nodiscard]] const auto& GetNodes() const { return m_nodes; }
|
|
|
|
[[nodiscard]] const DrawEncoder& GetEncoder() const { return m_encoder; }
|
|
|
|
private:
|
|
friend class Node;
|
|
friend class Scene;
|
|
|
|
void SetScene(Scene* scene);
|
|
|
|
void AddNode(Node* node);
|
|
|
|
void RemoveNode(Node* node);
|
|
};
|
|
}
|