11#include <unordered_map>
12#include <components/Types.hpp>
74 void loadMeshesAsync(
const std::vector<MeshComponent*>& pendingComponents);
80 return m_vulkanMeshes.find(path) != m_vulkanMeshes.end();
88 Engine* m_p_engine =
nullptr;
90 std::unique_ptr<VulkanResources>& m_p_resources;
91 vex_map<std::string, std::unique_ptr<VulkanMesh>> m_vulkanMeshes;
92 std::vector<uint32_t> m_freeModelIds;
93 uint32_t m_nextModelId = 0;
95 std::unordered_map<uint32_t, std::string> m_installedPaths;
96 std::unordered_map<std::string, std::pair<glm::vec3, float>> m_meshBoundsCache;
Contains basic components like transform, camera, name components..
Main header for the Entity Component System (ECS) framework.
Contains main Engine class.
This file defines MeshData struct and all other structs needed for it.
This file defines in engine ModelObject class.
This file defines VirtualFileSystem and VPKStream classes.
This file defines VulkanMesh class.
Class for interaction with engine systems.
vex::Registry & getRegistry()
Returns a reference to vex::Registry.
MeshComponent loadMesh(const std::string &path)
Loads mesh from a file, creates vulkan mesh and returns a MeshComponent.
void clearState()
Clears the state of the mesh manager, resetting model IDs and clearing the mesh map.
void registerVulkanMesh(MeshComponent &meshComponent)
Registers a Vulkan mesh component.
void onMeshComponentDestroy(vex::Registry ®istry, vex::Entity entity)
Internally handles the destruction of a mesh component called by entt callbacks.
std::unique_ptr< VulkanMesh > & getVulkanMeshByMesh(MeshComponent &meshComponent)
Retrieves a Vulkan mesh by mesh component.
void init(Engine *engine)
Initialize the MeshManager.
ModelObject * createModel(const std::string &name, MeshComponent meshComponent, TransformComponent transformComponent, vex::Entity parent)
Creates a model object from a mesh component, transform component, and parent entity.
void destroyModel(std::string &name, MeshComponent meshComponent)
Destroys a model object by name and mesh component.
bool isMeshLoaded(const std::string &path) const
Checks if a mesh is loaded by path.
void onMeshComponentConstruct(vex::Registry ®istry, vex::Entity entity)
Internally handles the construction of a mesh component called by entt callbacks.
void loadMeshesAsync(const std::vector< MeshComponent * > &pendingComponents)
Loads meshes asynchronously from the given paths.
MeshManager(VulkanContext &context, std::unique_ptr< VulkanResources > &resources, VirtualFileSystem *vfs)
Constructor for MeshManager.
void releaseMeshReference(const std::string &path, MeshComponent &ownerComp)
Internally handles the release of a mesh reference called by entt callbacks.
ModelObject class represents a model object in the engine. Thanks to engine separation from the backe...
Central registry for managing entities and their components in the ECS system.
void on_create(std::function< void(Entity, T &)> cb)
Registers a callback to be invoked when a component of type T is created.
This class provides abstraction of file system needed for loading packed and unpacked assets.
uint32_t Entity
Type alias representing a unique entity identifier in the ECS system.
Struct containing raw meshData, mesh id, texture paths and material properties. It just template and ...
Struct holding all vulkan data, like device, surface, swapchain, images, views, and more.