class

MeshAsset

MeshAsset wraps a ModelResource with UUID-based identification. Load() loads the model data from VFS. CreateGPU() creates GPU vertex/index buffers.

Module
AssetSystem
Header
#include "AssetSystem/Assets/MeshAsset.h"
Namespace
Mowo

Constructors

SignatureNameDescription
MeshAsset()MeshAsset
~MeshAsset() override~MeshAsset

Public functions

ReturnsNameDescription
boolLoadAsset interface Load() runs the source/​.mmodel parse on the CPU (any non-pool thread) — this is the heavy phase, moved off the main thread by the async-import path.
std::stringPrimaryLoadFile
boolLoadFromMemory
voidUnload
boolCreateGPU
boolCreateGPUBudgeted
voidDestroyGPU
boolCanAdoptLoadedState
voidAdoptLoadedState
ModelResource*GetModelResource
size_tGetSubmeshCount
uint64_tEstimatedMemoryUsageIndex count × (vertex stride + index size) per submesh — a rough but monotonic budget figure (GPUMesh doesn't expose vertex count).
uint64_tEstimatedUploadBytes
Ref<GPUMesh>GetGPUMesh
std::vector<bool>CollisionSubmeshMaskOne entry per submesh: true where a UBX_/USP_/UCP_/UCX_ node owns it.
Material*GetMaterialThe submesh's material, with the mesh's authored per-slot binding applied.
boolHasPendingSlotMaterialsTrue while an authored slot material is still loading: until then the submesh answers with the model's inline material, and whoever copied the material pointers out has to ask again.
Mat4GetSubmeshNodeTransform
MeshImportSettings&GetImportSettingsImport settings
const MeshImportSettings&GetImportSettings
voidWriteImportSettingsMetadata
voidReadImportSettings
voidReadImportNode
voidWriteAssetDefaultsThe asset-default keys alone (cast_shadows, default_mobility, lod_group, lightmap_resolution), for a writer that edits only those — the Property Matrix — and must leave the rest of the Import block as it found it.
voidApplyLightmapResolutionHands the lightmap resolution to every submesh's GPU mesh, where the GI surface cache reads it.
boolLoadImportSidecarThe model's .mdfmeta Import block, read through the VFS so a packed archive and a loose project answer alike (the native passthrough covers the cook's absolute paths).
boolSaveAssetDefaultsWrites the asset-default keys into the mesh's existing sidecar, leaving the rest of it untouched.
voidCollectDependencyPaths

Function details

MeshAsset

C++
MeshAsset()

~MeshAsset

C++
~MeshAsset() override

Load

C++
bool Load(const std::string& path) override

Asset interface Load() runs the source/​.mmodel parse on the CPU (any non-pool thread) — this is the heavy phase, moved off the main thread by the async-import path. CreateGPU()/CreateGPUBudgeted() build the GPU buffers on the main thread from the parsed CPU data.

PrimaryLoadFile

C++
std::string PrimaryLoadFile(const std::string& path) const override

LoadFromMemory

C++
bool LoadFromMemory(const std::string& path, const std::string& file, std::vector<uint8_t>&& bytes) override

Unload

C++
void Unload() override

CreateGPU

C++
bool CreateGPU(const GPUContext& ctx) override

CreateGPUBudgeted

C++
bool CreateGPUBudgeted(const GPUContext& ctx, int budget) override

DestroyGPU

C++
void DestroyGPU() override

CanAdoptLoadedState

C++
bool CanAdoptLoadedState() const override

AdoptLoadedState

C++
void AdoptLoadedState(Asset& loaded) override

GetModelResource

C++
ModelResource* GetModelResource() const

GetSubmeshCount

C++
size_t GetSubmeshCount() const

EstimatedMemoryUsage

C++
uint64_t EstimatedMemoryUsage() const override

Index count × (vertex stride + index size) per submesh — a rough but monotonic budget figure (GPUMesh doesn't expose vertex count).

EstimatedUploadBytes

C++
uint64_t EstimatedUploadBytes() const override

GetGPUMesh

C++
Ref<GPUMesh> GetGPUMesh(size_t index) const

CollisionSubmeshMask

C++
std::vector<bool> CollisionSubmeshMask() const

One entry per submesh: true where a UBX_/USP_/UCP_/UCX_ node owns it. Physics reads those pieces as collision; every renderer must skip them, or the box drawn around a prop shows up as a second prop.

GetMaterial

C++
Material* GetMaterial(size_t submeshIndex) const

The submesh's material, with the mesh's authored per-slot binding applied. Before that binding existed the only link between a model's material slot and a .mdfmat was filename equality after sanitization — rename either side and the material silently stopped applying.

HasPendingSlotMaterials

C++
bool HasPendingSlotMaterials() const

True while an authored slot material is still loading: until then the submesh answers with the model's inline material, and whoever copied the material pointers out has to ask again.

GetSubmeshNodeTransform

C++
Mat4 GetSubmeshNodeTransform(size_t submeshIndex) const

GetImportSettings

C++
MeshImportSettings& GetImportSettings()

Import settings

GetImportSettings

C++
const MeshImportSettings& GetImportSettings() const

WriteImportSettings

C++
void WriteImportSettings(MdfNode& importNode) const override

Metadata

ReadImportSettings

C++
void ReadImportSettings(const MdfNode& importNode) override

ReadImportNode

C++
static void ReadImportNode(const MdfNode& importNode, MeshImportSettings& out)

WriteAssetDefaults

C++
static void WriteAssetDefaults(const MeshImportSettings& settings, MdfNode& importNode)

The asset-default keys alone (cast_shadows, default_mobility, lod_group, lightmap_resolution), for a writer that edits only those — the Property Matrix — and must leave the rest of the Import block as it found it.

ApplyLightmapResolution

C++
void ApplyLightmapResolution()

Hands the lightmap resolution to every submesh's GPU mesh, where the GI surface cache reads it. Runs when the GPU build lands and again when the setting is edited, which needs no reimport.

LoadImportSidecar

C++
static bool LoadImportSidecar(const std::string& modelPath, MeshImportSettings& out)

The model's .mdfmeta Import block, read through the VFS so a packed archive and a loose project answer alike (the native passthrough covers the cook's absolute paths). Editor loads get this through EditorAssetManager; the packaged runtime and the mesh cook have no registry and read it here, which is what keeps a cm-unit FBX the same size in the player as in the viewport.

SaveAssetDefaults

C++
static bool SaveAssetDefaults(const std::string& nativeModelPath, const MeshImportSettings& settings)

Writes the asset-default keys into the mesh's existing sidecar, leaving the rest of it untouched. False when the mesh has no sidecar yet.

CollectDependencyPaths

C++
void CollectDependencyPaths(std::vector<std::string>& out) const override
Generated from AssetSystem/Assets/MeshAsset.h via assetsystem.json · Nov 4, 2026Version 1.0.0