Commit Graph

381 Commits

Author SHA1 Message Date
Ben Doherty
94776a01b3 Add JNI bindings for gltfio camera (#2693) 2020-06-16 15:24:24 -07:00
Ben Doherty
7a1c079050 Use an int, not byte, for variantFilter (#2691) 2020-06-15 11:38:43 -07:00
Philip Rideout
ebd195f8e4 matdbg: Add support for Android.
See the matdbg README for details.
2020-06-14 22:42:55 -07:00
Philip Rideout
899ac1224f gltfio: Add Java bindings for desktop.
This is completely untested.

Fixes #2670.
2020-06-12 13:47:54 -07:00
Philip Rideout
fa0f5e0501 Prep the build for multi-platform matdbg. 2020-06-10 20:00:24 -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
f125e1730d Throw Java exception when using destroyed Animator.
Someone wise once said: "It is better to throw in Java than to crash in
Native."

Motivated by #2654.
2020-06-09 10:36:35 -07:00
Rupert Rawnsley
18776fc432 SamplerType JNI definition was out of step with the native definition. (#2658)
When invoking MaterialBuilder.samplerParameter with Java enum SAMPLER_EXTERNAL it was wrongly recast as native enum SAMPLE_CUBEMAP in the JNI interface because the Java enum was missing SAMPLE_2D_ARRAY.
2020-06-09 08:35:33 -07:00
Romain Guy
4bf21876b4 Add new color grading feature, vibrance (#2656)
* Add new color grading feature, vibrance

* Address code review comment
2020-06-09 08:34:10 -07:00
Romain Guy
b4d2a1991a Add new curves color grading tool (#2651)
* Add new curves color grading tool

* Add release notes
2020-06-08 12:17:53 -07:00
Philip Rideout
43f7bad8a3 Kotlin cleanup 2020-06-05 08:23:25 -07:00
Romain Guy
2fcca9677d Add Ushimura tone mapping operator
Also fix potential negative values when applying white balance
during color grading.
2020-06-04 15:17:08 -07:00
Romain Guy
1935598a7d Add Java bindings for ColorGrading (#2638) 2020-06-04 11:03:15 -07:00
Philip Rideout
b281022eb0 sample-page-curl: flip the backface image. 2020-06-03 12:07:43 -07:00
Philip Rideout
7418fc0222 gltfio: JNI bindings for get-by-name.
Tested in Android Studio by starting sample-gltf-viewer and typing the
following into the debugger:

    modelViewer.asset!!.getFirstEntityByName("Drone_Body")
    modelViewer.asset!!.getEntitiesByName("Drone_Body")
    modelViewer.asset!!.getEntitiesByPrefix("Drone")
2020-06-02 18:38:36 -07:00
Philip Rideout
9437907eb4 ModelViewer now uses a coroutine. 2020-06-02 18:36:49 -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
Philip Rideout
6c173489d7 gltfio: Add get-by-name and get-by-prefix methods.
Java bindings will be forthcoming in a separate commit.
2020-06-02 10:17:12 -07:00
Philip Rideout
28912b6f57 filamat-android: fix string leaks 2020-06-02 10:16:41 -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
Romain Guy
b77e024de9 Introduce ColorGrading API (#2613)
* Introduce ColorGrading API

A ColorGrading object will eventually be settable on a View to
choose the tone mapping and other color transformations.

There is currently only a single default ColorGrading instance
used by all views.

* Use raw function pointers
2020-05-29 18:54:48 -07:00
Philip Rideout
81ea280ea9 gltfio: add Java bindings for instancing. 2020-05-29 09:22:17 -07:00
Romain Guy
1f29df6da4 Add a note about AGP 4.0.0 2020-05-28 14:05:20 -07:00
Philip Rideout
c087eb6825 gltfio: Add Java / JavaScript bindings for lights. 2020-05-28 11:51:35 -07:00
Jaime Blasco
5104318fff Initialize DisplayHelper when using textureView in ModelViewer (#2598) 2020-05-27 10:10:13 -07:00
Pixelflinger
62ff7b7d0a Improve AO buffer upsampling
Since AO is computed at 1/4 resolution, it is necessary to upsample
the AO buffer. Until now this was done with a bilinear tap, which is
less than ideal as it can creates jaggies at edges.

High quality upsampling can now be enabled and uses a bilateral filter.
The cost is about 2.0 ms at 250MHz on Pixel 4. ES3.1 is required.
2020-05-26 12:59:47 -07:00
Pixelflinger
d62f664957 ssao: restrict the scaling to 0.5 and 1.0
until now we allowed any resolution for SSAO, but it didn't make
much sense, especially that the depth pass is now used for other things.
To keep things more manageable, we only allow 0.5 and 1.0 scale
factor settings (respectively quarter and full resolution).
2020-05-26 12:59:47 -07:00
Philip Rideout
dc51dc197c Gradle: update old property name.
I forgot to update this in 0b1fa7f.
2020-05-22 23:28:30 -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
Philip Rideout
0b1fa7fc80 Enable Vulkan for Android by default.
The presence of a special Gradle property is now used to exclude Vulkan
support from the build. By making Vulkan "always on" for local
development, we can avoid stale CMake cache issues that arise from
toggling the Gradle property. It also lets you avoid adding the flag
to Android Studio preferences.

This is motivated by testing and does not indicate production readiness.
Clients still need to pass VULKAN into the Engine constructor to select
the Vulkan backend.

To keep APK size down and keep CI fast, we are continuing to exclude
Vulkan from official Android builds.

After syncing this change, you might need to use `./build.sh -c` to
clobber various build caches.
2020-05-18 09:34:55 -07:00
Ben Doherty
8780d7aae5 Bump version to 1.7.0 (#2541) 2020-05-15 10:41:51 -07:00
Philip Rideout
0a9236c2eb Make JNI constructors private unless they take Engine.
This removes (rather than deprecates) all public constructors that
take a native pointer without an accompanying Engine.

Most notably, MaterialInstance had a public pointer constructor which
is now package private. This means that FilamentAsset needs an Engine,
so it now takes the one from AssetLoader.
2020-05-12 15:41:19 -07:00
Philip Rideout
0a61faa57a KtxLoader should pass Engine to Texture constructor. 2020-05-12 10:57:21 -07:00
Philip Rideout
26520c8d23 filament-utils: Improve ModelViewer flexibility. 2020-05-12 10:57:21 -07:00
Philip Rideout
9a47178b3d gltfio: expose getMaterialInstances to Java.
Tested locally by hacking gltf-viewer on Android, added the following
lines to MainActivity:

```kotlin
for (mat in modelViewer.asset!!.materialInstances) {
    Log.d("gltf-viewer", mat.name)
}
```
2020-05-11 10:39:13 -07:00
Ben Doherty
a3fb5c41f1 Make note of VS2019 for building Android on Windows 2020-05-11 09:47:14 -07:00
Kostiantyn Zghirovskyi
5ef816ef2a Clarify Windows build instructions (#2507) 2020-05-11 09:33:14 -07:00
Kostiantyn Zghirovskyi
2260fe5b62 Fix filament-utils-android build on Windows (#2508)
* Fix filament-utils-android build on Windows

* Update build.gradle

* nit: use char version instead

* Fix No signature of method: java.lang.String.replace() is applicable for argument types: (Character, String) values: [\, /]
2020-05-08 16:57:16 -07:00
Pixelflinger
e07f0dd244 Texture(Engine, long) instead of Texture(long)
deprecated Texture(long nativeTexture) in favor of
Texture(Engine, long nativeTexture), there is no difference
currently,  but in the future Texture(Engine, long nativeTexture) 
will be able to validate the native pointer.
2020-05-08 15:39:14 -07:00
Pixelflinger
d194eec0ad report to java when an object can't be destroyed
The JNI layer already does this, but can only track objects it created,
sometimes developers might create filament objects on the native side
and wrap them into java objects and this might cause a failure to
detected when objects are double-destroyed.

However, this can often be caught by the native code -- so, when the
native side is asked to destroy an object that doesn't exist, we now
return an error (exception if enabled) and we throw an exception
on the java side.

Filament typically doesn't do this kind of tests, however these bugs
can be very hard to find, and the cost is small.
2020-05-08 15:39:14 -07:00
Philip Rideout
f53f03b5dd Java MaterialInstance::getName now creates string lazily. 2020-05-08 09:44:49 -07:00
Philip Rideout
474fe9c5ed Change behavior of MaterialInstance::getName. 2020-05-08 09:44:49 -07:00
Philip Rideout
c3c8293862 MaterialInstance now has an optional name.
When no name is provided during instance creation, it does NOT inherit
the name of its parent material. This is because instances should be
lightweight and users can already do instance->getMaterial()->getName().

In a subsequent PR, this feature will be exercised and tested via the
gltfio AssetLoader.

Fixes #2485.
2020-05-08 09:44:49 -07:00
Ben Doherty
0e00dbb967 Add up and down movement to free flight camera (#2494) 2020-05-06 18:30:43 -07:00
Pixelflinger
786dbdc6e4 fix JNI objects allocation and memory corruption
- we were allocating objects with a destructor in the command stream
  which is always invalid because there is no guarantee that when 
  the callback is called, the underlaying memory is still valid
  (and it wasn't).

- AutoBuffer move-ctor wasn't moving some of its state, which would
  lead to destroying the same ref several times.
2020-05-06 18:08:13 -07:00
Kostiantyn Zghirovskyi
2c79f4c480 Update building instruction on (#2496) 2020-05-06 16:14:38 -07:00
Pixelflinger
e80ea979a4 improvements to DoF
- bokeh rotates with the aperture diameter
- match sample count on cpu and cpu sides which affects CoC calculation
- feather blur radius to avoid visible "steps" in bokeh size
2020-05-05 11:38:32 -07:00