Merge remote-tracking branch 'origin/SP3-1-Rendering' into SP3-1-Rendering

This commit is contained in:
Brandon Mak 2022-09-09 11:20:46 +08:00
commit cce1d24374
4 changed files with 9 additions and 9 deletions

View File

@ -139,7 +139,7 @@ namespace SHADE
/*-----------------------------------------------------------------------------*/
/* Data Members */
/*-----------------------------------------------------------------------------*/
ResourceLibrary<T>* library;
ResourceLibrary<T>* library = nullptr;
/*-----------------------------------------------------------------------------*/
/* Friend Declarations */

View File

@ -69,7 +69,7 @@ namespace SHADE
/* Helper Functions */
/*-----------------------------------------------------------------------------*/
void assertHandleValid(Handle<T> handle) const;
int getAvailableFreeIndex();
uint32_t getAvailableFreeIndex();
};
/// <summary>

View File

@ -35,13 +35,13 @@ namespace SHADE
}
else
{
handle.id.Data.Version = 0;
versionCounts.insert(handle.id.Data.Index, handle.id.Data.Version);
handle.id.Data.Version = 0U;
versionCounts.insert(static_cast<uint32_t>(handle.id.Data.Index), handle.id.Data.Version);
}
handle.library = this;
// Create the resource
[[maybe_unused]] T& obj = objects.insert(handle.id.Data.Index, std::forward<Args>(args) ...);
[[maybe_unused]] T& obj = objects.insert(static_cast<uint32_t>(handle.id.Data.Index), std::forward<Args>(args) ...);
// Handling SelfHandle assignment
if constexpr (std::is_base_of_v<ISelfHandle<T>, T>)
@ -89,7 +89,7 @@ namespace SHADE
}
template<typename T>
inline int ResourceLibrary<T>::getAvailableFreeIndex()
inline uint32_t ResourceLibrary<T>::getAvailableFreeIndex()
{
// Get from the free list if present
if (!freeList.empty())

View File

@ -56,7 +56,7 @@ namespace SHADE
throw std::invalid_argument("An element at this index does not exist!");
// Swap with the last element
const int BACK_IDX = denseArray.size() - 1;
const auto BACK_IDX = denseArray.size() - 1;
std::swap(denseArray[sparseArray[idx]], denseArray.back());
denseArray.pop_back();
// Update the sparse set by swapping the indices
@ -110,7 +110,7 @@ namespace SHADE
// We need to resize the array
if (idx >= sparseArray.size())
{
const int NEW_SIZE = idx + 1;
const auto NEW_SIZE = idx + 1;
sparseArray.resize(NEW_SIZE, INVALID);
inverseSparseArray.resize(NEW_SIZE, INVALID);
}
@ -123,7 +123,7 @@ namespace SHADE
auto& insertedElem = denseArray.emplace_back(std::forward<Args>(args) ...);
// Update sparse and inverse sparse arrays
const index_type DENSE_IDX = denseArray.size() - 1;
const auto DENSE_IDX = denseArray.size() - 1;
sparseArray[idx] = DENSE_IDX;
inverseSparseArray[DENSE_IDX] = idx;