Vulkan Schnee 0.0.1
High-performance rendering engine
Loading...
Searching...
No Matches
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 Ecs::ModelAssetPipeline:

Public Member Functions

 ModelAssetPipeline (EngineCore::MeshAssetManager *meshAssetManager, EngineCore::MaterialAssetManager *materialAssetManager, EngineCore::ModelAssetManager *modelAssetManager, EngineCore::TextureAssetManager *textureAssetManager, NamedThreadPool *assetLoaderPool, EngineCore::AssetManager *assetManager=nullptr)
void submitAsset (const std::filesystem::path &asset)
 Requests the load of a gltf file.
void tick (bool async=true)
void setRenderingDataManager (EngineCore::RenderingDataManager *rdm)
 Sets the RenderingDataManager to notify when meshes/materials are loaded.
std::vector< Ecs::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.

Private Member Functions

void submitLoadModel (bool async=true)
void processModel (bool async=true)
void processMaterial (bool async=true)
void processMeshData (bool async=true)
void processTextures (EngineCore::ModelAsset *modelAsset, const std::filesystem::path &modelPath)
 Extracts and registers texture assets from loaded glTF models.

Private Attributes

EngineCore::MeshAssetManagermeshAssetManager
EngineCore::MaterialAssetManagermaterialAssetManager
EngineCore::ModelAssetManagermodelAssetManager
EngineCore::TextureAssetManagertextureAssetManager
EngineCore::RenderingDataManagerrenderingDataManager = nullptr
EngineCore::AssetManagerassetManager_ = nullptr
 For TextureHandleRegistry access.
NamedThreadPoolthreadPool = new NamedThreadPool( 4, "Gltf loader" )
EngineCore::GltfLoaderloader = new EngineCore::GltfLoader(threadPool)
std::vector< std::filesystem::path > assetQueue
std::vector< Ecs::GltfModelFuturemodelLoadingFutures
std::vector< std::future< Ecs::MaterialLoadingData > > materialFutures
std::vector< std::future< Ecs::PrimitiveDataLoading > > primitiveDataFutures
std::vector< std::future< Ecs::CompletedMeshletGeneration > > meshletGenerationFutures
std::vector< Ecs::CompletedMeshletGenerationpendingMeshletCompletions_
NamedThreadPoolassetLoaderPool = nullptr

Friends

class EngineCore::AssetManager
class EngineCore::Engine

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.

Date
03.12.2025
Author
Konstantin Passig

Definition at line 90 of file FrameProcessing.h.

Constructor & Destructor Documentation

◆ ModelAssetPipeline()

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

Member Function Documentation

◆ processMaterial()

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

Definition at line 658 of file FrameProcessing.cpp.

References Asset::AssetBase::data, Ecs::MaterialLoadingData::data, EngineCore::DIFFUSE_FLAT_COLOR, EngineCore::DIFFUSE_SHADER, EngineCore::DYNAMIC_TEXTURES, Ecs::RegistryManager::get(), Asset::Path::getAssetHandle(), EngineCore::L0_SHADER, EngineCore::L1_SHADER, EngineCore::L2_SHADER, materialAssetManager, materialFutures, EngineCore::MOVABLE_DIFFUSE_SHADER, EngineCore::NORMALS_SHADER, Ecs::MaterialLoadingData::path, processMaterial(), renderingDataManager, EngineCore::STATIC_LIGHTMAP, Ecs::MaterialLoadingData::type, EngineCore::MaterialAsset::type, and EngineCore::UnpackOptional().

Referenced by processMaterial(), and tick().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ processMeshData()

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

Definition at line 757 of file FrameProcessing.cpp.

References Asset::AssetBase::data, Ecs::PrimitiveDataLoading::data, Ecs::RegistryManager::get(), Asset::Path::getAssetHandle(), Asset::AssetBase::getEntity(), Ecs::PrimitiveDataLoading::materialPaths, meshAssetManager, meshletGenerationFutures, Ecs::PrimitiveDataLoading::path, pendingMeshletCompletions_, primitiveDataFutures, Ecs::MeshPrimitiveData::primitives, processMeshData(), threadPool, TRACY_ZONE_SCOPED_NAMED, TRACY_ZONE_SCOPED_NAMED_ASSET, and EngineCore::UnpackOptional().

Referenced by processMeshData(), and tick().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ processModel()

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

◆ processTextures()

void Ecs::ModelAssetPipeline::processTextures ( EngineCore::ModelAsset * modelAsset,
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
Author
Konstantin Passig
Date
19.12.2025

Definition at line 1133 of file FrameProcessing.cpp.

References assetManager_, EngineCore::TextureHandleRegistry::getOrCreateHandle(), EngineCore::Lightmap, EngineCore::ExrLoader::load(), EngineCore::ModelAsset::model, processTextures(), EngineCore::ModelAsset::registerCreatedAssetWithModel(), renderingDataManager, textureAssetManager, TRACY_ZONE_SCOPED_NAMED, TRACY_ZONE_SCOPED_NAMED_ASSET, and EngineCore::GltfLoader::StaticMeshExtensions::vulkanSchneeExtension.

Referenced by processModel(), and processTextures().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setRenderingDataManager()

void Ecs::ModelAssetPipeline::setRenderingDataManager ( EngineCore::RenderingDataManager * rdm)
inline

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

Parameters
rdmPointer to the RenderingDataManager
Author
Konstantin Passig
Date
2026-01-15

Definition at line 117 of file FrameProcessing.h.

References renderingDataManager.

◆ submitAsset()

void 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!

Definition at line 179 of file FrameProcessing.cpp.

References assetQueue, and modelAssetManager.

◆ submitLoadModel()

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

Definition at line 199 of file FrameProcessing.cpp.

References assetLoaderPool, assetQueue, EngineCore::Path::doesGltfFileExist(), loader, modelLoadingFutures, TRACY_ZONE_SCOPED_NAMED_ASSET, and EngineCore::UnpackOptional().

Referenced by tick().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ takePendingMeshletCompletions()

std::vector< CompletedMeshletGeneration > 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

Definition at line 1126 of file FrameProcessing.cpp.

References pendingMeshletCompletions_, and takePendingMeshletCompletions().

Referenced by takePendingMeshletCompletions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tick()

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

Definition at line 191 of file FrameProcessing.cpp.

References processMaterial(), processMeshData(), processModel(), and submitLoadModel().

Here is the call graph for this function:

◆ EngineCore::AssetManager

friend class EngineCore::AssetManager
friend

Definition at line 91 of file FrameProcessing.h.

◆ EngineCore::Engine

Member Data Documentation

◆ assetLoaderPool

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

◆ assetManager_

EngineCore::AssetManager* Ecs::ModelAssetPipeline::assetManager_ = nullptr
private

For TextureHandleRegistry access.

Definition at line 152 of file FrameProcessing.h.

Referenced by ModelAssetPipeline(), processModel(), and processTextures().

◆ assetQueue

std::vector<std::filesystem::path> Ecs::ModelAssetPipeline::assetQueue
private

Definition at line 158 of file FrameProcessing.h.

Referenced by submitAsset(), and submitLoadModel().

◆ loader

EngineCore::GltfLoader* Ecs::ModelAssetPipeline::loader = new EngineCore::GltfLoader(threadPool)
private

Definition at line 156 of file FrameProcessing.h.

Referenced by processModel(), and submitLoadModel().

◆ materialAssetManager

EngineCore::MaterialAssetManager* Ecs::ModelAssetPipeline::materialAssetManager
private

◆ materialFutures

std::vector<std::future<Ecs::MaterialLoadingData> > Ecs::ModelAssetPipeline::materialFutures
private

Definition at line 160 of file FrameProcessing.h.

Referenced by processMaterial(), and processModel().

◆ meshAssetManager

EngineCore::MeshAssetManager* Ecs::ModelAssetPipeline::meshAssetManager
private

◆ meshletGenerationFutures

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

Definition at line 162 of file FrameProcessing.h.

Referenced by processMeshData().

◆ modelAssetManager

EngineCore::ModelAssetManager* Ecs::ModelAssetPipeline::modelAssetManager
private

Definition at line 149 of file FrameProcessing.h.

Referenced by EngineCore::Engine, ModelAssetPipeline(), processModel(), and submitAsset().

◆ modelLoadingFutures

std::vector<Ecs::GltfModelFuture> Ecs::ModelAssetPipeline::modelLoadingFutures
private

Definition at line 159 of file FrameProcessing.h.

Referenced by processModel(), and submitLoadModel().

◆ pendingMeshletCompletions_

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

Definition at line 165 of file FrameProcessing.h.

Referenced by processMeshData(), and takePendingMeshletCompletions().

◆ primitiveDataFutures

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

Definition at line 161 of file FrameProcessing.h.

Referenced by processMeshData(), and processModel().

◆ renderingDataManager

EngineCore::RenderingDataManager* Ecs::ModelAssetPipeline::renderingDataManager = nullptr
private

Definition at line 151 of file FrameProcessing.h.

Referenced by processMaterial(), processTextures(), and setRenderingDataManager().

◆ textureAssetManager

EngineCore::TextureAssetManager* Ecs::ModelAssetPipeline::textureAssetManager
private

Definition at line 150 of file FrameProcessing.h.

Referenced by EngineCore::Engine, ModelAssetPipeline(), and processTextures().

◆ threadPool

NamedThreadPool* Ecs::ModelAssetPipeline::threadPool = new NamedThreadPool( 4, "Gltf loader" )
private

Definition at line 154 of file FrameProcessing.h.

Referenced by processMeshData(), and processModel().


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