mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-06 09:03:52 +00:00
fix(editor): begin upload batch before M2 model loading in rebuild
rebuildObjects() calls clearObjects() which clears the M2 renderer, but didn't start a new upload batch before loading models. The M2 renderer needs an active upload batch context to upload vertex/index buffers to the GPU. Without it, loadModel may silently fail. Now calls vkCtx_->beginUploadBatch() after clear and before the model loading loop. Also adds diagnostic logging when loadModel fails for NPCs (shows vertex/index/batch counts).
This commit is contained in:
parent
98223995fc
commit
072d0f78c2
1 changed files with 7 additions and 1 deletions
|
|
@ -119,6 +119,7 @@ void EditorViewport::rebuildObjects(const std::vector<PlacedObject>& objects,
|
|||
clearObjects();
|
||||
if (objects.empty() && npcs.empty()) return;
|
||||
|
||||
vkCtx_->beginUploadBatch();
|
||||
uint32_t nextModelId = 1;
|
||||
std::unordered_map<std::string, uint32_t> m2ModelIds, wmoModelIds;
|
||||
|
||||
|
|
@ -359,7 +360,12 @@ void EditorViewport::rebuildObjects(const std::vector<PlacedObject>& objects,
|
|||
}
|
||||
if (!ok) { LOG_WARNING("NPC M2 bad vertices: ", npc.modelPath); continue; }
|
||||
modelId = nextModelId++;
|
||||
if (!m2Renderer_->loadModel(model, modelId)) continue;
|
||||
if (!m2Renderer_->loadModel(model, modelId)) {
|
||||
LOG_WARNING("NPC M2 loadModel failed: ", npc.modelPath,
|
||||
" (", model.vertices.size(), "v ", model.indices.size(), "i ",
|
||||
model.batches.size(), "b)");
|
||||
continue;
|
||||
}
|
||||
vkCtx_->waitAllUploads();
|
||||
vkCtx_->pollUploadBatches();
|
||||
m2ModelIds[npc.modelPath] = modelId;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue