Move Drawable draw call recording logic out of renderer
This commit is contained in:
45
openVulkanoCpp/Scene/SimpleDrawable.hpp
Normal file
45
openVulkanoCpp/Scene/SimpleDrawable.hpp
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* 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 "Drawable.hpp"
|
||||
|
||||
namespace openVulkanoCpp::Scene
|
||||
{
|
||||
class Geometry;
|
||||
class Material;
|
||||
|
||||
class SimpleDrawable final : public Drawable
|
||||
{
|
||||
Geometry* m_mesh = nullptr;
|
||||
Material* m_material = nullptr;
|
||||
|
||||
public:
|
||||
SimpleDrawable() : Drawable(DrawEncoder::GetDrawEncoder<SimpleDrawable>()) {}
|
||||
|
||||
explicit SimpleDrawable(const SimpleDrawable* toCopy)
|
||||
: Drawable(DrawEncoder::GetDrawEncoder<SimpleDrawable>())
|
||||
, m_mesh(toCopy->m_mesh)
|
||||
, m_material(toCopy->m_material)
|
||||
{}
|
||||
|
||||
~SimpleDrawable()
|
||||
{
|
||||
if (m_mesh) SimpleDrawable::Close();
|
||||
}
|
||||
|
||||
void Init(Geometry* mesh, Material* material);
|
||||
|
||||
void Init(SimpleDrawable* drawable);
|
||||
|
||||
[[nodiscard]] Drawable* Copy() override { return new SimpleDrawable(this); }
|
||||
|
||||
[[nodiscard]] Geometry* GetMesh() const { return m_mesh; }
|
||||
|
||||
[[nodiscard]] Material* GetMaterial() const { return m_material; }
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user