Vulkan Schnee 0.0.1
High-performance rendering engine
Loading...
Searching...
No Matches
Engine::Ecs::ModelAssetPipeline Class Reference

The model asset pipeline loads a gltf scene and loads and loads the mesh and material data. The material data requests the textures it needs. More...

#include <FrameProcessing.h>

Collaboration diagram for Engine::Ecs::ModelAssetPipeline:

Public Member Functions

 ModelAssetPipeline (Assets::MeshAssetManager *meshAssetManager, Assets::MaterialAssetManager *materialAssetManager, Assets::ModelAssetManager *modelAssetManager, Assets::TextureAssetManager *textureAssetManager, NamedThreadPool *assetLoaderPool, Core::AssetManager *assetManager=nullptr)
void submitAsset (const std::filesystem::path &asset)
 Requests the load of a gltf file.
void tick (bool async=true)
void setRenderingDataManager (Core::RenderingDataManager *renderingDataManager)
 Sets the RenderingDataManager to notify when meshes/materials are loaded.
void setTextureAssetPipeline (TextureAssetPipeline *pipeline)
 Sets the TextureAssetPipeline for async lightmap loading.
std::vector< CompletedMeshletGenerationtakePendingMeshletCompletions ()
 Get and clear pending meshlet completions. Call this at a safe point to retrieve completed meshlet generations that need to be written to the registry.
bool hasPendingWork () const
 Check if the pipeline still has in-flight work (loading, meshlet generation, etc.) Used to defer buffer rebuilds until all meshes from a model have finished processing.
void discardPendingWork ()

Private Member Functions

void submitLoadModel (bool async=true)
void processModel (bool async=true)
void processSkinData (bool async=true)
void processMaterial (bool async=true)
void processMeshData (bool async=true)
void processKtx2Textures (bool async=true)
void processTextures (Assets::Model *modelAsset, const std::shared_ptr< tinygltf::Model > &model, const std::filesystem::path &modelPath)
 Extracts and registers texture assets from loaded glTF models.

Private Attributes

Assets::MeshAssetManagermeshAssetManager = nullptr
Assets::MaterialAssetManagermaterialAssetManager = nullptr
Assets::ModelAssetManager * modelAssetManager = nullptr
Assets::TextureAssetManagertextureAssetManager = nullptr
Core::RenderingDataManager * renderingDataManager_ = nullptr
Core::AssetManagerassetManager_ = nullptr
 For TextureHandleRegistry access.
TextureAssetPipelinetextureAssetPipeline_ = nullptr
 For async lightmap loading.
NamedThreadPoolthreadPool_ = new NamedThreadPool( 2, "Gltf loader" )
Assets::Loaders::GltfLoaderloader = new Assets::Loaders::GltfLoader(threadPool_)
std::vector< std::filesystem::path > assetQueue_
std::vector< GltfModelFuturemodelLoadingFutures_
std::vector< MaterialLoadingDatamaterialResults
std::vector< std::future< PrimitiveDataLoading > > primitiveDataFutures
std::vector< std::future< CompletedMeshletGeneration > > meshletGenerationFutures
std::vector< CompletedMeshletGenerationpendingMeshletCompletions_
std::vector< Ktx2LoadFuturependingKtx2Futures_
NamedThreadPoolassetLoaderPool = nullptr

Detailed Description

The model asset pipeline loads a gltf scene and loads and loads the mesh and material data. The material data requests the textures it needs.

Definition at line 106 of file FrameProcessing.h.

Constructor & Destructor Documentation

◆ ModelAssetPipeline()

Engine::Ecs::ModelAssetPipeline::ModelAssetPipeline ( Assets::MeshAssetManager * meshAssetManager,
Assets::MaterialAssetManager * materialAssetManager,
Assets::ModelAssetManager * modelAssetManager,
Assets::TextureAssetManager * textureAssetManager,
NamedThreadPool * assetLoaderPool,
Core::AssetManager * assetManager = nullptr )
explicit

Member Function Documentation

◆ discardPendingWork()

void Engine::Ecs::ModelAssetPipeline::discardPendingWork ( )

◆ hasPendingWork()

bool Engine::Ecs::ModelAssetPipeline::hasPendingWork ( ) const
inlinenodiscard

Check if the pipeline still has in-flight work (loading, meshlet generation, etc.) Used to defer buffer rebuilds until all meshes from a model have finished processing.

Returns
true if there are pending model loads, primitive data, or meshlet generations

Definition at line 153 of file FrameProcessing.h.

References assetQueue_, materialResults, meshletGenerationFutures, modelLoadingFutures_, pendingKtx2Futures_, pendingMeshletCompletions_, and primitiveDataFutures.

◆ processKtx2Textures()

void Engine::Ecs::ModelAssetPipeline::processKtx2Textures ( bool async = true)
private

◆ processMaterial()

void Engine::Ecs::ModelAssetPipeline::processMaterial ( bool async = true)
private

◆ processMeshData()

void Engine::Ecs::ModelAssetPipeline::processMeshData ( bool async = true)
private

◆ processModel()

void Engine::Ecs::ModelAssetPipeline::processModel ( bool async = true)
private

◆ processSkinData()

void Engine::Ecs::ModelAssetPipeline::processSkinData ( bool async = true)
private

◆ processTextures()

void Engine::Ecs::ModelAssetPipeline::processTextures ( Assets::Model * modelAsset,
const std::shared_ptr< tinygltf::Model > & model,
const std::filesystem::path & modelPath )
private

Extracts and registers texture assets from loaded glTF models.

Called during processModel() to extract images from model.images[] and create GltfTextureAsset entries in the TextureAssetManager.

Parameters
modelAssetThe model asset containing the loaded tinygltf::Model
modelPathPath to the glTF file for resolving texture paths

◆ setRenderingDataManager()

void Engine::Ecs::ModelAssetPipeline::setRenderingDataManager ( Core::RenderingDataManager * renderingDataManager)
inline

Sets the RenderingDataManager to notify when meshes/materials are loaded.

Parameters
renderingDataManagerPointer to the RenderingDataManager

Definition at line 132 of file FrameProcessing.h.

References renderingDataManager_.

◆ setTextureAssetPipeline()

void Engine::Ecs::ModelAssetPipeline::setTextureAssetPipeline ( TextureAssetPipeline * pipeline)
inline

Sets the TextureAssetPipeline for async lightmap loading.

Parameters
pipelinePointer to the TextureAssetPipeline

Definition at line 138 of file FrameProcessing.h.

References textureAssetPipeline_.

◆ submitAsset()

void Engine::Ecs::ModelAssetPipeline::submitAsset ( const std::filesystem::path & asset)

Requests the load of a gltf file.

Parameters
assetpath to the asset to load. Only use relative paths!

◆ submitLoadModel()

void Engine::Ecs::ModelAssetPipeline::submitLoadModel ( bool async = true)
private

◆ takePendingMeshletCompletions()

std::vector< CompletedMeshletGeneration > Engine::Ecs::ModelAssetPipeline::takePendingMeshletCompletions ( )

Get and clear pending meshlet completions. Call this at a safe point to retrieve completed meshlet generations that need to be written to the registry.

Returns
Vector of completed meshlet generation results

◆ tick()

void Engine::Ecs::ModelAssetPipeline::tick ( bool async = true)

Member Data Documentation

◆ assetLoaderPool

NamedThreadPool* Engine::Ecs::ModelAssetPipeline::assetLoaderPool = nullptr
private

Definition at line 210 of file FrameProcessing.h.

Referenced by ModelAssetPipeline().

◆ assetManager_

Core::AssetManager* Engine::Ecs::ModelAssetPipeline::assetManager_ = nullptr
private

For TextureHandleRegistry access.

Definition at line 192 of file FrameProcessing.h.

◆ assetQueue_

std::vector<std::filesystem::path> Engine::Ecs::ModelAssetPipeline::assetQueue_
private

Definition at line 198 of file FrameProcessing.h.

Referenced by hasPendingWork().

◆ loader

Assets::Loaders::GltfLoader* Engine::Ecs::ModelAssetPipeline::loader = new Assets::Loaders::GltfLoader(threadPool_)
private

Definition at line 196 of file FrameProcessing.h.

◆ materialAssetManager

Assets::MaterialAssetManager* Engine::Ecs::ModelAssetPipeline::materialAssetManager = nullptr
private

Definition at line 188 of file FrameProcessing.h.

Referenced by ModelAssetPipeline().

◆ materialResults

std::vector<MaterialLoadingData> Engine::Ecs::ModelAssetPipeline::materialResults
private

Definition at line 200 of file FrameProcessing.h.

Referenced by hasPendingWork().

◆ meshAssetManager

Assets::MeshAssetManager* Engine::Ecs::ModelAssetPipeline::meshAssetManager = nullptr
private

Definition at line 187 of file FrameProcessing.h.

Referenced by ModelAssetPipeline().

◆ meshletGenerationFutures

std::vector<std::future<CompletedMeshletGeneration> > Engine::Ecs::ModelAssetPipeline::meshletGenerationFutures
private

Definition at line 202 of file FrameProcessing.h.

Referenced by hasPendingWork().

◆ modelAssetManager

Assets::ModelAssetManager* Engine::Ecs::ModelAssetPipeline::modelAssetManager = nullptr
private

Definition at line 189 of file FrameProcessing.h.

Referenced by ModelAssetPipeline().

◆ modelLoadingFutures_

std::vector<GltfModelFuture> Engine::Ecs::ModelAssetPipeline::modelLoadingFutures_
private

Definition at line 199 of file FrameProcessing.h.

Referenced by hasPendingWork().

◆ pendingKtx2Futures_

std::vector<Ktx2LoadFuture> Engine::Ecs::ModelAssetPipeline::pendingKtx2Futures_
private

Definition at line 208 of file FrameProcessing.h.

Referenced by hasPendingWork().

◆ pendingMeshletCompletions_

std::vector<CompletedMeshletGeneration> Engine::Ecs::ModelAssetPipeline::pendingMeshletCompletions_
private

Definition at line 205 of file FrameProcessing.h.

Referenced by hasPendingWork().

◆ primitiveDataFutures

std::vector<std::future<PrimitiveDataLoading> > Engine::Ecs::ModelAssetPipeline::primitiveDataFutures
private

Definition at line 201 of file FrameProcessing.h.

Referenced by hasPendingWork().

◆ renderingDataManager_

Core::RenderingDataManager* Engine::Ecs::ModelAssetPipeline::renderingDataManager_ = nullptr
private

Definition at line 191 of file FrameProcessing.h.

Referenced by setRenderingDataManager().

◆ textureAssetManager

Assets::TextureAssetManager* Engine::Ecs::ModelAssetPipeline::textureAssetManager = nullptr
private

Definition at line 190 of file FrameProcessing.h.

Referenced by ModelAssetPipeline().

◆ textureAssetPipeline_

TextureAssetPipeline* Engine::Ecs::ModelAssetPipeline::textureAssetPipeline_ = nullptr
private

For async lightmap loading.

Definition at line 193 of file FrameProcessing.h.

Referenced by setTextureAssetPipeline().

◆ threadPool_

NamedThreadPool* Engine::Ecs::ModelAssetPipeline::threadPool_ = new NamedThreadPool( 2, "Gltf loader" )
private

Definition at line 195 of file FrameProcessing.h.


The documentation for this class was generated from the following file: