| 1418 | } |
| 1419 | |
| 1420 | void StudioApp::loadModelPreview(const std::string& path) |
| 1421 | { |
| 1422 | // Cache key includes path, LOD, and view |
| 1423 | std::string key = path + ":" + std::to_string(modelLodIndex) + ":" + modelView; |
| 1424 | if (modelPreviewKey == key) |
| 1425 | return; |
| 1426 | clearPreviewTexture(); |
| 1427 | modelPreviewKey = key; |
| 1428 | |
| 1429 | if (!sdlRenderer) |
| 1430 | return; |
| 1431 | |
| 1432 | try |
| 1433 | { |
| 1434 | ModelPreviewOptions opts; |
| 1435 | opts.width = 512; |
| 1436 | opts.height = 512; |
| 1437 | opts.lodIndex = modelLodIndex; |
| 1438 | opts.view = modelView; |
| 1439 | auto preview = PreviewModel(path, opts); |
| 1440 | if (preview.valid()) |
| 1441 | { |
| 1442 | previewTexture = SDL_CreateTexture(sdlRenderer, SDL_PIXELFORMAT_RGB24, SDL_TEXTUREACCESS_STATIC, |
| 1443 | preview.width, preview.height); |
| 1444 | if (previewTexture) |
| 1445 | { |
| 1446 | SDL_UpdateTexture(previewTexture, nullptr, preview.data.data(), preview.width * 3); |
| 1447 | previewTexW = preview.width; |
| 1448 | previewTexH = preview.height; |
| 1449 | previewTextureFile = path; |
| 1450 | log("Model preview: LOD " + std::to_string(modelLodIndex) + " [" + modelView + "]"); |
| 1451 | } |
| 1452 | } |
| 1453 | } |
| 1454 | catch (const std::exception& e) |
| 1455 | { |
| 1456 | log("Model preview error: " + std::string(e.what())); |
| 1457 | } |
| 1458 | } |
| 1459 | |
| 1460 | void StudioApp::renderLoadingScreen(const ImVec2& displaySize) |
| 1461 | { |
nothing calls this directly
no test coverage detected