gltfio: allow zero-instance assets.
This is a feature request from Google. It allows users to "preload" an asset, ie you can now create all VertexBuffer objects, Texture objects, etc, without actually creating any entities or renderable components. In the past we used TransformManager to help out with computing the big asset-level bounding box, but now we use `gltf_node_transform_world()` because entities might not yet exist. One minor side effect is that `FilamentAsset::getBoundingBox()` now returns the AABB that was determined at load time, and does not account for instances. As a result, our `gltf_instances` sample app looks slightly different but this is expected.
This commit is contained in:
@@ -331,6 +331,11 @@ bool ResourceLoader::loadResources(FFilamentAsset* asset, bool async) {
|
||||
}
|
||||
asset->mResourcesLoaded = true;
|
||||
|
||||
// At this point, any entities that are created in the future (i.e. dynamically added instances)
|
||||
// will not need the progressive feature to be enabled. This simplifies the dependency graph and
|
||||
// prevents it from growing.
|
||||
asset->mDependencyGraph.disableProgressiveReveal();
|
||||
|
||||
// Clear our texture caches. Previous calls to loadResources may have populated these, but the
|
||||
// Texture objects could have since been destroyed.
|
||||
pImpl->mBufferTextureCache.clear();
|
||||
|
||||
Reference in New Issue
Block a user