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.
* 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>
* 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
* 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
- 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.
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.
-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.
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
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.
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.