Fixing mesh rendering

This commit is contained in:
Dynamitos
2023-12-24 21:49:49 +01:00
parent 95dcfda1cd
commit 1ae8d68838
8 changed files with 51 additions and 33 deletions
+4 -4
View File
@@ -14,7 +14,7 @@
using namespace Seele;
AssetRegistry* instance = new AssetRegistry();
AssetRegistry* _instance = new AssetRegistry();
AssetRegistry::~AssetRegistry()
{
@@ -103,7 +103,7 @@ std::ifstream AssetRegistry::createReadStream(const std::filesystem::path& relat
AssetRegistry &AssetRegistry::get()
{
return *instance;
return *_instance;
}
AssetRegistry::AssetRegistry()
@@ -113,7 +113,7 @@ AssetRegistry::AssetRegistry()
AssetRegistry* AssetRegistry::getInstance()
{
return instance;
return _instance;
}
void AssetRegistry::loadRegistry()
@@ -409,7 +409,7 @@ AssetRegistry::AssetFolder::AssetFolder(std::string_view folderPath)
AssetRegistry::AssetFolder::~AssetFolder()
{
for (const auto& [_, child] : children)
for (auto [_, child] : children)
{
delete child;
}
+14 -5
View File
@@ -39,7 +39,7 @@ public:
: node(i.node), traversal(i.traversal)
{
}
constexpr IteratorBase(IteratorBase&& i)
constexpr IteratorBase(IteratorBase&& i) noexcept
: node(std::move(i.node)), traversal(std::move(i.traversal))
{
}
@@ -52,7 +52,7 @@ public:
}
return *this;
}
constexpr IteratorBase& operator=(IteratorBase&& other)
constexpr IteratorBase& operator=(IteratorBase&& other) noexcept
{
if (this != &other)
{
@@ -150,7 +150,8 @@ public:
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
constexpr Tree() noexcept
: root(nullptr)
: alloc(NodeAlloc())
, root(nullptr)
, beginIt(nullptr)
, endIt(nullptr)
, iteratorsDirty(true)
@@ -197,6 +198,7 @@ public:
, _size(std::move(other._size))
, comp(std::move(other.comp))
{
other._size = 0;
}
constexpr ~Tree() noexcept
{
@@ -219,15 +221,19 @@ public:
}
return *this;
}
constexpr Tree& operator=(Tree&& other)
constexpr Tree& operator=(Tree&& other) noexcept
{
if (this != &other)
{
clear();
alloc = std::move(other.alloc);
if constexpr (std::allocator_traits<allocator_type>::propagate_on_container_move_assignment::value)
{
alloc = std::move(other.alloc);
}
root = std::move(other.root);
_size = std::move(other._size);
comp = std::move(other.comp);
other._size = 0;
markIteratorsDirty();
}
return *this;
@@ -396,6 +402,7 @@ private:
template<class NodeDataType>
Pair<Node*, bool> _insert(Node* r, NodeDataType&& data)
{
markIteratorsDirty();
if (r == nullptr)
{
root = alloc.allocate(1);
@@ -429,6 +436,7 @@ private:
template<class KeyType>
Node* _remove(Node* r, KeyType&& key)
{
markIteratorsDirty();
Node* temp;
if (r == nullptr)
return nullptr;
@@ -458,6 +466,7 @@ private:
template<class KeyType>
Node* _splay(Node* r, KeyType&& key)
{
markIteratorsDirty();
if (r == nullptr || equal(r->data, key))
{
return r;
+1
View File
@@ -32,6 +32,7 @@ public:
};
struct MeshData
{
AABB boundingBox;
uint32 numMeshlets = 0;
uint32 meshletOffset = 0;
uint32 firstIndex = 0;
+2 -2
View File
@@ -13,7 +13,7 @@ struct PendingBuffer
bool writeOnly;
};
static std::map<Vulkan::Buffer*, PendingBuffer> pendingBuffers;
static Map<Vulkan::Buffer*, PendingBuffer> pendingBuffers;
Buffer::Buffer(PGraphics graphics, uint64 size, VkBufferUsageFlags usage, Gfx::QueueType& queueType, bool dynamic)
: graphics(graphics)
@@ -239,7 +239,7 @@ void Buffer::unmap()
auto found = pendingBuffers.find(this);
if (found != pendingBuffers.end())
{
PendingBuffer& pending = found->second;
PendingBuffer& pending = found->value;
pending.stagingBuffer->flush();
if (pending.writeOnly)
{
+1 -1
View File
@@ -38,7 +38,7 @@ void ThreadPool::runAndWait(List<std::function<void()>> functions)
void ThreadPool::work()
{
while (true)
while (running)
{
std::unique_lock l(taskLock);
while(currentTask.functions.empty())