Remove ICloseable
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
namespace OpenVulkano
|
||||
{
|
||||
class ICloseable
|
||||
{
|
||||
public:
|
||||
virtual ~ICloseable() = default;
|
||||
|
||||
virtual void Close() = 0;
|
||||
};
|
||||
}
|
||||
@@ -7,7 +7,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "ITickable.hpp"
|
||||
#include "ICloseable.hpp"
|
||||
#include "Version.hpp"
|
||||
#include <string>
|
||||
|
||||
@@ -15,7 +14,7 @@ namespace OpenVulkano
|
||||
{
|
||||
class IGraphicsAppManager;
|
||||
|
||||
class IGraphicsApp : public ITickable, public ICloseable
|
||||
class IGraphicsApp : public ITickable
|
||||
{
|
||||
private:
|
||||
IGraphicsAppManager* m_manager = nullptr;
|
||||
@@ -25,6 +24,7 @@ namespace OpenVulkano
|
||||
|
||||
virtual void Init() = 0;
|
||||
virtual void InitPostGraphics() {}
|
||||
virtual void Close() {}
|
||||
virtual void CloseFinalize() {}
|
||||
[[nodiscard]] IGraphicsAppManager* GetGraphicsAppManager() const { return m_manager; }
|
||||
void SetGraphicsAppManager(IGraphicsAppManager* manager) { m_manager = manager; }
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "ITickable.hpp"
|
||||
#include "ICloseable.hpp"
|
||||
#include "UI/IWindow.hpp"
|
||||
|
||||
namespace OpenVulkano
|
||||
@@ -12,11 +11,11 @@ namespace OpenVulkano
|
||||
PlatformInitFailedException(char const* const message) : runtime_error(message) {}
|
||||
};
|
||||
|
||||
class IPlatform : public ITickable, public ICloseable
|
||||
class IPlatform : public ITickable
|
||||
{
|
||||
public:
|
||||
virtual void Init() = 0;
|
||||
|
||||
virtual void Close() = 0;
|
||||
virtual IWindow* MakeWindow() = 0;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
#include "IResourceManager.hpp"
|
||||
#include "Base/ITickable.hpp"
|
||||
#include "Base/ICloseable.hpp"
|
||||
#include "Scene/Scene.hpp"
|
||||
#include "Scene/UI/UI.hpp"
|
||||
#include <string>
|
||||
@@ -18,12 +17,13 @@ namespace OpenVulkano
|
||||
class IWindow;
|
||||
class IGraphicsAppManager;
|
||||
|
||||
class IRenderer : public ITickable, public ICloseable
|
||||
class IRenderer : public ITickable
|
||||
{
|
||||
public:
|
||||
virtual ~IRenderer() = default;
|
||||
|
||||
virtual void Init(IGraphicsAppManager* graphicsAppManager, IWindow* window) = 0;
|
||||
virtual void Close() = 0;
|
||||
|
||||
virtual std::string GetMainRenderDeviceName() = 0;
|
||||
virtual void Resize(uint32_t newWidth, uint32_t newHeight) = 0;
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
#include "Math/Math.hpp"
|
||||
#include "Base/PlatformEnums.hpp"
|
||||
#include "Base/ICloseable.hpp"
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
|
||||
@@ -36,12 +35,13 @@ namespace OpenVulkano
|
||||
bool resizeable = true;
|
||||
};
|
||||
|
||||
class IWindow : public ICloseable
|
||||
class IWindow
|
||||
{
|
||||
public:
|
||||
~IWindow() override = default;
|
||||
virtual ~IWindow() = default;
|
||||
|
||||
virtual void Init(RenderAPI::RenderApi renderApi) = 0;
|
||||
virtual void Close() = 0;
|
||||
|
||||
virtual bool WindowHasBeenDestroyed() const = 0;
|
||||
virtual void SetWindowHasBeenDestroyed() = 0;
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "Base/ITickable.hpp"
|
||||
#include "Base/ICloseable.hpp"
|
||||
|
||||
namespace OpenVulkano
|
||||
{
|
||||
@@ -16,7 +15,7 @@ namespace OpenVulkano
|
||||
class Camera;
|
||||
}
|
||||
|
||||
class CameraController : public ITickable, ICloseable
|
||||
class CameraController : public ITickable
|
||||
{
|
||||
Scene::Camera* m_camera;
|
||||
|
||||
@@ -30,7 +29,7 @@ namespace OpenVulkano
|
||||
|
||||
virtual void Init(Scene::Camera* camera) { m_camera = camera; }
|
||||
|
||||
void Close() override { m_camera = nullptr; }
|
||||
virtual void Close() { m_camera = nullptr; }
|
||||
|
||||
void SetCamera(Scene::Camera* camera) { m_camera = camera; }
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "Base/ITickable.hpp"
|
||||
#include "Base/ICloseable.hpp"
|
||||
#include "Base/IPlatform.hpp"
|
||||
#include "InputDeviceGLFW.hpp"
|
||||
#include <array>
|
||||
@@ -18,7 +17,7 @@ namespace OpenVulkano
|
||||
{
|
||||
class WindowGLFW;
|
||||
|
||||
class InputProviderGLFW final : public ITickable, public ICloseable
|
||||
class InputProviderGLFW final : public ITickable
|
||||
{
|
||||
friend WindowGLFW;
|
||||
static InputProviderGLFW* INSTANCE;
|
||||
@@ -32,7 +31,7 @@ namespace OpenVulkano
|
||||
public:
|
||||
void Init();
|
||||
|
||||
void Close() override;
|
||||
virtual void Close();
|
||||
|
||||
void PreTick();
|
||||
|
||||
|
||||
@@ -6,12 +6,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Base/ICloseable.hpp"
|
||||
#include "InputKey.hpp"
|
||||
|
||||
namespace OpenVulkano::Input
|
||||
{
|
||||
class InputDevice : public ICloseable
|
||||
class InputDevice
|
||||
{
|
||||
InputDeviceType deviceType = InputDeviceType::UNKNOWN;
|
||||
int index = -1;
|
||||
@@ -38,11 +37,11 @@ namespace OpenVulkano::Input
|
||||
[[nodiscard]] virtual bool ReadButtonDown(int16_t key) const = 0;
|
||||
|
||||
public:
|
||||
~InputDevice() override = default;
|
||||
virtual ~InputDevice() = default;
|
||||
|
||||
virtual void Tick() {}
|
||||
|
||||
void Close() override
|
||||
virtual void Close()
|
||||
{
|
||||
this->deviceType = InputDeviceType::UNKNOWN;
|
||||
this->index = -1;
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Base/ICloseable.hpp"
|
||||
#include "Scene/IRayIntersectable.hpp"
|
||||
#include "DrawEncoder.hpp"
|
||||
#include <memory>
|
||||
@@ -27,7 +26,7 @@ namespace OpenVulkano::Scene
|
||||
BACKGROUND = 0, MAIN, TRANSPARENT, POST
|
||||
};
|
||||
|
||||
class Drawable : public ICloseable, public IRayIntersectable
|
||||
class Drawable : public IRayIntersectable
|
||||
{
|
||||
std::vector<Node*> m_nodes;
|
||||
Scene* m_scene = nullptr;
|
||||
@@ -43,7 +42,7 @@ namespace OpenVulkano::Scene
|
||||
|
||||
~Drawable() override {/* if (m_scene) Drawable::Close();*/ }
|
||||
|
||||
void Close() override;
|
||||
virtual void Close();
|
||||
|
||||
void SetShader(Shader* shader) { m_shader = shader; }
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Base/ICloseable.hpp"
|
||||
#include "Base/Render/RenderResource.hpp"
|
||||
#include "Math/AABB.hpp"
|
||||
#include "Base/Utils.hpp"
|
||||
@@ -22,7 +21,7 @@ namespace OpenVulkano
|
||||
UINT16 = sizeof(uint16_t), UINT32 = sizeof(uint32_t)
|
||||
};
|
||||
|
||||
class Geometry : public RenderResourceHolder<Geometry>, public ICloseable
|
||||
class Geometry : public RenderResourceHolder<Geometry>
|
||||
{
|
||||
friend class MeshLoader;
|
||||
public:
|
||||
@@ -51,7 +50,7 @@ namespace OpenVulkano
|
||||
|
||||
void SetIndices(const uint32_t* data, uint32_t size, uint32_t dstOffset = 0) const;
|
||||
|
||||
void Close() override;
|
||||
virtual void Close();
|
||||
|
||||
void Free();
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Base/ICloseable.hpp"
|
||||
#include "Base/Render/RenderResource.hpp"
|
||||
#include "Math/Math.hpp"
|
||||
#include "Math/Pose.hpp"
|
||||
@@ -20,7 +19,7 @@ namespace OpenVulkano::Scene
|
||||
{
|
||||
class Scene;
|
||||
|
||||
class Node : public RenderResourceHolder<Node>, public ICloseable
|
||||
class Node : public RenderResourceHolder<Node>
|
||||
{
|
||||
friend Scene;
|
||||
|
||||
@@ -41,11 +40,11 @@ namespace OpenVulkano::Scene
|
||||
|
||||
Node(const Math::Matrix4f& pose);
|
||||
|
||||
~Node() noexcept override;
|
||||
virtual ~Node() noexcept;
|
||||
|
||||
void Init();
|
||||
|
||||
void Close() override;
|
||||
virtual void Close();
|
||||
|
||||
void AddChild(Node* node);
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace OpenVulkano
|
||||
{
|
||||
namespace Scene
|
||||
{
|
||||
class Scene : public ICloseable
|
||||
class Scene
|
||||
{
|
||||
public:
|
||||
Node* root;
|
||||
@@ -46,7 +46,7 @@ namespace OpenVulkano
|
||||
this->root = root;
|
||||
}
|
||||
|
||||
void Close() override
|
||||
virtual void Close()
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Base/ICloseable.hpp"
|
||||
#include "Base/Utils.hpp"
|
||||
#include "Base/Render/RenderResource.hpp"
|
||||
#include "VertexInputDescription.hpp"
|
||||
@@ -81,7 +80,7 @@ namespace OpenVulkano::Scene
|
||||
};
|
||||
|
||||
|
||||
class Shader final : public RenderResourceHolder<Shader>, public ICloseable
|
||||
class Shader final : public RenderResourceHolder<Shader>
|
||||
{
|
||||
public:
|
||||
std::vector<ShaderProgram> shaderPrograms{};
|
||||
@@ -99,7 +98,7 @@ namespace OpenVulkano::Scene
|
||||
float depthBiasClamp = 0.0f, depthBiasSlope = 0.0f, depthBiasConstant = 0.0f;
|
||||
|
||||
Shader() = default;
|
||||
~Shader() override { Shader::Close(); }
|
||||
~Shader() { Shader::Close(); }
|
||||
|
||||
Shader& AddShaderProgram(const ShaderProgram& shaderProgram)
|
||||
{
|
||||
@@ -173,7 +172,7 @@ namespace OpenVulkano::Scene
|
||||
depthBiasConstant = constant;
|
||||
}
|
||||
|
||||
void Close() override
|
||||
void Close()
|
||||
{
|
||||
if (HasRenderResource())
|
||||
GetRenderResource().Release();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
#include "Base/ICloseable.hpp"
|
||||
|
||||
#include "Device.hpp"
|
||||
|
||||
namespace OpenVulkano
|
||||
@@ -9,7 +9,7 @@ namespace OpenVulkano
|
||||
/**
|
||||
* \brief A not managed buffer. This should be used rarely.
|
||||
*/
|
||||
struct Buffer : public ICloseable
|
||||
struct Buffer
|
||||
{
|
||||
vk::Device device;
|
||||
vk::DeviceMemory memory;
|
||||
@@ -94,7 +94,7 @@ namespace OpenVulkano
|
||||
device.invalidateMappedMemoryRanges(vk::MappedMemoryRange(memory, offset, size));
|
||||
}
|
||||
|
||||
void Close() override
|
||||
void Close()
|
||||
{
|
||||
if (mapped) UnMap();
|
||||
if(memory)
|
||||
|
||||
@@ -6,14 +6,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Base/ICloseable.hpp"
|
||||
#include <vulkan/vulkan.hpp>
|
||||
|
||||
namespace OpenVulkano
|
||||
{
|
||||
namespace Vulkan
|
||||
{
|
||||
struct CommandHelper : virtual ICloseable
|
||||
struct CommandHelper final
|
||||
{
|
||||
vk::Device device;
|
||||
vk::CommandPool cmdPool;
|
||||
@@ -42,7 +41,7 @@ namespace OpenVulkano
|
||||
return level;
|
||||
}
|
||||
|
||||
void Close() override
|
||||
void Close()
|
||||
{
|
||||
device.freeCommandBuffers(cmdPool, 1, &cmdBuffer);
|
||||
device.destroyCommandPool(cmdPool);
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace OpenVulkano
|
||||
{
|
||||
class Device;
|
||||
|
||||
class Context final : public ICloseable
|
||||
class Context final
|
||||
{
|
||||
bool enableValidationLayer, initialized;
|
||||
std::set<std::string> requiredExtensions;
|
||||
@@ -45,14 +45,14 @@ namespace OpenVulkano
|
||||
#endif
|
||||
}
|
||||
|
||||
~Context() override
|
||||
~Context()
|
||||
{
|
||||
if (initialized) Close();
|
||||
}
|
||||
|
||||
void Init(IGraphicsAppManager* graphicsAppManager, IVulkanWindow* window);
|
||||
|
||||
void Close() override;
|
||||
void Close();
|
||||
|
||||
void Resize(uint32_t newWidth, uint32_t newHeight);
|
||||
|
||||
|
||||
@@ -10,13 +10,12 @@
|
||||
#include <set>
|
||||
#include <functional>
|
||||
#include <fstream>
|
||||
#include "Base/ICloseable.hpp"
|
||||
|
||||
namespace OpenVulkano
|
||||
{
|
||||
namespace Vulkan
|
||||
{
|
||||
class Device : public ICloseable
|
||||
class Device final
|
||||
{
|
||||
public:
|
||||
vk::PhysicalDevice physicalDevice;
|
||||
@@ -106,7 +105,7 @@ namespace OpenVulkano
|
||||
return memoryProperties.memoryTypes[memoryType].propertyFlags;
|
||||
}
|
||||
|
||||
void Close() override;
|
||||
void Close();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Base/ICloseable.hpp"
|
||||
#include "Image.hpp"
|
||||
#include "Device.hpp"
|
||||
#include <cstdint>
|
||||
@@ -17,7 +16,7 @@ namespace OpenVulkano::Vulkan
|
||||
{
|
||||
class RenderPass;
|
||||
|
||||
class FrameBuffer : ICloseable
|
||||
class FrameBuffer
|
||||
{
|
||||
Image depthBuffer;
|
||||
std::vector<vk::Framebuffer> frameBuffers;
|
||||
@@ -50,7 +49,7 @@ namespace OpenVulkano::Vulkan
|
||||
protected:
|
||||
void Resize(vk::Extent3D size);
|
||||
|
||||
void Close() override
|
||||
virtual void Close()
|
||||
{
|
||||
DestroyFrameBuffer();
|
||||
if(depthBuffer) depthBuffer.Close();
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace OpenVulkano::Vulkan
|
||||
SetLayout(cmdBuffer, vk::ImageSubresourceRange(aspectMask, 0, 1, 0, 1), newLayout, oldLayout);
|
||||
}
|
||||
|
||||
void Close() override;
|
||||
virtual void Close();
|
||||
|
||||
operator bool() const { return image.operator bool(); }
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Base/ICloseable.hpp"
|
||||
#include "MetalBackedTexture.h"
|
||||
|
||||
#import <CoreVideo/CVPixelBuffer.h>
|
||||
@@ -16,7 +15,7 @@ namespace OpenVulkano::Vulkan
|
||||
{
|
||||
class Renderer;
|
||||
|
||||
class MetalTextureCache : public ICloseable
|
||||
class MetalTextureCache final
|
||||
{
|
||||
CVMetalTextureCacheRef m_textureCache = nullptr;
|
||||
Vulkan::ResourceManager* m_resourceManager = nullptr;
|
||||
@@ -28,7 +27,7 @@ namespace OpenVulkano::Vulkan
|
||||
|
||||
void Init(IRenderer* renderer);
|
||||
|
||||
void Close() override;
|
||||
void Close();
|
||||
|
||||
Scene::Texture* Get(CVPixelBufferRef pixelBuffer, MTLPixelFormat pixelFormat);
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace OpenVulkano::Vulkan
|
||||
{
|
||||
class FrameBuffer;
|
||||
|
||||
class RenderPass : public ICloseable
|
||||
class RenderPass
|
||||
{ //TODO allow to control the render rect size
|
||||
protected:
|
||||
vk::Device m_device;
|
||||
@@ -27,14 +27,14 @@ namespace OpenVulkano::Vulkan
|
||||
|
||||
RenderPass() = default;
|
||||
|
||||
~RenderPass() override
|
||||
virtual ~RenderPass()
|
||||
{
|
||||
if (m_frameBuffer) RenderPass::Close();
|
||||
}
|
||||
|
||||
void Init(Device* device, FrameBuffer* frameBuffer, bool clearColor = false, bool clearDepth = false);
|
||||
|
||||
void Close() override;
|
||||
virtual void Close();
|
||||
|
||||
void SetClearColor(vk::ClearColorValue clearColor = vk::ClearColorValue(std::array<float, 4>{ 0.39f, 0.58f, 0.93f, 1.0f }))
|
||||
{
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Base/ICloseable.hpp"
|
||||
#include "Vulkan/Resources/ManagedBuffer.hpp"
|
||||
#include "Vulkan/Scene/IRecordable.hpp"
|
||||
|
||||
@@ -14,7 +13,7 @@ namespace OpenVulkano::Vulkan
|
||||
{
|
||||
class ManagedBuffer;
|
||||
|
||||
class UniformBuffer final : public IRecordable, public ICloseable
|
||||
class UniformBuffer final : public IRecordable
|
||||
{
|
||||
ManagedBuffer::Ptr m_buffer = nullptr;
|
||||
vk::DescriptorSet m_descriptorSet;
|
||||
@@ -30,7 +29,7 @@ namespace OpenVulkano::Vulkan
|
||||
|
||||
void Init(ManagedBuffer::Ptr buffer, uint32_t frameOffset, uint32_t frameSize, vk::DescriptorSetLayout* descriptorSetLayout, const DescriptorSetLayoutBinding& binding, uint32_t setId);
|
||||
|
||||
void Close() override;
|
||||
virtual void Close();
|
||||
|
||||
void Record(VulkanDrawContext* drawContext) override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user