6#include <unordered_map>
74 template <TextureType Type>
117 const std::filesystem::path & path,
119 uint32_t descriptorIndex
Type-erased texture handle for runtime storage.
static constexpr uint32_t INVALID_ID
std::unordered_map< std::string, uint32_t > pathToHandleId_
void onTextureLoaded(const std::filesystem::path &path, RuntimeTexture *texture, uint32_t descriptorIndex)
Called when a texture finishes loading.
TextureType getTextureTypeForPath(const std::filesystem::path &path) const
Get the texture type for a path (if registered)
TextureHandleRegistry()=default
void onTextureUnloaded(const std::filesystem::path &path)
Called when a texture is unloaded.
void clear()
Clear all registry entries (typically called on shutdown)
TextureType getTextureType(TextureHandle handle) const
Get the texture type for a handle.
~TextureHandleRegistry()=default
TextureHandleRegistry(const TextureHandleRegistry &)=delete
TextureHandleRegistry(TextureHandleRegistry &&)=delete
TypedTextureHandle< Type > getOrCreateHandle(const std::filesystem::path &path)
Get or create a typed handle for a texture path.
TextureHandleRegistry & operator=(TextureHandleRegistry &&)=delete
size_t getHandleCount() const
Get the total number of registered texture handles.
TextureHandleRegistry & operator=(const TextureHandleRegistry &)=delete
TextureHandle getOrCreateHandleImpl(const std::filesystem::path &path, TextureType type)
Internal implementation of getOrCreateHandle.
std::vector< Entry > entries_
uint32_t resolveDescriptorIndex(TextureHandle handle) const
Resolve a handle to its descriptor index (O(1) operation)
std::filesystem::path getPathForHandle(TextureHandle handle) const
Get the path associated with a handle (for debugging/validation)
Type-safe texture handle wrapper providing compile-time type safety.
TextureType
Represents the semantic type of a texture, determining its Vulkan format.
@ Unknown
Fallback type, uses SRGB as default.
Registry entry storing texture metadata.
std::filesystem::path path