google / filament

Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS, and WebGL2
https://google.github.io/filament/
Apache License 2.0
17.35k stars 1.83k forks source link

switch to new morphing API #7911

Closed pixelflinger closed 2 days ago

pixelflinger commented 3 weeks ago

The new API doesn't allow a MorphTargetBuffer per RenderPrimitive, instead the MorphTargetBuffer is specified per Renderable.

gltfio separates RenderPrimitives from Renderables, in particular all RenderPrimitives are created before their Renderable; this was problematic for this change because all primitives must share a single MorphTargetBuffer living in the Renderable.

To fix this, we're no longer initializing the morphing paramters at RenderPrimitive creation, instead we store a reference to the BufferSlot in the Primtive structure, so that later, when the Renderable is created we can finally retrieve the BufferSlot and initialize its morphing paramters, which are not available. The "morphing parameters" are now expanded to contain the MorphTargetBuffer as before (except now it's always the same for all the primitives of a Rendrable), as well as the offset within the buffer and the vertex count.

caveat: this PR breaks the "extended" AssetLoader