Unable to set intensity and rotation of loaded IBL in desktop gltf_viewer
- Dominant language
- C++
- Stars
- 20.5k
- Forks
- 2.3k
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 74
Description
⚠️ **Issues not using this template will be systematically closed.**
**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:
1. Load an IBL file using the drag and drop feature in the desktop `gltf_viewer`.
2. 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:
```cpp
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.
Contributor guide
Assessment
This issue has not been assessed yet.