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
| Signature | Name | Description |
|---|---|---|
MeshAsset() | MeshAsset | |
~MeshAsset() override | ~MeshAsset |
Public functions
| Returns | Name | Description |
|---|---|---|
bool | Load | 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. |
std::string | PrimaryLoadFile | |
bool | LoadFromMemory | |
void | Unload | |
bool | CreateGPU | |
bool | CreateGPUBudgeted | |
void | DestroyGPU | |
bool | CanAdoptLoadedState | |
void | AdoptLoadedState | |
ModelResource* | GetModelResource | |
size_t | GetSubmeshCount | |
uint64_t | EstimatedMemoryUsage | Index count × (vertex stride + index size) per submesh — a rough but monotonic budget figure (GPUMesh doesn't expose vertex count). |
uint64_t | EstimatedUploadBytes | |
Ref<GPUMesh> | GetGPUMesh | |
std::vector<bool> | CollisionSubmeshMask | One entry per submesh: true where a UBX_/USP_/UCP_/UCX_ node owns it. |
Material* | GetMaterial | The submesh's material, with the mesh's authored per-slot binding applied. |
bool | HasPendingSlotMaterials | 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. |
Mat4 | GetSubmeshNodeTransform | |
MeshImportSettings& | GetImportSettings | Import settings |
const MeshImportSettings& | GetImportSettings | |
void | WriteImportSettings | Metadata |
void | ReadImportSettings | |
void | ReadImportNode | |
void | WriteAssetDefaults | 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. |
void | ApplyLightmapResolution | Hands the lightmap resolution to every submesh's GPU mesh, where the GI surface cache reads it. |
bool | LoadImportSidecar | 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). |
bool | SaveAssetDefaults | Writes the asset-default keys into the mesh's existing sidecar, leaving the rest of it untouched. |
void | CollectDependencyPaths |
Function details
MeshAsset
MeshAsset()~MeshAsset
~MeshAsset() overrideLoad
bool Load(const std::string& path) overrideAsset 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
std::string PrimaryLoadFile(const std::string& path) const overrideLoadFromMemory
bool LoadFromMemory(const std::string& path, const std::string& file, std::vector<uint8_t>&& bytes) overrideUnload
void Unload() overrideCreateGPU
bool CreateGPU(const GPUContext& ctx) overrideCreateGPUBudgeted
bool CreateGPUBudgeted(const GPUContext& ctx, int budget) overrideDestroyGPU
void DestroyGPU() overrideCanAdoptLoadedState
bool CanAdoptLoadedState() const overrideAdoptLoadedState
void AdoptLoadedState(Asset& loaded) overrideGetModelResource
ModelResource* GetModelResource() constGetSubmeshCount
size_t GetSubmeshCount() constEstimatedMemoryUsage
uint64_t EstimatedMemoryUsage() const overrideIndex count × (vertex stride + index size) per submesh — a rough but monotonic budget figure (GPUMesh doesn't expose vertex count).
EstimatedUploadBytes
uint64_t EstimatedUploadBytes() const overrideGetGPUMesh
Ref<GPUMesh> GetGPUMesh(size_t index) constCollisionSubmeshMask
std::vector<bool> CollisionSubmeshMask() constOne 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
Material* GetMaterial(size_t submeshIndex) constThe 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
bool HasPendingSlotMaterials() constTrue 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
Mat4 GetSubmeshNodeTransform(size_t submeshIndex) constGetImportSettings
MeshImportSettings& GetImportSettings()Import settings
GetImportSettings
const MeshImportSettings& GetImportSettings() constWriteImportSettings
void WriteImportSettings(MdfNode& importNode) const overrideMetadata
ReadImportSettings
void ReadImportSettings(const MdfNode& importNode) overrideReadImportNode
static void ReadImportNode(const MdfNode& importNode, MeshImportSettings& out)WriteAssetDefaults
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
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
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
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
void CollectDependencyPaths(std::vector<std::string>& out) const override