Description
Describe the bug
There is a bug where the intensity and rotation of the loaded IBL cannot be set in the desktop gltf_viewer
after using the drag and drop feature.
To Reproduce
Steps to reproduce the behavior:
- Load an IBL file using the drag and drop feature in the desktop
gltf_viewer
. - Attempt to set the intensity and rotation of the loaded IBL.
Expected behavior
The intensity and rotation of the loaded IBL should be adjustable from the desktop gltf_viewer
GUI.
Screenshots
Not applicable.
Logs
Not applicable.
Desktop (please complete the following information):
- OS: Windows 11
- GPU: NVIDIA GTX 3050 Laptop
- Backend: Vulkan
Smartphone (please complete the following information):
- Device: Not applicable.
- OS: Not applicable.
Additional context
I have identified the issue and made some modifications to fix it. Here are the changes:
Proposed Fix
Here are the changes I made to fix the issue:
filamentApp.setDropHandler([&](std::string_view path) {
utils::Path filename = getPathForGLTFAsset(path);
if (!filename.isEmpty()) {
if (checkGLTFAsset(filename)) {
app.resourceLoader->asyncCancelLoad();
app.resourceLoader->evictResourceData();
app.viewer->removeAsset();
app.assetLoader->destroyAsset(app.asset);
loadAsset(filename);
loadResources(filename);
app.viewer->setAsset(app.asset, app.instance);
}
return;
}
filename = getPathForIBLAsset(path);
if (!filename.isEmpty()) {
FilamentApp::get().loadIBL(path);
auto ibl = FilamentApp::get().getIBL();
if (ibl) {
app.viewer->setIndirectLight(ibl->getIndirectLight(), ibl->getSphericalHarmonics());
app.viewer->getSettings().view.fogSettings.fogColorTexture = ibl->getFogTexture();
}
return;
}
});
These changes ensure that the loaded IBL can have its intensity and rotation set in the desktop gltf_viewer.