Commit Graph

83 Commits

Author SHA1 Message Date
Romain Guy
32604e2c57 Fix sample-textured-object 2020-03-30 18:54:46 -07:00
Romain Guy
880642ef4a Fix crash in glTF sample for Android 2020-03-12 14:27:11 -07:00
Romain Guy
8eaa1f5e88 Add options to skip samples (#2163)
-DFILAMENT_SKIP_SAMPLES=ON with CMake
-Pfilament_skip_samples with gradle

This change also renames CMake options specific to Filament
to avoid clashes with subprojects.
2020-02-24 18:15:33 -08:00
Philip Rideout
a0d43d51c9 Add gradle flavor for gltfio-lite.
This cribs the strategy from filamat-lite and also fixes a "more than
one file" gradle error.
2020-02-20 09:45:33 -08:00
Philip Rideout
45e6e6eb18 sample-gltf-viewer now supports landscape orientation. 2020-02-07 15:20:41 -08:00
Philip Rideout
317d78d7c6 sample-gltf-viewer: enable gzip compression for bin and ktx. 2020-02-05 18:45:30 -08:00
Philip Rideout
1452ce62f4 Remove srcDirs hack, use packagingOptions / exclude. 2020-01-28 12:31:14 -08:00
Philip Rideout
d84d095c97 The Android support libs now use dynamic linking.
In my first attempt I kept the multiple project-level dependencies in
each sample's `build.gradle` but that resulted in a gradle error
concerning multiple copies of the same SO file. To work around this
we now append to "srcDirs" to bring in Java dependencies rather than
using project-level dependencies.

The new APK contents are now much more reasonably sized:

    libfilament-jni.so         981 KB
    libgltfio-jni.so           817 KB
    libfilament-utils-jni.so    96 KB

Previously this was:

    libfilament-utils-jni.so    1.8 MB
    libgltfio-jni.so            1.8 MB (unused)
    libfilament-jni.so          1 MB (unused)

Fixes #2070
2020-01-28 12:31:14 -08:00
Philip Rideout
3674361f20 ModelViewer now automatically detaches. 2020-01-23 09:55:51 -08:00
Philip Rideout
4a29456a7a ModelViewer now works with TextureView. 2020-01-23 09:55:51 -08:00
Philip Rideout
3179a83cfb Android: introduce ModelViewer helper.
This reduces the LOC of our gltf-viewer app from 260 to 146. This could
have been more, but I feel this provides good balance between
flexibility and convenience.

The raw gltfio API involves multiple objects (FilamentAsset,
AssetLoader, ResourceLoader) whereas the ModelViewer has a simple facade
consisting of two methods, one for GLB and one for GLTF. The underlying
gltfio objects are available via non-settable properties.
2020-01-23 09:55:51 -08:00
Philip Rideout
518ae9658f gltfio + Android: improve memory management.
Add bindings for releaseSourceAsset() and fix a double-free issue.

According to the Android Studio profiler, this makes Java memory usage
go from 18.6 MB to 6.5 MB.
2020-01-21 13:01:55 -08:00
Philip Rideout
46bf6fbfdd Simplify sample-gltf-viewer as much as possible. 2020-01-21 12:57:50 -08:00
Philip Rideout
ca2da39614 Migrate TextureLoader to filament-utils. 2020-01-21 07:59:51 -08:00
Philip Rideout
9ac17a88b3 Add new sample for glTF models and the camera manipulator.
This differs from the bloom demo in that it supports touch interaction,
has animation, loads from GLTF rather than GLB, and is overall simpler.
2020-01-17 09:09:46 -08:00
Philip Rideout
961860adee Introduce filament-utils and Java bindings for camutils.
This library houses the KTX loader, camutils bindings, and a Kotlin math
library. More will come later. Sample app is forthcoming.
2020-01-16 16:00:23 -08:00
Philip Rideout
274cd3a1f3 Refactor some Android build things for gltfio.
We currently use static linking and will continue to do so. This means
that libfilament-jni is a subset of of libgltfio-jni, and libgltfio-jni
will become a subset of the upcoming libutils-jni.

This is a simple layer cake, but requires adding some CMake logic to the
gltfio-android CMakeLists, similar to what we already did for the
filament-android CMakeLists. This prevents an obscure CMake error about
duplicated build artifacts.

Also, previously we required clients to call AssetLoader#init(), this
is now renamed to Gltfio#init(), which is more consistent with
Filament#init().
2020-01-16 10:11:36 -08:00
Philip Rideout
4ab65975f4 Update Android Studio required version. 2020-01-15 11:22:57 -08:00
Philip Rideout
4f8c495563 Another gltf_bloom fixup. 2020-01-09 14:31:43 -08:00
Philip Rideout
34c2772a60 Remove unused source file. 2020-01-09 14:10:33 -08:00
Philip Rideout
4d258ab5e8 Remove a build output file. 2020-01-09 14:07:20 -08:00
Philip Rideout
a306f9074a Clean up gltf-bloom to prep for new gltf-viewer app.
This renames the app namespace and removes the unused Io file.
2020-01-09 13:49:24 -08:00
Romain Guy
d9ee2fa10d Use a proper Gradle plugin to generate Filament assets in samples (#2018) 2020-01-08 15:45:44 -08:00
Romain Guy
f5d5afba74 Re-organize Android Gradle files (#2013)
* Re-organize Android Gradle files

Clean up our Gradle files, share versioning, etc. and prepare for
publication to sonatype.

* Use androix annotations for desktop

* Add samples as subprojects to root Gradle

* Fix build script

* Don't break when samples aren't compiled

* Better organize the Android Studio project
2020-01-07 18:37:45 -08:00
Philip Rideout
e09f0bb99f Repair gradle IBL path for gltf_bloom.
I broke this when I changed the cmgen KTX behavior.
2020-01-07 14:05:40 -08:00
Mathias Agopian
8088f0cd6f fix android samples
these samples broke with the new 5 lods ibls
2019-12-10 16:56:19 -08:00
Philip Rideout
8ea6e6ce59 Upgrade hello-camera to use AHardwareBuffer. 2019-12-06 08:46:37 -08:00
Philip Rideout
60ead8c5f3 Add Android sample for testing the Stream API.
This new sample differs from "Hello Camera" in that it exercises all
three ways of using Stream. It also uses Canvas instead of Camera2 to
draw into the external texture. It shows two sets of stripes, one
animated using the shader and the other animated using Canvas. If the
two stripes are aligned, then the stream is perfectly synchronized.
Users can tap the screen to cycle between the three modes.
2019-11-26 07:58:52 -08:00
Philip Rideout
389349198f gltfio-jni: Fix double-init panic caused by build issues.
Filament keeps a global static list of engines for verification purposes
which was being recreated multiple times, causing a panic. After a lot
of experimentation with the build, I was not able to fix this while
keeping the current scheme of dynamically loading both libraries.

As a "solution", we now staticly link filament into gltfio-jni, and ask
clients to load only that.

Fixes #1811.
2019-10-30 09:51:14 -07:00
Philip Rideout
2a229571ad Minor fixes to gltf-bloom demo. 2019-10-29 10:20:28 -07:00
Philip Rideout
3db035520b gltf-bloom now invokes the gltfio animator.
Tested with CesiumMan.
2019-10-28 09:32:39 -07:00
Philip Rideout
3618f14531 Add Android sample for Camera Stream.
This simple Kotlin app projects a live feed on the side of a cube.
It looks very similar to the `lit-cube` demo but there is a new Kotlin
class called `CameraHelper` that creates Camera2 objects, starts
the capture session, creates the Filament texture, etc.

For now, this app uses SurfaceTexture. This is a starting point and
provides a testing ground for tentative improvements to our Stream API.
2019-10-16 09:05:24 -07:00
Ben Doherty
d0bc23473c Fix crash when using Filamat lite library (#1780) 2019-10-15 10:49:59 -07:00
Mathias Agopian
20c3d45b9c Engine.flushAndWait() is not needed in most places 2019-10-03 16:04:22 -07:00
Romain Guy
4b669fb1c7 Fix formatting 2019-10-03 14:25:39 -07:00
Romain Guy
a67d92c2ca Lower limit from API 21 to API 19 (#1701)
* Lower limit from API 21 to API 19

This was requested by an internal application. API 19 is when OpenGL
ES 3.0 support was added so there is no good reason for us to not
support this API level. The only trick is to avoid referring to the
glTexStorage2DMultisample symbol directly as it only exists in 3.1.

* Compile out code we never use

* Use reflection to handle shared EGL contexts pre-API 21.

* Remove comment

* More fixes required to run on API level 19

- dlym() fails for ashmem on API 19, so we only try on API 26+ instead.
- Older emulation for OpenGL ES 3.0 returns error states for valid API calls so we need to clear the GL error bit before we create the GL driver.
- Activity lifecycle changes since API 19 would cause animations to keep running and to reference destroyed objects.
- EGLContext.getNativeHandle() is new in API 21, we need to use reflection on API 19. The new code path uses the class loading trick to avoid a bytecode verification error on API 19.

* Filament now runs properly on API level 19

This commit adds a new api_level() API to libutils which can be used to
query the platform's API level. On Android it works as expected, other
platforms currently return 0.
2019-09-28 14:13:06 +03:00
Romain Guy
d0b5c5cee8 Update compile & targetSdk from 28 to 29 (#1691) 2019-09-25 22:25:43 +03:00
Romain Guy
9b9548306d Fix Android samples (#1688)
Fixes #1687
2019-09-25 15:48:30 +03:00
Romain Guy
d0f38c2d5d Update Gradle, AGP and Kotlin 2019-08-23 11:52:30 -07:00
Philip Rideout
a09c3b154a Fix paths in android glTF demo. 2019-08-13 12:47:08 -07:00
Romain Guy
52a8f50539 Fix backface issue in lit-cube sample 2019-08-09 16:10:12 -07:00
Philip Rideout
91ff1d87eb Replace prebuilt KTX with a build step.
This removes the samples/envs folder and replaces these KTX files with a
build step that is driven by CMake / gradle / bash, depending on
platform.

This makes it easier to use IBL files that are generated by the latest
and greatest version of cmake.
2019-08-08 10:41:13 -07:00
Philip Rideout
927662ea4d Add JNI for KTX, simplify the bloom Android demo. 2019-07-02 11:02:45 -07:00
Philip Rideout
10dc3a24e8 Add Kotlin sample for gltfio and custom render targets. 2019-06-26 13:55:23 -07:00
Romain Guy
957ec9be60 Use R11G11B10F instead of RGBM in Android sample apps (#1333) 2019-06-20 16:31:17 -07:00
Mathias Agopian
edb1beac3d give internet permission to ibl sample
this allows us to use snapdragon profiler
2019-06-05 14:34:58 -07:00
Mathias Agopian
95b4cdf819 Fix SSAO and SAO on Mobile devices
The fragment shader didn't work because of the default mediump
precision for floats on mobile.
We had the highp precision qualifier where needed.
2019-05-19 23:25:28 -07:00
Philip Rideout
ad79bb8532 Upgrade Gradle and gradle wrappers. (#1123)
This includes a small change to our custom material task because old
gradle passed only the contents of out-of-date directories, newer gradle
passes both the contents and the directory itself.
2019-04-23 12:19:06 -07:00
Philip Rideout
570dd8a869 Add an extra clean task to Android samples.
It is easy to run into our new material version error if a stale
filamat file is sitting around, this helps with that.
2019-03-25 17:39:47 -07:00
Mathias Agopian
02ed4c6c4d update filamesh file 2019-03-19 17:20:52 -07:00