Grindstone Game Engine v0.2.0
An open source game engine and toolkit.
Loading...
Searching...
No Matches
DeferredDeletionQueue.hpp
1#pragma once
2
3#include <functional>
4#include <vector>
5
6namespace Grindstone {
14 class DeletionQueue {
15 public:
16 DeletionQueue() = default;
17 DeletionQueue(uint32_t poolSize);
18 DeletionQueue(const DeletionQueue& other) = default;
19 DeletionQueue(DeletionQueue&& other) noexcept = default;
20 DeletionQueue& operator=(const DeletionQueue& other) = default;
21 DeletionQueue& operator=(DeletionQueue&& other) noexcept = default;
22 ~DeletionQueue();
23 void Initialize(uint32_t poolSize);
24 void PushDeletion(std::function<void()> fn);
25 void DeleteAll();
26 protected:
27 std::vector<std::function<void()>> queue;
28 };
29
38 class DeferredDeletionQueue {
39 public:
40 ~DeferredDeletionQueue();
41 DeferredDeletionQueue() = default;
42 DeferredDeletionQueue(uint8_t frameCount, uint32_t poolSize);
43 DeferredDeletionQueue(const DeferredDeletionQueue& other) = default;
44 DeferredDeletionQueue(DeferredDeletionQueue&& other) noexcept = default;
45 DeferredDeletionQueue& operator=(const DeferredDeletionQueue& other) = default;
46 DeferredDeletionQueue& operator=(DeferredDeletionQueue&& other) noexcept = default;
47 void Initialize(uint8_t frameCount, uint32_t poolSize);
48 void PushDeletion(std::function<void()> fn);
49 void DeleteAll();
50 void DeleteForFrame();
51 void SetCurrentImageIndex(size_t newFrameIndex);
52 protected:
53 std::vector<DeletionQueue> queues;
54 size_t frameIndex = 0;
55 };
56}
Definition Assert.hpp:14