Export non-readable meshes
Description
This PR allows exporting meshes that have read/write set to disabled in the import settings.
Implementation
When a mesh is not readable, it's data on the CPU can obviously not be accessed. However, it is possible to read the native buffer from the GPU by using the AsyncGPU API, as suggested by @atteneder.
Issues
Fixes https://github.com/atteneder/glTFast/issues/503
Testing
I've tested this with a many different assets in our internal workflow, which mostly involves exporting to Blender and Unity. I haven't found any issues so far. I've also run the export test from https://github.com/atteneder/glTFastTest and got the same results as the current main branch of this repository, with one exception: the Quads test fails with this PR, but does not do so without it. The reason is that the buffer size changes with this PR. The exported glTF is fully intact though. I've tested it with Blender, Babylon.js, Cesium, Filament Three.js and with the runtime import of this plugin.
@sandr01d Thanks for the contribution!
Positive:
- It works in all cases (including Draco compressed export) and is quite minimalistic in terms of complexity/lines of code added.
Negative:
- It creates a copy of each mesh (even readable ones), which adds significant overhead and surely slows down the export performance.
- It does not work with Unity 2020. It's no problem if the feature does not work in a legacy version, but it should successfully compile at least.
- Readback from GPU is async, but this code blocks on main thread until it finished (could be improved)
I'd say points 1 and 2 need to be resolved before we can move on.
I've developed a version that satisfies the mentioned shortcomings. Expect the improvement to land in an upcoming release. Again, thanks a lot!