Commit Graph

14 Commits

Author SHA1 Message Date
Benn Herrera
7f61eb7a0a GLTFIO Webp Texture Support (#9406) 2025-12-23 11:40:01 -08:00
Philip Rideout
54769a2ad3 gltfio: Move the API for recomputeBoundingBoxes.
Prior to this change, `recomputeBoundingBoxes` was an opt-in config
parameter in ResourceLoader. It is now a method on FilamentInstance.

The old API did not work for dynamically created instances. Since this
is a relatively obscure feature, we considered removing it completely,
especially since the computation requires the presence of CPU-side
vertex data combined with the transform hierarchy.

Instead of removing the feature, we decided to move it to a better
place. This paves the way for some upcoming improvements, which include
reducing the memory footprint for assets. It also improves overall code
organization and separation of concerns.
2022-08-26 09:48:04 -07:00
Philip Rideout
30dbd3ac4f Rename gltfio to filament::gltfio. 2022-06-06 16:25:02 -07:00
Philip Rideout
f035655f5b Add support for KHR_texture_basisu.
This adds a new implementation of the TextureProvider interface called
Ktx2Provider.

Tested using the KTX2 variant of the StainedGlassLamp model in the
Khronos samples repo.

Tested on WebGL 2.0 (Chrome v100), Android (Pixel 6 Pro), and Desktop
(Metal, OpenGL, and Vulkan via MoltenVK).
2022-05-02 13:15:56 -07:00
Philip Rideout
f847232296 gltfio: introduce TextureProvider API.
This allows clients to provide their own asynchronous texture decoders
for various mime-typed images. This is a plug-in component for gltfio,
in some ways similar to MaterialProvider.

There are two motivations for this: to decouple gltfio from STB and
to make it easier to integrate support for BasisU textures.

This also has the side effect of simplifying ResourceLoader, since the
texture decoding jobs have been moved out.

As part of this work, I made the "stb" CMake target into a traditional
static library. Previously we had several files called `Image.cpp`
whose sole purpose was to enable STB_IMAGE_IMPLEMENTATION.
2022-04-21 13:25:40 -07:00
Ankbzpx
fb1eb35ba5 Fix aabb misalignment for skinned gltf model (#4973) 2022-01-10 15:06:23 -08:00
Philip Rideout
c3c2a732cd gltfio: Add ResourceLoader evict API. 2021-03-03 14:41:22 -08:00
Philip Rideout
1ebdb18eae gltfio: add async cancellation API 2020-09-23 10:53:55 -07:00
Philip Rideout
a3e336921e gltfio: improve performance by assuming assets are well-formed.
glTF assets are required to provide min/max attributes for POSITION,
so in theory we never need to compute the AABB. However the option is
still there.

This PR also makes it so that Java clients can choose this option,
previously it was hardcoded for all non-native clients.
2020-06-01 10:30:09 -07:00
Philip Rideout
02b377c244 gltfio: remove locale.cpp dependency
For Android and wasm we do not use the filesystem and therefore do not
need `utils::Path`.

```
libgltfio-jni.so BEFORE 1.9 MB (693 KB gzipped)
libgltfio-jni.so AFTER  1.4 MB (542 KB gzipped)
```
2020-02-12 10:03:06 -08:00
Philip Rideout
c681cd243a gltfio: Introduce the asynchronous API and use it.
We were already using jobs for decoding PNG and JPEG files, but we were
doing a join. This add three methods to ResourceLoader that allow
clients to amortize the decoding process across multiple frames, even on
single-threaded platforms like WebGL.

This PR adds async loading to the following demos:
- samples/gltf_viewer (now shows a progress bar in the UI)
- android/sample-gltf-viewer
- web/samples/helmet.html

Fixes #1876.
2020-01-31 09:20:48 -08:00
Philip Rideout
ff66e980eb Add ResourceLoader::hasResourceData. 2020-01-28 14:51:02 -08:00
Nicklas Ansman Giertz
73a4431a34 Fix some warnings in the gltfio android jni code 2019-11-03 15:03:13 -08:00
Philip Rideout
b17d606ed2 Introduce JNI bindings for gltfio.
For now this uses gltfio in the ubershader configuration in order
to avoid the filamat dependency. Note that we have not yet done a size
analysis of the `gltfio_core` library.

New Kotlin-based sample app is forthcoming.
2019-06-18 13:53:45 -07:00