Commit Graph

97 Commits

Author SHA1 Message Date
Powei Feng
9fad497fa0 Enable c++20 for Android and iOS (#9150)
- Fix Android cmake files
- Change iOS samples to use c++20
2025-09-03 00:28:14 +00:00
Ben Doherty
58dc6715c9 iOS: avoid use of typeof (#9173) 2025-09-02 19:24:22 +00:00
Mathias Agopian
db14efc151 compress the DFG LUT with zstd
- use resgen to package the DFG LUT into filament, instead of using
  a large include of a C array.

- add a zstd compression step, which reduces the size from ~100KB to
  ~75KB.

The overhead of zstd is about 90KB uncompressed, however it will pay
for itself tenfold when we use it to compress material packages.
2025-08-07 14:58:18 -07:00
Ben Doherty
3ea8e529cc Switch filament and backend to Abseil logging (#8691) 2025-06-11 10:08:52 -07:00
Matthew Hoffman
927aa57a4e Document ASAN (with leak detection) on MacOS (#8716)
* Revert "Optional CMake flag for enabling ASAN for backend and its tests. (#8696)"

This reverts commit 543b93939a.
There were other already existing ways to achieve this without the need for new flags.

* Add documentation on running with ASAN and leak detection on mac.

BUGS=[398198310]
2025-05-09 10:22:29 -05:00
Ben Doherty
e3db39105f iOS: fix gltf-viewer crash while destruction ResourceLoader (#7684) 2024-03-19 16:14:45 -07:00
Ben Doherty
5fd7a4e153 Don't render in background (#7486) 2024-01-12 10:17:00 -08:00
Ben Doherty
b4021a1fbc Add picking queries to gltf-viewer iOS sample (#7464) 2024-01-02 14:48:59 -08:00
Ben Doherty
8aeec2ba35 Fix iOS transparent rendering sample (#7300) 2023-10-27 13:44:28 -04:00
Jacob Su
5a18cdf0f6 Fix: remove duplicated links inside ios samples. (#7190) 2023-09-25 14:19:00 -07:00
Jacob Su
8d621561f3 fix ios samples missing functional header (#7153) (#7154)
1. ios sample: ios/samples/hello-gltf;
2. ios sample: ios/samples/hello-pbr;
2023-09-11 16:25:06 -07:00
daemyung jang
f86ec07c45 Fix ios hello-gltf runtime errors 2022-10-18 10:19:22 -07:00
daemyung jang
795bd1e995 Fix build errors in ios samples 2022-10-17 09:57:58 -07:00
Philip Rideout
2d996033e3 gltfio API change part 2: remove asset-level animator 2022-09-29 16:28:50 -07:00
Mathias Agopian
ead5a97871 make AutomationEngine feature level aware
this basically just adds an Engine* parameter too all applySettings
methods
2022-09-07 15:32:58 -07: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
8dc6fde588 gltfio API change: assets are now always 'instanced' etc
This change was motivated by some internal work at Google and has the
benefit of simplifying the gltfio API and implementation. There are 2
major API changes:

(1) Consolidate separate loader entry points for GLB and GLTF.

The distinction between GLB and GLTF can be made from the file content
alone, because GLB has a 4-byte magic string in its header. There is no
need for separate entry points.  Clients do not (and should not) need
to check the file name extension.

(2) Remove the distinction between "instanced" and "non-instanced"
glTF assets.

In the new scheme, all assets have at least 1 instance.

Broadly speaking, in gltfio an "asset" is a collection of Filament
objects like textures and vertex buffers, while an "instance" is a
collection of entities and components (e.g. the transform hierarchy).

This API change makes life easier for clients because they no longer
need to decide a priori if they will ever need to add instances.

This change also moves some public-facing methods from FilamentAsset to
FilamentInstance:

    - getSkinCount, getSkinNameAt
    - getJointCountAt, getJointsAt
    - attachSkin, detachSkin
2022-08-18 08:58:24 -07:00
Philip Rideout
adf894a5bc iOS: add --quiet when running cmgen. 2022-06-09 14:31:24 -07:00
Philip Rideout
5e4025bd4c UbershaderProvider now takes a custom archive in its constructor.
We still use resgen for convience, but the archive is now passed in
from the client application.

This will allow us to shrink the gltfio Android library (stay tuned).
2022-06-09 14:31:24 -07:00
Philip Rideout
51e8a83234 Remove uberz <=> filament dependency, move ArchiveCache. 2022-06-08 08:56:49 -07:00
Philip Rideout
30dbd3ac4f Rename gltfio to filament::gltfio. 2022-06-06 16:25:02 -07:00
Philip Rideout
0ae83a6c97 gltfio: Rename all plugin classes to have "provider" suffix.
UbershaderLoader  => UbershaderProvider
    MaterialGenerator => JitShaderProvider
2022-06-06 16:25:02 -07:00
Philip Rideout
5860e7fdce Add support for ubershader archives.
An ubershader archive is a bundle of filamat packages with some metadata
that conveys which glTF features each material supports.

This PR does three things:

1. Adds a new command line tool called `uberz` that consumes a list
   of filamat files and metadata text files and produces a single
   ubershader archive.

2. Adds a new library (also called `uberz`) that is used by `gltfio`
   to read ubershader archives, and used by the above command line
   tool to write ubershader archives.

3. Enhances `UbershaderLoader` so that it no longers uses a hardcoded
   set of materials, and instead takes an ubershader archive.

Ubershader archives have a simple binary layout that can be memcpy'd
directly into a C struct. The metadata is specified using a text file
with key-value pairs. These two file formats have formal desriptions in
the README in `libs/uberz`.

In a subsequent PR, we will remove the `gltfio_resources` target and
change the signature of `createUbershaderLoader` so that it takes
an archive.
2022-06-06 13:13:22 -07:00
Philip Rideout
140ebbf10d Repair Android and iOS builds. 2022-06-01 13:09:47 -07:00
Ben Doherty
3461ec863b gltfio: Clear texture caches before loading resources (#5580)
* gltfio: Clear texture caches before loading resources

* iOS gltf-viewer: add double-tap to reload model for debugging

* iOS samples: add instructions on ASan / UBSan debugging
2022-05-20 11:41:24 -07:00
Ben Doherty
035f162ebc iOS: small improvements to sample projects (#5579)
- Ensure C++17 is used to compile sample projects
- Upgrade to the latest Xcodegen and re-generate projects
- Add a bundle ID disambiguator so users don't need create unique bundle Ids when opening sample projects
- Add a simple generate-samples.sh script
2022-05-19 15:50:51 -07:00
Philip Rideout
bf34ee6e22 gltfio: add multi-scene support. (#5524)
* Add multi-scene support to gltf_viewer.

To test this, I generated a multi-scene asset as follows.

```
gltf-transform merge Avocado/glTF/Avocado.gltf \
    BarramundiFish/glTF/BarramundiFish.gltf \
    ~/Desktop/Merged.gltf
```

* Specify c++17 in pbxproj files.
2022-05-09 11:55:32 -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
Ben Doherty
f498e08d1e Update hello-pbr to work in all orientations (#5488) 2022-05-02 14:41:32 -04:00
Philip Rideout
d76551ab28 Add async interface to Ktx2Reader. 2022-04-29 14:20:57 -07:00
Philip Rideout
b4d1443720 Repair iOS build. I think. 2022-04-21 15:36:37 -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
Philip Rideout
d52a24b6e9 Incorporate feedback from code review. 2022-04-15 10:48:48 -07:00
LaiJF
d6df4cd03a Fix typo. 2022-04-12 10:57:46 -07:00
Philip Rideout
dde060bf4d Repair iOS build. 2022-04-06 10:56:37 -07:00
Philip Rideout
b60518caa5 Add libs/ktxreader, rename some things to prep for KTX2.
Changes:

- Remove the strange header-only variant of libs/image
- Rename KtxBundle => Ktx1Bundle
- Move image/KtxUtility => ktxreader/Ktx1Reader
- Add unit test for Ktx1Reader and test stub for KTX2.

Notes:

- Ktx1Bundle does not depend on Filament and is used by cmgen
  and mipgen to generate KTX files.

- Ktx1Reader has a dependency on Filament and should therefore live in
  a separate library, which it now does.
2022-04-06 10:56:37 -07:00
Benjamin Doherty
c9df807f1f Update backend-test project with filamat dependency 2021-11-23 12:14:05 -08:00
Ben Doherty
5943382d23 iOS: avoid precision issues with CACurrentMediaTime (#4753) 2021-10-21 11:13:51 -07:00
Mathias Agopian
b5f9c66503 model/view matrices on Camera now use double precision
This PR only changes the API, internal storage and computation are 
still done in float, but this paves the way to double precision 
transforms.
2021-08-03 18:41:48 -07:00
Ben Doherty
2686b0bbac Allow iOS gltf-viewer to load models from documents directory (#4327) 2021-07-15 16:42:59 -07:00
Philip Rideout
86461663d8 Settings UI: LightManager ShadowOptions now affect all lights. 2021-06-30 09:42:00 -07:00
Benjamin Doherty
6bbae681ef Fix HelloCocoaPods iOS sample 2021-05-25 17:19:52 -07:00
Ben Doherty
5572ef8574 API CHANGE: remove some Camera, Engine, and View deprecated APIs (#3965) 2021-05-18 16:02:49 -07:00
Ben Doherty
c39d692757 ios: Don't evict gltfio materials between asset loads (#3893) 2021-05-04 16:33:10 -07:00
Ben Doherty
037982a0ef Add gltf-viewer iOS sample (#3873) 2021-04-29 12:13:34 -07:00
Ben Doherty
1a85c93894 Fix DEBUG identifier used in Log.h (#2895) 2020-07-30 16:43:42 -07:00
Ben Doherty
7cfc2c9f24 Set Filament iOS support to iOS 11 (#2809) 2020-07-13 18:04:47 -07:00
Benjamin Doherty
2e8a80f726 Fix, add xcsharedata for HelloCocoaPods sample, removal MetalKit 2020-07-10 18:00:57 -07:00
Ben Doherty
2516484566 Add HelloCocoaPods iOS sample (#2795) 2020-07-10 17:05:54 -07:00
Ben Doherty
ab98548e75 Fix iOS projects build (#2718) 2020-06-21 22:31:12 -07:00