Vulkan Schnee 0.0.1
High-performance rendering engine
Loading...
Searching...
No Matches
FrameProcessing.h
Go to the documentation of this file.
1#pragma once
2#include <filesystem>
3#include <future>
4
5#include "EcsData.h"
9
10namespace EngineCore {
11 class ModelAsset;
13 class GltfLoader;
15}
16
17namespace EngineCore {
18 class MeshAssetManager;
20}
21
22namespace EngineCore {
23 class Engine;
24 class AssetManager;
25}
26
27class NamedThreadPool;
28
29namespace Ecs
30{
39 friend class EngineCore::Engine;
40
41 public:
44
52 void submitAsset(const std::filesystem::path &asset);
53
58 void tick(bool async = true);
59
68
69 private:
70 void requestExrHeaders(bool async = true);
71 void loadImageData(bool async = true);
72 void retrieveImageData(bool async = true);
73
77
78 std::vector<std::filesystem::path> assetQueue;
79 std::vector<Ecs::ExrHeaderFuture> headerFutures;
80 std::vector<Ecs::AssetLoadingImage> imageFutures;
81 };
82
92 friend class EngineCore::Engine;
93
94 public:
100 EngineCore::AssetManager* assetManager = nullptr);
101
106 void submitAsset(const std::filesystem::path &asset);
107
108 void tick(bool async = true);
109
118
125 std::vector<Ecs::CompletedMeshletGeneration> takePendingMeshletCompletions();
126
127 private:
128 void submitLoadModel(bool async = true);
129 void processModel(bool async = true);
130 void processMaterial(bool async = true);
131 void processMeshData(bool async = true);
132
145 void processTextures(EngineCore::ModelAsset* modelAsset, const std::filesystem::path& modelPath);
146
153
154 NamedThreadPool * threadPool = new NamedThreadPool( 4, "Gltf loader" );
155
157
158 std::vector<std::filesystem::path> assetQueue;
159 std::vector<Ecs::GltfModelFuture> modelLoadingFutures;
160 std::vector<std::future<Ecs::MaterialLoadingData>> materialFutures;
161 std::vector<std::future<Ecs::PrimitiveDataLoading>> primitiveDataFutures;
162 std::vector<std::future<Ecs::CompletedMeshletGeneration>> meshletGenerationFutures;
163
164 // Queue for completed meshlet generations waiting to be written to registry
165 std::vector<Ecs::CompletedMeshletGeneration> pendingMeshletCompletions_;
166
168 };
169} // namespace Ecs
void setRenderingDataManager(EngineCore::RenderingDataManager *rdm)
Sets the RenderingDataManager to notify when meshes/materials are loaded.
NamedThreadPool * assetLoaderPool
void submitLoadModel(bool async=true)
void processMeshData(bool async=true)
std::vector< Ecs::CompletedMeshletGeneration > pendingMeshletCompletions_
std::vector< Ecs::CompletedMeshletGeneration > takePendingMeshletCompletions()
Get and clear pending meshlet completions. Call this at a safe point to retrieve completed meshlet ge...
ModelAssetPipeline(EngineCore::MeshAssetManager *meshAssetManager, EngineCore::MaterialAssetManager *materialAssetManager, EngineCore::ModelAssetManager *modelAssetManager, EngineCore::TextureAssetManager *textureAssetManager, NamedThreadPool *assetLoaderPool, EngineCore::AssetManager *assetManager=nullptr)
std::vector< std::filesystem::path > assetQueue
EngineCore::TextureAssetManager * textureAssetManager
std::vector< std::future< Ecs::CompletedMeshletGeneration > > meshletGenerationFutures
void processModel(bool async=true)
void processTextures(EngineCore::ModelAsset *modelAsset, const std::filesystem::path &modelPath)
Extracts and registers texture assets from loaded glTF models.
EngineCore::GltfLoader * loader
std::vector< Ecs::GltfModelFuture > modelLoadingFutures
std::vector< std::future< Ecs::PrimitiveDataLoading > > primitiveDataFutures
void tick(bool async=true)
EngineCore::MeshAssetManager * meshAssetManager
NamedThreadPool * threadPool
std::vector< std::future< Ecs::MaterialLoadingData > > materialFutures
void submitAsset(const std::filesystem::path &asset)
Requests the load of a gltf file.
void processMaterial(bool async=true)
EngineCore::RenderingDataManager * renderingDataManager
EngineCore::MaterialAssetManager * materialAssetManager
EngineCore::AssetManager * assetManager_
For TextureHandleRegistry access.
EngineCore::ModelAssetManager * modelAssetManager
NamedThreadPool * assetLoaderPool
EngineCore::TextureAssetManager * textureAssetManager
void tick(bool async=true)
Advances the state machine for the entire pipeline.
void requestExrHeaders(bool async=true)
void setRenderingDataManager(EngineCore::RenderingDataManager *rdm)
Sets the RenderingDataManager to notify when textures are loaded.
std::vector< std::filesystem::path > assetQueue
std::vector< Ecs::AssetLoadingImage > imageFutures
EngineCore::RenderingDataManager * renderingDataManager
std::vector< Ecs::ExrHeaderFuture > headerFutures
void retrieveImageData(bool async=true)
void loadImageData(bool async=true)
TextureAssetPipeline(EngineCore::TextureAssetManager *textureAssetManager, NamedThreadPool *assetLoaderPool)
void submitAsset(const std::filesystem::path &asset)
submit the path to an asset relative from the executable to load
Stores mesh data with their primitives.
Definition MeshAsset.h:54
The model asset is used to bind together all files of one gtlf model. The idea is that textures,...
The rendering data manager is supposed to hold all methods to update the contents of the buffers whic...
Tracy-named thread pool using BS_tracy::tracy_thread_pool.
Data structs for the Entity Component System.
Log category system implementation.