MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / Run

Method Run

Source/Engine/Content/Assets/ModelBase.cpp:52–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50 }
51
52 bool Run() override
53 {
54 AssetReference<ModelBase> model = _model.Get();
55 if (model == nullptr)
56 return true;
57 PROFILE_MEM(GraphicsMeshes);
58
59 // Get data
60 BytesContainer data;
61 model->GetLODData(_lodIndex, data);
62 if (data.IsInvalid())
63 {
64 LOG(Warning, "Missing data chunk with LOD{} for model '{}'", _lodIndex, model->ToString());
65 return true;
66 }
67 MemoryReadStream stream(data.Get(), data.Length());
68
69 // Load meshes data and pass data to the GPU buffers
70 Array<MeshBase*> meshes;
71 model->GetMeshes(meshes, _lodIndex);
72 byte meshVersion = stream.ReadByte();
73 if (meshVersion < 2 || meshVersion > MODEL_MESH_VERSION)
74 {
75 LOG(Warning, "Unsupported mesh version {}", meshVersion);
76 return true;
77 }
78 for (int32 meshIndex = 0; meshIndex < meshes.Count(); meshIndex++)
79 {
80 if (model->LoadMesh(stream, meshVersion, meshes[meshIndex]))
81 {
82 LOG(Warning, "Cannot initialize mesh {} in LOD{} for model \'{}\'", meshIndex, _lodIndex, model->ToString());
83 return true;
84 }
85 }
86
87 // Update residency level
88 // Note: this is running on thread pool task so we must be sure that updated LOD is not used at all (for rendering)
89 model->_loadedLODs++;
90 model->ResidencyChanged();
91
92 return false;
93 }
94
95 void OnEnd() override
96 {

Callers

nothing calls this directly

Calls 9

GetLODDataMethod · 0.80
GetMethod · 0.45
IsInvalidMethod · 0.45
ToStringMethod · 0.45
LengthMethod · 0.45
GetMeshesMethod · 0.45
ReadByteMethod · 0.45
CountMethod · 0.45
LoadMeshMethod · 0.45

Tested by

no test coverage detected