When animation is applied to the master asset, all instances are
animated.
Instances can also be individually animated via the Animator in
FilamentInstance.
Fixes#1513.
This adds createInstancedAsset() to AssetLoader, which creates a master
asset and a set of slave instances. Vertex buffers, index buffers,
textures, and material instances are shared. Entities and components are
duplicated.
Instances have their own API object that is very simple. Light sources
and material instances are not instanced, so are not accessible through
the instance API object.
The master-slave ownership model lets us avoid complex shared ownership
semantics. The existing cache structures in AssetLoader allow the
implementation of this feature to be fairly simple.
The master asset exposes the union of all entities and allows clients to
modify all instances en masse if they wish. This design also works
naturally with ResourceLoader, which does not need to know about
instancing. For example, asynchronous loading is completely unchanged;
the dependency graph simply contains the union of entities across all
instances.
Support for animation is added in a subsequent commit.
Fixes#1513.
Vulkan complains if a pipeline declares an integer vec2 attribute but
the shader consumes it as "vec2" rather than "ivec2". gltfio was doing
this when supplying dummy texture coordinates.
This fixes one of the two bugs reported in #2573.
This needs a bit more testing before merging, but I wanted to put up the
PR for review. I will look into supporting Android after we land this.
Fixes#1932.
This replaces the "bindings" structures with simple types that re-use
data structures from cgltf.
This also moves some trivial work from ResourceLoader to AssetLoader,
which simplifies the communication between these two classes.
Motivated by #1932.
This is 466 KB insted of the usual 850 KB. It assumes that users do not
need spec-gloss, non-lit, or a special transparency mode.
(uncompressed SO size on arm64)
We can add a new maven project for this next week.
This "fixes" the new animated Fox model in the glTF conformance suite.
As per the glTF spec, we now generate per-face normals for the case
where normals are not specified in the model.
Note that true flat shading (i.e. flat interpolation) is not a
requirement in the glTF spec, since some Khronos members advocate for
WebGL 1.0 compatibility.
Fixes#2088.
This feature adds one new method to `FilamentAsset` and uses it in our
Kotlin, JavaScript, and C++ helpers:
utils::Entity popRenderable() noexcept;
This pops a ready renderable off an internal queue, or returns 0 if no
renderables have become ready. It provides a simple way for clients to
gradually add renderables to the scene as they become ready. Previously
clients could only get the entire list of entities, regardless of
whether they had Renderable components or complete textures.
To facilitate this feature, this PR adds a new internal-only class to
gltfio called `DependencyGraph`, which is a temporary object used for
bookkeeping during the asynchronous load.
`DependencyGraph` discovers ready-to-render entities by tracking the
textures that each entity depends on. This is a graph because
renderables connect to a set of material instances, which in turn
connect to a set of parameter names, which in turn connect to a set of
texture objects. These relationships are not easily inspectable using
the Filament API or ECS.
glTF specifies that client implementations must support at least two UV
texture coordinate sets but does not seem to have an upper limit.
We use a mapping table in order to honor high-numbered UV set indices,
but our mapping table only accomodates 8 entries.
Fixes#2042
This was untested because our only glTF Android sample uses glb instead
of JSON. We will soon be adding a new Android demo that uses an actual
gltf file.
This fixes#1841.
In glTF, multiple nodes can refer to the same mesh, and each node can be
assigned a unqiue string label. Previously we used NameComponentManager
to annotate entities with mesh labels rather than node labels. This was
wrong because Filament entities are 1:1 with nodes, not meshes.
We still fall back to mesh labels when node labels are not provided.
Sparse accessors are easy to punt gracefully, we can emit a warning
and instead use the dense "base" data.
Also, after cgltf support for this lands, we will need to apply sparse
data in ResourceLoader, so this adds a bit of plumbing to prep for that.
Relates to #1727.
Some buffers (like animation data) do not contain any vertex data
but web-based clients still need to know about this.
This interface is much simpler than the bindings lists, and in fact
we might remove the binding lists in the future to simplify the API.
Fixes#1593.
NOTE: Should we expose Engine::getEntityManager() to help with issues
like this? e.g. it would allow gltfio to extract it from the engine
rather than consuming an additional argument.
This fixes an entity id collision that I saw when building gltfio into
its own DSO (e.g. on Android). Since it is a separate executable it has
its own EntityManager singleton. This id collision was causing unwanted
entities to be added to the scene.
The bistro model has some UV-free primitives associated with textured
materials. This caused Filament to emit warnings like:
[entity=445, primitive @ 0] missing required attributes (0xb), declared=0x3
We now catch these in gltfio, which enables a friendlier warning so that
the artist can go make a fix:
Missing UV0 data in Bistro_Research_Exterior_Paris_Building_01_paris_building_01_bottom_4669