Commit Graph

117 Commits

Author SHA1 Message Date
Philip Rideout
30b0f39a36 sample-gltf-viewer: add polish to the drag-and-drop feature. 2021-03-03 14:41:22 -08:00
Philip Rideout
9ceb3b016c sample-gltf-viewer: add drag-and-drop feature.
This adds a WebSockets server to filament-utils-android.

Unlike my first attempt (#3599), this does not use a piping server and
is therefore much faster to use over a LAN. It also has lower user
friction because there is no need to touch a button in the app or
scan a QR code.
2021-03-03 14:41:22 -08:00
Philip Rideout
2964e99175 sample-gltf-viewer: add URL hint. 2021-03-03 12:10:42 -08:00
Romain Guy
adb489c77a Compile Android libraries with fPIC (#3473)
* Compile Android libraries with fPIC

* Rmove warning
2021-01-29 15:23:34 -08:00
Romain Guy
4567b01c1d Multi-thread shaders generation when compiling materials (#3464)
* Stop using members as globals between methods

* Multi-thread shaders generation with JobSystem

* Pass JobSystem to MaterialBuilder::build()

* Fix MeshAssimp to use the new API

* Allow the Java API to pass a job system via Engine

* Update docs

* Apply suggestions from code review

Co-authored-by: Philip Rideout <philiprideout@gmail.com>
2021-01-29 09:30:37 -08:00
Ben Doherty
f31eb09ca0 Add Live Wallpaper Android sample (#3161) 2020-10-06 11:03:55 -06:00
Pixelflinger
08e411aeac API CHANGE: make ssao options work like all other options
setAmbientOcclusion (and associates) is now deprecated (but still works),
in favor of the new .enabled field in AmbientOcclusionOptions.
2020-08-10 17:23:03 -07:00
Philip Rideout
2727cddd7a TextureHelper: add overload with a release callback.
Fixes #2909.
2020-08-05 17:27:12 -07:00
Philip Rideout
b4623c9afc Add lightroom IBL, enable ColorGrading by default in gltf_viewer.
The non-legacy ACES is now default, it looks much better.

I also tested this IBL with WebGL and Android.
2020-07-30 11:39:36 -07:00
Philip Rideout
2f4dd0bbd4 sample-page-curl: add comments to variables, etc. 2020-07-27 07:35:58 -07:00
Philip Rideout
a79effc78b Page Curl: fix CPU animation. 2020-06-18 19:38:41 -07:00
Philip Rideout
66471ee990 Page Curl: add configurable curl style. 2020-06-18 19:35:42 -07:00
Philip Rideout
ebd195f8e4 matdbg: Add support for Android.
See the matdbg README for details.
2020-06-14 22:42:55 -07:00
Rupert Rawnsley
b0acb3216a eglInitialize requires a non-null IntArray reference and different offsets for major and minor. (#2668) 2020-06-10 08:52:20 -07:00
Philip Rideout
43f7bad8a3 Kotlin cleanup 2020-06-05 08:23:25 -07:00
Philip Rideout
b281022eb0 sample-page-curl: flip the backface image. 2020-06-03 12:07:43 -07:00
Philip Rideout
91a009f94c Add new async method to ModelViewer.
If you now try loading Bistro, the skybox shows up fairly quickly.
This works by moving AssetManager uncompression off the UI thread.
2020-06-02 18:36:49 -07:00
Romain Guy
e9d1e3a82e Stop using deprecated APIs for incremental builds (#2574) 2020-05-21 22:15:55 -07:00
Philip Rideout
cdd099951a sample-page-curl: add rigidity parameter. 2020-05-19 16:48:55 -07:00
Philip Rideout
432ed50cb3 sample-page-curl: use inverseTonemap() etc. 2020-05-19 16:48:55 -07:00
Philip Rideout
5f34b8974f Fix buffer size bug in sample-page-curl. 2020-05-18 14:34:46 -07:00
Romain Guy
3e5fe994b9 Fix default lighting intensities in ModelViewer
They were waaay too high
2020-05-05 00:25:19 -07:00
Philip Rideout
4c1fb83379 sample-page-curl: move license file out of resources 2020-04-20 12:24:12 -07:00
Philip Rideout
bee9ab31bc Add new Android demo: sample-page-curl.
Pure Java app that demonstrates custom vertex shader animation and
two-sided texturing.
2020-04-17 11:12:55 -07:00
Mathias Agopian
1b36f82c1e API BREAKAGE: this change aims to fix multi-view support (#2376)
* API BREAKAGE: this change aims to fix multi-view support


What has changed:
- View doesn't have a notion of clear color anymore
- View doesn't have a notion of discard flags anymore
- The clear color and color-buffer discard/clear flags are moved to Renderer
- Skybox can now be set to a constant color
- View have a blend-mode

What does is all mean:
"Clearing" (i.e.) setting its background is now handled by Skybox, by
setting a constant color to the Skybox. This should take care of
drawing views side by side.

When a view needs to be drawn on top of another, it's BlendMode needs to
be set to TRANSLUCENT and of course and, generally, it wither won't have
a skybox, or will have one that sets some translucent pixels.

As an optimization, a View with BlendMode::OPAQUE will have its
background cleared with the color specified in Renderer.

If the SwapChain already has some content, it's now possible to set
the Renderer to not discard the content, together with TRANSLUCENT views,
it's possible to draw on top of that content.


It is NOT possible to share depth/stencil buffers between views.

Fixes: #2369, #2372, #2364

* Address reviewers comments.

Note: WebGL is still broken with this PR
2020-04-10 15:54:14 -07:00
Mathias Agopian
d4f9ede84b improve DisplayHelper to handle frame rate changes (#2366) 2020-04-09 11:32:22 -07:00
Pixelflinger
6bb909bd0e newly created color buffers were not cleared properly
there were cleared with the view's clear color instead of 0
2020-04-09 11:30:31 -07:00
Romain Guy
1ef3535ba7 Expose Java API to control discard flags (#2368)
* Expose Java API to control discard flags

This change also adds the new sample sample-multi-view that shows
how to use discard flags to render multiple views.

* Disable clears
2020-04-08 16:03:49 -07:00
Pixelflinger
746e273336 rework how dynamic resolution scaling is specified
- now the DynamicResolutionOptions don't specify the target frame rate,
  they only specify how to scale this given view

- there is a new FrameRateOptions setting on Renderer, which is used
  to specify the desired target frame rate for the whole Renderer

- the frame rate is now specified as a "frame interval" in units of
  the display frame period.

- the display frame period is (indirectly) set via DisplayInfo.

In other words, the use must set (and update) DisplayInfo properly
(the default are reasonable, but assume 60 Hz). They must also set the
desired interval (default is 1, which is probably what you want).
Finally they must enable dynamic scaling per View, the defaults are
also reasonable.

Currently Renderer doesn't attempt (yet) to actually target the
requested frame rate, so it's up to the caller to push frames at the
desired speed. however, dynamic resolution, like before, will attempt
to shrink work to fit the target.
2020-04-06 16:55:24 -07:00
Pixelflinger
b2dd6683be Add a way to query and set Display information
Renderer can now be given a DisplayInfo that contains some
important information about the current display. This will be used
for frame-pacing and dynamic-resolution.

This is most relevant on Android, where we can accurately query these
parameters. Added support for that in our samples.


This also sets the minSDK to 19 (including gltf viewer's), since this is
the version we support. We were cheating before by under-reporting our
minSdk.
2020-04-06 16:55:24 -07:00
Pixelflinger
526898e7d6 add vsync timestamp to Renderer::beginFrame() API 2020-04-06 16:55:24 -07:00
Philip Rideout
2dbe0b64be gltfio misc fixups 2020-04-02 14:54:19 -07:00
Philip Rideout
f084e50829 Remove old bloom samples to avoid confusion.
These should not be confused with our core bloom feature. For testing
the RenderTarget API, it would be better to create a small focused demo.
2020-04-02 09:05:36 -07:00
Pixelflinger
a389de3deb enable dynamic-resolution in android gltf viewer 2020-04-01 22:18:50 -07:00
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