Graphics: Rework tilemap class (and fix its AABB)

This commit is contained in:
SirLynix
2022-12-18 14:57:40 +01:00
parent 830eee78a8
commit 3c86b84e13
3 changed files with 78 additions and 38 deletions

View File

@@ -11,9 +11,9 @@
#include <Nazara/Core/Color.hpp>
#include <Nazara/Graphics/Config.hpp>
#include <Nazara/Graphics/InstancedRenderable.hpp>
#include <Nazara/Utils/Bitset.hpp>
#include <Nazara/Utility/VertexStruct.hpp>
#include <memory>
#include <set>
namespace Nz
{
@@ -71,12 +71,14 @@ namespace Nz
private:
Vector3ui GetTextureSize(std::size_t matIndex) const;
inline void InvalidateVertices();
void UpdateAABB();
void UpdateVertices() const;
struct Layer
{
std::set<std::size_t> tiles;
std::shared_ptr<MaterialInstance> material;
Bitset<UInt64> enabledTiles;
std::size_t enabledTileCount = 0; //< cached bitset popcount
};
mutable std::vector<VertexStruct_XYZ_Color_UV> m_vertices;