Compare commits

...

131 Commits

Author SHA1 Message Date
Benjamin Doherty
662a10e273 Merge branch 'rc/1.10.0' into release 2021-05-24 10:49:10 -07:00
Benjamin Doherty
ecce02502e Update RELEASE_NOTES for 1.10.0 2021-05-24 10:47:39 -07:00
Philip Rideout
d17875aea1 ImGuiHelper: fix support for custom images.
The texture binding in the material instance needs to be restored to the
glyph atlas when a custom image is not in use.
2021-05-21 12:49:37 -07:00
Philip Rideout
b8897a68f9 matc: detect missing end brace.
matc was failing to report certain kinds of syntax errors and would
read out-of-bounds memory.

This change casuses the flare material to fail.
2021-05-21 09:20:33 -07:00
Ben Doherty
84efd4871e API CHANGE: remove some Camera, Engine, and View deprecated APIs (#3965) 2021-05-19 12:02:13 -07:00
Benjamin Doherty
85ea5a6b70 Bump version to 1.10.0 2021-05-17 11:00:42 -07:00
Benjamin Doherty
77891acb92 Merge branch 'rc/1.9.25' into release 2021-05-17 10:57:30 -07:00
Benjamin Doherty
74fe102035 Update RELEASE_NOTES for 1.9.25 2021-05-17 10:54:38 -07:00
Philip Rideout
25cc554925 WASM: fix "Missing field" error for lensFlare. 2021-05-17 10:06:56 -07:00
Ben Doherty
d787a521b5 Fix DIST_DIR setting for Windows builds (#3945) 2021-05-12 11:16:30 -07:00
Ben Doherty
46e52c71e1 Fix DIST_DIR setting for Windows builds (#3945) 2021-05-12 11:15:49 -07:00
Philip Rideout
1dad27a172 Repair WebGL and fix potential INVALID_OPERATION.
We should take care not to call glVertexAttribPointer when there is
no bound ARRAY_BUFFER (i.e. when its binding is zero).

This fixes the black screen seen with some WebGL samples after
the recent memory leak fix related to the new BufferObject API.
2021-05-10 13:38:56 -07:00
Benjamin Doherty
60d230b380 Bump version to 1.9.25 2021-05-07 21:42:48 -07:00
Benjamin Doherty
d7cb38e706 Merge branch 'rc/1.9.24' into release 2021-05-07 21:39:17 -07:00
Benjamin Doherty
ce00cca6ee Update RELEASE_NOTES for 1.9.24 2021-05-07 21:36:49 -07:00
Philip Rideout
d627d57bad Second memory leak fix. (#3906)
Fixes #3888.
2021-05-06 14:25:46 -07:00
Philip Rideout
8ffc776f1c Fix horrible memory leak in the GL driver. (#3894)
This leak was introduced in the following PR on April 7.
https://github.com/google/filament/pull/3775

The guilty party has been contacted and properly admonished for his
transgression.

This was tested by adding the following code after applyAnimation in
gltf_viewer.cpp

        static int nframes = 0;
        if (!gpath.empty() && nframes++ > 100) {
            static int count = 0;
            printf("reloading %d\n", count++);
            nframes = 0;
            app.resourceLoader->asyncCancelLoad();
            app.resourceLoader->evictResourceData();
            app.viewer->removeAsset();
            app.assetLoader->destroyAsset(app.asset);
            loadAsset(gpath, app);
            loadResources(gpath, app);
        }
2021-05-04 18:22:08 -07:00
Benjamin Doherty
be032b52c1 Bump version to 1.9.24 2021-05-03 10:42:19 -07:00
Benjamin Doherty
4388e81e5f Merge branch 'rc/1.9.23' into release 2021-05-03 10:40:49 -07:00
Benjamin Doherty
71a185d139 Update RELEASE_NOTES for 1.9.23 2021-05-03 10:38:59 -07:00
Benjamin Doherty
d2cf5985ac Bump version to 1.9.23 2021-04-26 10:55:10 -07:00
Benjamin Doherty
debcbb8e5c Merge branch 'rc/1.9.22' into release 2021-04-26 10:52:43 -07:00
Benjamin Doherty
b9dd62c7d3 Update RELEASE_NOTES for 1.9.22 2021-04-26 10:47:11 -07:00
Benjamin Doherty
dc2b430f34 Bump version to 1.9.22 2021-04-26 10:39:16 -07:00
Benjamin Doherty
e5ef4e8868 Update RELEASE_NOTES for 1.9.21 2021-04-19 11:36:37 -07:00
Benjamin Doherty
c0d6cd3ac3 Merge branch 'rc/1.9.21' into release 2021-04-19 11:34:23 -07:00
Benjamin Doherty
b63ab2dc19 Update RELEASE_NOTES for 1.9.21 2021-04-19 11:32:31 -07:00
Benjamin Doherty
5d8dad561c Bump version to 1.9.21 2021-04-12 11:38:27 -07:00
Benjamin Doherty
8933be1ae2 Merge branch 'rc/1.9.20' into release 2021-04-12 11:36:17 -07:00
Benjamin Doherty
6b66b48b1d Update RELEASE_NOTES for 1.9.20 2021-04-12 11:35:45 -07:00
Benjamin Doherty
9c23eb6e33 Release Filament 1.9.20 2021-04-12 11:34:39 -07:00
Benjamin Doherty
baea54a3fc Update RELEASE_NOTES for 1.9.20 2021-04-12 09:20:31 -07:00
Benjamin Doherty
d9f800454c Bump version to 1.9.20 2021-04-05 11:14:17 -07:00
Benjamin Doherty
f9ee0de07a Merge branch 'rc/1.9.19' into release 2021-04-05 11:11:13 -07:00
Benjamin Doherty
2786d0a9f7 Update RELEASE_NOTES for 1.9.19 2021-04-05 11:10:50 -07:00
Benjamin Doherty
491e8032e6 Release Filament 1.9.19 2021-04-05 11:10:20 -07:00
Benjamin Doherty
ef3f13f5d3 Update RELEASE_NOTES for 1.9.19 2021-04-05 11:09:38 -07:00
Benjamin Doherty
bcb5b2d790 Implement Metal BufferObjects 2021-04-05 11:01:36 -07:00
Ben Doherty
02de3f2e2a Fix, regression with Metal buffers (#3715) 2021-03-29 14:21:34 -07:00
Benjamin Doherty
0e7bb53c07 Bump version to 1.9.19 2021-03-29 11:09:32 -07:00
Benjamin Doherty
759109d478 Merge branch 'rc/1.9.18' into release 2021-03-29 11:06:55 -07:00
Benjamin Doherty
54d5af6edf Update RELEASE_NOTES for 1.9.18 2021-03-29 11:04:57 -07:00
Philip Rideout
38fbe47ced RenderTarget: fix NPE when depth is not present.
This fixes a recent regression that would occur when a RenderTarget
does not have a depth attachment.
2021-03-29 10:32:22 -07:00
Benjamin Doherty
f066c925ba Bump version to 1.9.18 2021-03-22 10:16:34 -07:00
Benjamin Doherty
994fdf4e1d Merge branch 'rc/1.9.17' into release 2021-03-22 10:12:20 -07:00
Benjamin Doherty
50b50d65e3 Update RELEASE_NOTES for 1.9.17 2021-03-22 10:11:02 -07:00
Mathias Agopian
0aaa985649 Fix a hang in JobSystem
The hang was caused by a subtle race. When a job is completed, its 
thread must signal all the threads that might be waiting on this job.
The signaling code was attempting to signal only the minimum number
of threads -- this was important especially in the case where no threads
were waiting, then the call to notify() could be avoided.

Unfortunately, for performance reasons we're not calling notify() with
the condition lock held, this meant that between the time the number of 
waiting threads was latched and the time of the notify() call, more
threads could enter their condition variable wait(), and it would
then be possible for these threads to wake up, instead of the thread
we were trying to wake up (the one waiting on the job).

It would then get stuck forever.

This bug was introduced in 2df639133b


Also add some debugging code for this kind of failure (disabled)
2021-03-18 09:57:25 -07:00
Benjamin Doherty
29564f8eae Bump version to 1.9.17 2021-03-15 10:15:25 -07:00
Benjamin Doherty
c15db68a5b Merge branch 'rc/1.9.16' into release 2021-03-15 10:12:56 -07:00
Benjamin Doherty
3452fb3e56 Update RELEASE_NOTES for 1.9.16 2021-03-15 10:10:40 -07:00
Mathias Agopian
35eb8e7be1 Revert GL backend handle tracking
This wasn't very useful in the first place because we're recycling
handles very quickly. Additionally there was a race condition
which cause false positives.

This reverts commit bc6acd5c5a.
This reverts commit 3a15756c78.
2021-03-12 13:02:55 -08:00
Mathias Agopian
834b774128 Fixes some issues with imported rendertargets
We were not declaring the attachments it was using.

Fixes #3628
2021-03-12 08:26:16 -08:00
Benjamin Doherty
5aa0eb9f9d Bump version to 1.9.16 2021-03-08 10:09:14 -08:00
Benjamin Doherty
d9a6e2e649 Merge branch 'rc/1.9.15' into release 2021-03-08 10:07:00 -08:00
Benjamin Doherty
cb823b16a1 Update RELEASE_NOTES for 1.9.15 2021-03-08 10:05:19 -08:00
Ben Doherty
0bd41e877e Downgrade Linux GitHub Actions environment to fix error (#3588) 2021-03-01 11:21:11 -08:00
Benjamin Doherty
ecc3e73967 Bump version to 1.9.15 2021-03-01 11:13:44 -08:00
Benjamin Doherty
464b4c24f9 Merge branch 'rc/1.9.14' into release 2021-03-01 11:11:53 -08:00
Benjamin Doherty
32367516e8 Update RELEASE_NOTES for 1.9.14 2021-03-01 11:10:06 -08:00
Philip Rideout
1709a55606 filamat: Fix data race with SPIRV error registrations. 2021-02-26 10:34:36 -08:00
Benjamin Doherty
58b4455979 Bump version to 1.9.14 2021-02-22 10:32:56 -08:00
Benjamin Doherty
ea1dede19c Merge branch 'rc/1.9.13' into release 2021-02-22 10:29:57 -08:00
Benjamin Doherty
20ea3381fa Update RELEASE_NOTES for 1.9.13 2021-02-22 10:28:21 -08:00
Philip Rideout
7aa6fccd7c Modernize Python print syntax to appease external codebase. 2021-02-19 11:38:18 -08:00
Philip Rideout
adbd54f4f8 Change abs() to std::abs to appease external codebase. 2021-02-19 11:38:18 -08:00
Philip Rideout
9d54261f18 Move vk_mem_alloc to its own cpp.
This will improve parity between the GitHub repo and its sister codebase
within Google.
2021-02-19 11:38:18 -08:00
Philip Rideout
a97757c9ae Avoid uninitialized reads in computeVisibilityMasks.
I verified that this code is not enabled in our GitHub builds, and I
verified that the MSAN error goes away.
2021-02-19 11:38:18 -08:00
Philip Rideout
7c79d9f89d Remove some Windows line endings.
These line endings cause annoying diffs when comparing Filament's GitHub
source with its twin sister within Google.
2021-02-19 11:38:18 -08:00
Benjamin Doherty
bf0914f813 Bump version to 1.9.13 2021-02-16 10:48:24 -08:00
Benjamin Doherty
b96bc30fbd Merge branch 'rc/1.9.12' into release 2021-02-16 10:44:13 -08:00
Benjamin Doherty
62b50eb8ba Update RELEASE_NOTES for 1.9.12 2021-02-16 10:42:41 -08:00
Ben Doherty
b4932e384a matc: Use consistent params for semantic code analysis (#3524)
When running semantic analysis on a material, we were arbitrarily choosing the first code gen permutation to analyze. So, running matc with arguments --api metal versus --api all would run analysis on slightly different shader code. This causes bugs when flags passed to glslang differ during semantic analysis. This change updates all semantic analysis to always use the same shader code.
2021-02-08 14:06:47 -08:00
Benjamin Doherty
5e68dc5f8d Bump version to 1.9.12 2021-02-08 09:58:15 -08:00
Benjamin Doherty
f222f1b925 Merge branch 'rc/1.9.11' into release 2021-02-08 09:51:08 -08:00
Ben Doherty
22e4a54782 Update RELEASE_NOTES for 1.9.11 2021-02-08 09:50:23 -08:00
Benjamin Doherty
1289922c5f Release Filament 1.9.11 2021-02-08 09:48:50 -08:00
Ben Doherty
2839c352b8 Update RELEASE_NOTES for 1.9.11 2021-02-08 09:47:18 -08:00
Ben Doherty
6a01cbc312 Draft: fix TSAN issue by using lock in ColorGrading constructor (#3510)
This is a second attempt to fix Google3 TSAN failures seen inside of the ColorGrading constructor.

Related first attempt: #3462
2021-02-05 14:06:40 -08:00
Benjamin Doherty
6193156556 Bump version to 1.9.11 2021-02-01 11:49:12 -08:00
Benjamin Doherty
fe23aa917d Merge branch 'rc/1.9.10' into release 2021-02-01 11:45:47 -08:00
Benjamin Doherty
eb8a29a332 Update RELEASE_NOTES for 1.9.10 2021-02-01 11:45:17 -08:00
Ben Doherty
0626902530 Fix sporatic data race warning seen in Google3 (#3462) 2021-01-27 16:40:16 -08:00
Philip Rideout
042bfe2597 Partial fix for MSVC build. 2020-12-14 12:15:06 -08:00
Ben Doherty
97133f3591 Fix Windows iterator issue in Zip2Iterator and StructureOfArrays (#3322) 2020-12-14 12:14:53 -08:00
Philip Rideout
d06cc4390e filamat: minify struct fields.
This shrinks the arm64 so file by 24 KiB.
2020-12-14 11:19:43 -08:00
Philip Rideout
6047d3235f Remove VSM variant from Skybox material. 2020-12-14 11:19:31 -08:00
Philip Rideout
2cda6e35bd math: reduce template bloat for matrices
This does not change our API, it merely reduces the number of
non-inlined function instantiations appearing in non-optimized binaries.
2020-12-14 11:19:22 -08:00
Philip Rideout
8f8d51e17b Code review fixups for libibl_lite. 2020-12-14 11:19:16 -08:00
Philip Rideout
6919e3b274 libibl: use C callback for progress 2020-12-14 11:19:09 -08:00
Philip Rideout
10bf944410 Add libibl_lite. 2020-12-14 11:19:03 -08:00
Philip Rideout
9a2f6fdb53 Vulkan: change vkWaitForFences usage for SwiftShader.
When passing only 1 fence to vkWaitForFences, the `waitAll` argument
should not have any effect, but SwiftShader seems to skip the wait
when this argument is set to VK_FALSE.

More specifically, the failure to wait in `acquireWorkCommandBuffer`
causes the subsequent destruction of an in-use fence, which causes
a TSAN failure with Google's internal tests.

I am consulting with the SwiftShader team on a real fix, meanwhile
we can commit this easy workaround.

We have 5 usages of vkWaitForFences, one of which uses multiple fences
and should have used VK_TRUE anyway.
2020-11-20 09:37:54 -08:00
Philip Rideout
761977d385 Filament should always bind an IBL texture.
This prevents a SwiftShader crash and/or a slew of "no texture bound"
warnings that would appear when the client provides an IBL without
providing reflections texture, which should be a valid thing to do.

Note that it is okay to declare a sampler in GLSL that never gets bound,
as long as it is never sampled from. Since we always sample from the
IBL specular texture, we should always bind something to it.
2020-11-19 13:28:19 -08:00
Ben Doherty
21248f15b5 Fix, matc crash when building mobile materials (#3296) 2020-11-16 14:37:55 -08:00
Benjamin Doherty
4f32817f6d Bump version to 1.9.10 2020-11-16 12:37:49 -08:00
Benjamin Doherty
cc9e05e711 Merge branch 'rc/1.9.9' into release 2020-11-16 12:34:13 -08:00
Benjamin Doherty
419d68d4db Update RELEASE_NOTES for 1.9.9 2020-11-16 12:17:02 -08:00
Philip Rideout
8450232448 Improve the "unbound texture" warnings.
With Vulkan, this warning would sometimes be a false positive. It could
trigger for internal samplers like `ssao` and `structure`, even though
they were not declared in SPIR-V.

With OpenGL, this warning would never be a false positive because it has
the luxury of calling `glGetUniformLocation`.

This adds a private attribute to our samplers called `strict` that
indicates whether or not a sampler should always have a bound texture.
For now the only strict samplers are the custom ones declared in the
user's material.

At some point I think we should consider adding `spirv-reflect` to our
tree to help with problems like this.
2020-11-12 16:21:13 -08:00
Philip Rideout
cc51726590 Vulkan: improve robustness by providing 1x1 fallback. 2020-11-12 10:36:13 -08:00
Philip Rideout
318e22af51 Fix clear behavior with RenderTarget API.
This fixes a bug seen with client applications that use ClearOptions
instead of Skybox, and one or more offscreen RenderTarget objects.
These apps would see junk pixels because Filament would only clear the
first render target in the frame.

The fix is to factor some the flag-setting logic in `beginFrame()` into
a private method, and call this method from `render()` each time
the user-level RenderTarget has been changed.

I wrote a simple C++ demo to reproduce the issue and to verify that
this fix works.
2020-11-11 09:25:36 -08:00
Philip Rideout
68ac87dc24 NOOP backend should not care about GLSL vs SPIRV.
This fixes errors that would occur when using the NOOP backend with
materials that were built without OpenGL support.
2020-11-10 15:44:01 -08:00
Benjamin Doherty
acb8f00075 Bump version to 1.9.9 2020-11-09 09:32:55 -08:00
Benjamin Doherty
06d9183aaa Merge branch 'rc/1.9.8' into release 2020-11-09 09:28:58 -08:00
Benjamin Doherty
75af25419d Update RELEASE_NOTES for 1.9.8 2020-11-09 09:26:27 -08:00
Benjamin Doherty
f6b90d2a31 Bump version to 1.9.8 2020-11-09 09:21:36 -08:00
Philip Rideout
a3822f4af0 Fix FENCE_WAIT_FOR_EVER in Linux.
The number of infinite nanoseconds was negative because we asked
chrono for a signed integer, so "wait forever" really meant "do not
wait at all".
2020-11-02 16:12:53 -08:00
Benjamin Doherty
bcdad769ff Merge branch 'rc/1.9.7' into release 2020-11-02 11:03:57 -07:00
Benjamin Doherty
be4fb4fdbb Update RELEASE_NOTES for 1.9.7 2020-11-02 10:59:19 -07:00
Benjamin Doherty
65394f6301 Bump version to 1.9.7 2020-10-26 11:34:20 -06:00
Benjamin Doherty
b0beee03bc Merge branch 'rc/1.9.6' into release 2020-10-26 11:29:45 -06:00
Benjamin Doherty
fe1de41b8e Update RELEASE_NOTES for 1.9.6 2020-10-26 11:25:31 -06:00
Benjamin Doherty
a37b431e87 Bump version to 1.9.6 2020-10-19 11:55:13 -06:00
Benjamin Doherty
98107016b9 Merge branch 'rc/1.9.5' into release 2020-10-19 11:51:30 -06:00
Benjamin Doherty
8bccfc2863 Update RELEASE_NOTES for 1.9.5 2020-10-19 11:49:05 -06:00
Benjamin Doherty
f54a0a3452 Fix CocoaPod version 2020-10-13 15:15:02 -06:00
Benjamin Doherty
6778ab0624 Fix CocoaPod version 2020-10-13 15:09:59 -06:00
Benjamin Doherty
269d636785 Bump version to 1.9.5 2020-10-12 12:03:29 -06:00
Benjamin Doherty
39862c91ce Merge branch 'rc/1.9.4' into release 2020-10-12 11:56:24 -06:00
Benjamin Doherty
523f4026b4 Update RELEASE_NOTES for 1.9.4 2020-10-12 11:52:01 -06:00
Benjamin Doherty
a6bf162431 Bump version to 1.9.4 2020-10-07 16:06:23 -06:00
Benjamin Doherty
826e8d181c Merge branch 'rc/1.9.3' into release 2020-10-05 11:36:16 -06:00
Benjamin Doherty
16dfadbba0 Update RELEASE_NOTES for 1.9.3 2020-10-05 11:29:36 -06:00
Benjamin Doherty
5cbb97551f Bump version to 1.9.3 2020-09-28 11:40:31 -06:00
Benjamin Doherty
defee767c3 Merge branch 'rc/1.9.2' into release 2020-09-28 11:27:47 -06:00
Benjamin Doherty
9560318521 Update RELEASE_NOTES for 1.9.2 2020-09-28 11:26:21 -06:00
Benjamin Doherty
ef09feb048 Bump version to 1.9.2 2020-09-21 11:16:53 -06:00
Benjamin Doherty
39f323fe09 Merge branch 'rc/1.9.1' into release 2020-09-21 11:00:07 -06:00
Benjamin Doherty
11b95304ea Merge branch 'release' into rc/1.9.1 2020-09-21 10:59:52 -06:00
Benjamin Doherty
b7c30a7916 Update RELEASE_NOTES for 1.9.1 2020-09-21 10:59:06 -06:00
Benjamin Doherty
4cae48fc77 Bump version to 1.9.1 2020-09-14 11:51:36 -07:00
Benjamin Doherty
d1a93f0557 Update release notes for 1.9.0 2020-09-14 10:54:28 -07:00
Benjamin Doherty
b93059fad7 Bump version to 1.9.0 2020-09-08 10:47:23 -07:00
52 changed files with 166 additions and 209 deletions

View File

@@ -31,7 +31,7 @@ repositories {
}
dependencies {
implementation 'com.google.android.filament:filament-android:1.9.25'
implementation 'com.google.android.filament:filament-android:1.10.0'
}
```
@@ -63,7 +63,7 @@ A much smaller alternative to `filamat-android` that can only generate OpenGL sh
iOS projects can use CocoaPods to install the latest release:
```
pod 'Filament', '~> 1.9.25'
pod 'Filament', '~> 1.10.0'
```
### Snapshots

View File

@@ -10,6 +10,15 @@ A new header is inserted each time a *tag* is created.
- engine: User materials can now use 9 samplers instead of 8 [⚠️ **Material breakage**].
- engine: Remove `populateTangentQuaternions` [⚠️ **API change**].
- engine: Deprecate `Stream::Builder::stream(intptr_t)` [⚠️ **API Change**].
- engine: Remove deprecated APIs: `Camera::setScaling`, `Engine::destroy(Camera*)`,
`Engine::createCamera`, `Renderer::beginFrame(SwapChain*, uint64_t,
backend::FrameScheduledCallback, void*)`, and `View::setShadowsEnabled` [⚠️ **API Change**].
- engine: Remove `focusDistance` from `View::BloomOptions` [⚠️ **API Change**].
- engine: Add a `FILAMENT_SUPPORTS_OPENGL` CMake option to enable/disable OpenGL support.
- Vulkan: fixes and improvements for large scenes.
- gltfio: fix morphing bugs uncovered by MorphStressTest.
- Java: add API for `Texture::Builder::import()`.
- WebGL: Fix a potential INVALID_OPERATION.
## v1.9.25

View File

@@ -18,6 +18,8 @@
#include <filament/Camera.h>
#include <utils/Entity.h>
#include <math/mat4.h>
using namespace filament;

View File

@@ -16,6 +16,7 @@
#include <jni.h>
#include <filament/Camera.h>
#include <filament/Engine.h>
#include <utils/Entity.h>
@@ -120,15 +121,8 @@ Java_com_google_android_filament_Engine_nDestroyRenderer(JNIEnv*, jclass,
// Camera
extern "C" [[deprecated]] JNIEXPORT jlong JNICALL
Java_com_google_android_filament_Engine_nCreateCamera(JNIEnv*, jclass,
jlong nativeEngine) {
Engine* engine = (Engine*) nativeEngine;
return (jlong) engine->createCamera();
}
extern "C" JNIEXPORT jlong JNICALL
Java_com_google_android_filament_Engine_nCreateCameraWithEntity(JNIEnv*, jclass,
Java_com_google_android_filament_Engine_nCreateCamera(JNIEnv*, jclass,
jlong nativeEngine, jint entity_) {
Engine* engine = (Engine*) nativeEngine;
Entity& entity = *reinterpret_cast<Entity*>(&entity_);
@@ -143,12 +137,12 @@ Java_com_google_android_filament_Engine_nGetCameraComponent(JNIEnv*, jclass,
return (jlong) engine->getCameraComponent(entity);
}
extern "C" [[deprecated]] JNIEXPORT void JNICALL
Java_com_google_android_filament_Engine_nDestroyCamera(JNIEnv*, jclass,
jlong nativeEngine, jlong nativeCamera) {
extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_Engine_nDestroyCameraComponent(JNIEnv*, jclass,
jlong nativeEngine, jint entity_) {
Engine* engine = (Engine*) nativeEngine;
Camera *camera = (Camera *) nativeCamera;
engine->destroy(camera);
Entity& entity = *reinterpret_cast<Entity*>(&entity_);
engine->destroyCameraComponent(entity);
}
// Scene

View File

@@ -321,7 +321,7 @@ Java_com_google_android_filament_View_nSetDepthOfFieldOptions(JNIEnv *, jclass ,
// View::DepthOfFieldOptions::Filter::MEDIAN value is actually 2
eFilter = View::DepthOfFieldOptions::Filter::MEDIAN;
}
view->setDepthOfFieldOptions({.focusDistance = focusDistance, .cocScale = cocScale,
view->setDepthOfFieldOptions({.cocScale = cocScale,
.maxApertureDiameter = maxApertureDiameter, .enabled = (bool)enabled, .filter = eFilter,
.nativeResolution = (bool)nativeResolution,
.foregroundRingCount = (uint8_t)foregroundRingCount,

View File

@@ -29,7 +29,7 @@ import androidx.annotation.Size;
*
* In Filament, Camera is a component that must be associated with an entity. To do so,
* use {@link Engine#createCamera(int)}. A Camera component is destroyed using
* {@link Engine#destroyCamera(Camera)}.
* {@link Engine#destroyCameraComponent(int Entity)} ()}.
*
* <pre>
* Camera myCamera = engine.createCamera(myCameraEntity);
@@ -37,7 +37,7 @@ import androidx.annotation.Size;
* myCamera.lookAt(0, 1.60, 1,
* 0, 0, 0,
* 0, 1, 0);
* engine.destroyCamera(myCamera);
* engine.destroyCameraComponent(myCameraEntity);
* </pre>
*
*
@@ -121,6 +121,9 @@ import androidx.annotation.Size;
public class Camera {
private long mNativeObject;
@Entity
private final int mEntity;
/**
* Denotes the projection type used by this camera.
* @see #setProjection
@@ -143,8 +146,9 @@ public class Camera {
HORIZONTAL
}
Camera(long nativeCamera) {
Camera(long nativeCamera, @Entity int entity) {
mNativeObject = nativeCamera;
mEntity = entity;
}
/**
@@ -681,6 +685,15 @@ public class Camera {
return nGetSensitivity(getNativeObject());
}
/**
* Gets the entity representing this Camera
* @return the entity this Camera component is attached to
*/
@Entity
public int getEntity() {
return mEntity;
}
/**
* Helper to compute the effective focal length taking into account the focus distance
*

View File

@@ -399,19 +399,6 @@ public class Engine {
// Camera
/**
* Creates a new <code>entity</code> and adds a {@link Camera} component to it.
*
* @return A newly created {@link Camera}
* @exception IllegalStateException can be thrown if the {@link Camera} couldn't be created
*/
@NonNull
public Camera createCamera() {
long nativeCamera = nCreateCamera(getNativeObject());
if (nativeCamera == 0) throw new IllegalStateException("Couldn't create Camera");
return new Camera(nativeCamera);
}
/**
* Creates and adds a {@link Camera} component to a given <code>entity</code>.
*
@@ -421,9 +408,9 @@ public class Engine {
*/
@NonNull
public Camera createCamera(@Entity int entity) {
long nativeCamera = nCreateCameraWithEntity(getNativeObject(), entity);
long nativeCamera = nCreateCamera(getNativeObject(), entity);
if (nativeCamera == 0) throw new IllegalStateException("Couldn't create Camera");
return new Camera(nativeCamera);
return new Camera(nativeCamera, entity);
}
/**
@@ -437,16 +424,16 @@ public class Engine {
public Camera getCameraComponent(@Entity int entity) {
long nativeCamera = nGetCameraComponent(getNativeObject(), entity);
if (nativeCamera == 0) return null;
return new Camera(nativeCamera);
return new Camera(nativeCamera, entity);
}
/**
* Destroys a {@link Camera} component and frees all its associated resources.
* @param camera the {@link Camera} to destroy
* Destroys the {@link Camera} component associated with the given entity.
*
* @param entity an entity
*/
public void destroyCamera(@NonNull Camera camera) {
nDestroyCamera(getNativeObject(), camera.getNativeObject());
camera.clearNativeObject();
public void destroyCameraComponent(@Entity int entity) {
nDestroyCameraComponent(getNativeObject(), entity);
}
// Scene
@@ -634,6 +621,14 @@ public class Engine {
return mRenderableManager;
}
/**
* @return the {@link EntityManager} used by this {@link Engine}
*/
@NonNull
public EntityManager getEntityManager() {
return mEntityManager;
}
/**
* Kicks the hardware thread (e.g.: the OpenGL, Vulkan or Metal thread) and blocks until
* all commands to this point are executed. Note that this doesn't guarantee that the
@@ -685,10 +680,9 @@ public class Engine {
private static native boolean nDestroyView(long nativeEngine, long nativeView);
private static native long nCreateRenderer(long nativeEngine);
private static native boolean nDestroyRenderer(long nativeEngine, long nativeRenderer);
private static native long nCreateCamera(long nativeEngine);
private static native long nCreateCameraWithEntity(long nativeEngine, int entity);
private static native long nCreateCamera(long nativeEngine, int entity);
private static native long nGetCameraComponent(long nativeEngine, int entity);
private static native void nDestroyCamera(long nativeEngine, long nativeCamera);
private static native void nDestroyCameraComponent(long nativeEngine, int entity);
private static native long nCreateScene(long nativeEngine);
private static native boolean nDestroyScene(long nativeEngine, long nativeScene);
private static native long nCreateFence(long nativeEngine);

View File

@@ -482,14 +482,6 @@ public class View {
MEDIAN
}
/**
* focus distance in world units
*
* @deprecated use {@link Camera#setFocusDistance(float)}
*/
@Deprecated
public float focusDistance = 10.0f;
/**
* circle of confusion scale factor (amount of blur)
*
@@ -939,16 +931,6 @@ public class View {
nSetShadowingEnabled(getNativeObject(), enabled);
}
/**
* Enables or disables shadow mapping. Enabled by default.
*
* @deprecated Use {@link #setShadowingEnabled}
*/
@Deprecated
public void setShadowsEnabled(boolean enabled) {
setShadowingEnabled(enabled);
}
/**
* @return whether shadowing is enabled
*/
@@ -1491,7 +1473,7 @@ public class View {
*/
public void setDepthOfFieldOptions(@NonNull DepthOfFieldOptions options) {
mDepthOfFieldOptions = options;
nSetDepthOfFieldOptions(getNativeObject(), options.focusDistance, options.cocScale,
nSetDepthOfFieldOptions(getNativeObject(), options.cocScale,
options.maxApertureDiameter, options.enabled, options.filter.ordinal(),
options.nativeResolution, options.foregroundRingCount, options.backgroundRingCount,
options.fastGatherRingCount, options.maxForegroundCOC, options.maxBackgroundCOC);
@@ -1554,7 +1536,7 @@ public class View {
boolean lensFlare, boolean starburst, float chromaticAberration, int ghostCount, float ghostSpacing, float ghostThreshold, float haloThickness, float haloRadius, float haloThreshold);
private static native void nSetFogOptions(long nativeView, float distance, float maximumOpacity, float height, float heightFalloff, float v, float v1, float v2, float density, float inScatteringStart, float inScatteringSize, boolean fogColorFromIbl, boolean enabled);
private static native void nSetBlendMode(long nativeView, int blendMode);
private static native void nSetDepthOfFieldOptions(long nativeView, float focusDistance, float cocScale, float maxApertureDiameter, boolean enabled, int filter,
private static native void nSetDepthOfFieldOptions(long nativeView, float cocScale, float maxApertureDiameter, boolean enabled, int filter,
boolean nativeResolution, int foregroundRingCount, int backgroundRingCount, int fastGatherRingCount, int maxForegroundCOC, int maxBackgroundCOC);
private static native void nSetVignetteOptions(long nativeView, float midPoint, float roundness, float feather, float r, float g, float b, float a, boolean enabled);
private static native void nSetTemporalAntiAliasingOptions(long nativeView, float feedback, float filterWidth, boolean enabled);

View File

@@ -105,7 +105,7 @@ class ModelViewer(val engine: Engine) : android.view.View.OnTouchListener {
init {
renderer = engine.createRenderer()
scene = engine.createScene()
camera = engine.createCamera().apply { setExposure(kAperture, kShutterSpeed, kSensitivity) }
camera = engine.createCamera(engine.entityManager.create()).apply { setExposure(kAperture, kShutterSpeed, kSensitivity) }
view = engine.createView()
view.scene = scene
view.camera = camera
@@ -299,7 +299,8 @@ class ModelViewer(val engine: Engine) : android.view.View.OnTouchListener {
engine.destroyRenderer(renderer)
engine.destroyView(this@ModelViewer.view)
engine.destroyScene(scene)
engine.destroyCamera(camera)
engine.destroyCameraComponent(camera.entity)
EntityManager.get().destroy(camera.entity)
EntityManager.get().destroy(light)

View File

@@ -1,5 +1,5 @@
GROUP=com.google.android.filament
VERSION_NAME=1.9.25
VERSION_NAME=1.10.0
POM_DESCRIPTION=Real-time physically based rendering engine for Android.

View File

@@ -109,7 +109,8 @@ class MainActivity : Activity(), ActivityCompat.OnRequestPermissionsResultCallba
renderer = engine.createRenderer()
scene = engine.createScene()
view = engine.createView()
camera = engine.createCamera()
camera = engine.createCamera(engine.entityManager.create())
}
private fun setupView() {
@@ -342,13 +343,14 @@ class MainActivity : Activity(), ActivityCompat.OnRequestPermissionsResultCallba
engine.destroyMaterial(material)
engine.destroyView(view)
engine.destroyScene(scene)
engine.destroyCamera(camera)
engine.destroyCameraComponent(camera.entity)
// Engine.destroyEntity() destroys Filament related resources only
// (components), not the entity itself
val entityManager = EntityManager.get()
entityManager.destroy(light)
entityManager.destroy(renderable)
entityManager.destroy(camera.entity)
// Destroying the engine will free up any resource you may have forgotten
// to destroy, but it's recommended to do the cleanup properly

View File

@@ -113,7 +113,7 @@ class MainActivity : Activity() {
renderer = engine.createRenderer()
scene = engine.createScene()
view = engine.createView()
camera = engine.createCamera()
camera = engine.createCamera(engine.entityManager.create())
}
private fun setupView() {
@@ -271,12 +271,13 @@ class MainActivity : Activity() {
engine.destroyMaterial(material)
engine.destroyView(view)
engine.destroyScene(scene)
engine.destroyCamera(camera)
engine.destroyCameraComponent(camera.entity)
// Engine.destroyEntity() destroys Filament related resources only
// (components), not the entity itself
val entityManager = EntityManager.get()
entityManager.destroy(renderable)
entityManager.destroy(camera.entity)
// Destroying the engine will free up any resource you may have forgotten
// to destroy, but it's recommended to do the cleanup properly

View File

@@ -113,7 +113,7 @@ class MainActivity : Activity() {
renderer = engine.createRenderer()
scene = engine.createScene()
view = engine.createView()
camera = engine.createCamera()
camera = engine.createCamera(engine.entityManager.create())
}
private fun setupView() {
@@ -249,12 +249,13 @@ class MainActivity : Activity() {
engine.destroyMaterial(material)
engine.destroyView(view)
engine.destroyScene(scene)
engine.destroyCamera(camera)
engine.destroyCameraComponent(camera.entity)
// Engine.destroyEntity() destroys Filament related resources only
// (components), not the entity itself
val entityManager = EntityManager.get()
entityManager.destroy(light)
entityManager.destroy(camera.entity)
// Destroying the engine will free up any resource you may have forgotten
// to destroy, but it's recommended to do the cleanup properly

View File

@@ -114,7 +114,7 @@ class MainActivity : Activity() {
renderer = engine.createRenderer()
scene = engine.createScene()
view = engine.createView()
camera = engine.createCamera()
camera = engine.createCamera(engine.entityManager.create())
}
private fun setupView() {
@@ -358,13 +358,14 @@ class MainActivity : Activity() {
engine.destroyMaterial(material)
engine.destroyView(view)
engine.destroyScene(scene)
engine.destroyCamera(camera)
engine.destroyCameraComponent(camera.entity)
// Engine.destroyEntity() destroys Filament related resources only
// (components), not the entity itself
val entityManager = EntityManager.get()
entityManager.destroy(light)
entityManager.destroy(renderable)
entityManager.destroy(camera.entity)
// Destroying the engine will free up any resource you may have forgotten
// to destroy, but it's recommended to do the cleanup properly

View File

@@ -101,7 +101,7 @@ class FilamentLiveWallpaper : WallpaperService() {
renderer = engine.createRenderer()
scene = engine.createScene()
view = engine.createView()
camera = engine.createCamera()
camera = engine.createCamera(engine.entityManager.create())
}
private fun setupView() {
@@ -167,7 +167,8 @@ class FilamentLiveWallpaper : WallpaperService() {
engine.destroyRenderer(renderer)
engine.destroyView(view)
engine.destroyScene(scene)
engine.destroyCamera(camera)
engine.destroyCameraComponent(camera.entity)
EntityManager.get().destroy(camera.entity)
// Destroying the engine will free up any resource you may have forgotten
// to destroy, but it's recommended to do the cleanup properly
@@ -221,4 +222,4 @@ class FilamentLiveWallpaper : WallpaperService() {
}
}
}
}
}

View File

@@ -112,7 +112,7 @@ class MainActivity : Activity() {
renderer = engine.createRenderer()
scene = engine.createScene()
view = engine.createView()
camera = engine.createCamera()
camera = engine.createCamera(engine.entityManager.create())
}
private fun setupView() {
@@ -289,12 +289,13 @@ class MainActivity : Activity() {
engine.destroyMaterial(material)
engine.destroyView(view)
engine.destroyScene(scene)
engine.destroyCamera(camera)
engine.destroyCameraComponent(camera.entity)
// Engine.destroyEntity() destroys Filament related resources only
// (components), not the entity itself
val entityManager = EntityManager.get()
entityManager.destroy(light)
entityManager.destroy(camera.entity)
// Destroying the engine will free up any resource you may have forgotten
// to destroy, but it's recommended to do the cleanup properly

View File

@@ -128,7 +128,7 @@ class MainActivity : Activity() {
skybox = Skybox.Builder().build(engine);
scene.skybox = skybox
camera = engine.createCamera()
camera = engine.createCamera(engine.entityManager.create())
}
private fun setupViews() {
@@ -375,13 +375,14 @@ class MainActivity : Activity() {
engine.destroyView(view3)
engine.destroySkybox(skybox)
engine.destroyScene(scene)
engine.destroyCamera(camera)
engine.destroyCameraComponent(camera.entity)
// Engine.destroyEntity() destroys Filament related resources only
// (components), not the entity itself
val entityManager = EntityManager.get()
entityManager.destroy(light)
entityManager.destroy(renderable)
entityManager.destroy(camera.entity)
// Destroying the engine will free up any resource you may have forgotten
// to destroy, but it's recommended to do the cleanup properly

View File

@@ -148,7 +148,7 @@ public class MainActivity extends Activity
mRenderer = mEngine.createRenderer();
mScene = mEngine.createScene();
mView = mEngine.createView();
mCamera = mEngine.createCamera();
mCamera = mEngine.createCamera(mEngine.getEntityManager().create());
mCamera.lookAt(0, 0, 3, 0, 0, 0, 0, 1, 0);
@@ -223,9 +223,10 @@ public class MainActivity extends Activity
mEngine.destroyView(mView);
mEngine.destroyScene(mScene);
mEngine.destroyCamera(mCamera);
mEngine.destroyCameraComponent(mCamera.getEntity());
EntityManager.get().destroy(mPage.renderable);
EntityManager.get().destroy(mCamera.getEntity());
mEngine.destroy();
}
@@ -298,4 +299,4 @@ public class MainActivity extends Activity
canvas.drawBitmap(bmp, borderSize, borderSize, null);
return modified;
}
}
}

View File

@@ -121,7 +121,7 @@ class MainActivity : Activity(), ActivityCompat.OnRequestPermissionsResultCallba
renderer = engine.createRenderer()
scene = engine.createScene()
view = engine.createView()
camera = engine.createCamera()
camera = engine.createCamera(engine.entityManager.create())
}
private fun setupView() {
@@ -328,13 +328,14 @@ class MainActivity : Activity(), ActivityCompat.OnRequestPermissionsResultCallba
engine.destroyMaterial(material)
engine.destroyView(view)
engine.destroyScene(scene)
engine.destroyCamera(camera)
engine.destroyCameraComponent(camera.entity)
// Engine.destroyEntity() destroys Filament related resources only
// (components), not the entity itself
val entityManager = EntityManager.get()
entityManager.destroy(light)
entityManager.destroy(renderable)
entityManager.destroy(camera.entity)
// Destroying the engine will free up any resource you may have forgotten
// to destroy, but it's recommended to do the cleanup properly

View File

@@ -113,7 +113,7 @@ class MainActivity : Activity() {
renderer = engine.createRenderer()
scene = engine.createScene()
view = engine.createView()
camera = engine.createCamera()
camera = engine.createCamera(engine.entityManager.create())
}
private fun setupView() {
@@ -271,12 +271,13 @@ class MainActivity : Activity() {
engine.destroyMaterial(material)
engine.destroyView(view)
engine.destroyScene(scene)
engine.destroyCamera(camera)
engine.destroyCameraComponent(camera.entity)
// Engine.destroyEntity() destroys Filament related resources only
// (components), not the entity itself
val entityManager = EntityManager.get()
entityManager.destroy(renderable)
entityManager.destroy(camera.entity)
// Destroying the engine will free up any resource you may have forgotten
// to destroy, but it's recommended to do the cleanup properly

View File

@@ -117,7 +117,7 @@ class MainActivity : Activity() {
renderer = engine.createRenderer()
scene = engine.createScene()
view = engine.createView()
camera = engine.createCamera()
camera = engine.createCamera(engine.entityManager.create())
}
private fun setupView() {
@@ -269,12 +269,13 @@ class MainActivity : Activity() {
engine.destroyMaterial(material)
engine.destroyView(view)
engine.destroyScene(scene)
engine.destroyCamera(camera)
engine.destroyCameraComponent(camera.entity)
// Engine.destroyEntity() destroys Filament related resources only
// (components), not the entity itself
val entityManager = EntityManager.get()
entityManager.destroy(light)
entityManager.destroy(camera.entity)
// Destroying the engine will free up any resource you may have forgotten
// to destroy, but it's recommended to do the cleanup properly

View File

@@ -136,7 +136,7 @@ class MainActivity : Activity() {
renderer = engine.createRenderer()
scene = engine.createScene()
view = engine.createView()
camera = engine.createCamera()
camera = engine.createCamera(engine.entityManager.create())
// clear the swapchain with transparent pixels
val options = renderer.clearOptions
@@ -294,12 +294,13 @@ class MainActivity : Activity() {
engine.destroyMaterial(material)
engine.destroyView(view)
engine.destroyScene(scene)
engine.destroyCamera(camera)
engine.destroyCameraComponent(camera.entity)
// Engine.destroyEntity() destroys Filament related resources only
// (components), not the entity itself
val entityManager = EntityManager.get()
entityManager.destroy(renderable)
entityManager.destroy(camera.entity)
// Destroying the engine will free up any resource you may have forgotten
// to destroy, but it's recommended to do the cleanup properly

View File

@@ -252,9 +252,6 @@ public:
*/
void setScaling(math::double2 scaling) noexcept;
[[deprecated]]
void setScaling(math::double4 const& scaling) noexcept;
/**
* Sets an additional matrix that shifts the projection matrix.
* By default, this is an identity matrix.

View File

@@ -388,7 +388,7 @@ public:
* @param entity An entity.
* @return A pointer to the Camera component for this entity or nullptr if the entity didn't
* have a Camera component. The pointer is valid until destroyCameraComponent()
* (or destroyCamera()) is called or the entity itself is destroyed.
* is called or the entity itself is destroyed.
*/
Camera* getCameraComponent(utils::Entity entity) noexcept;
@@ -472,26 +472,6 @@ public:
*/
void* streamAlloc(size_t size, size_t alignment = alignof(double)) noexcept;
/**
* helper for creating an Entity and Camera component in one call
*
* @deprecated use createCamera(Entity) instead
*
* @return A camera component
*/
UTILS_DEPRECATED
Camera* createCamera() noexcept;
/**
* helper for destroying the Camera component and its Entity in one call
*
* @param camera Camera component to destroy. The associated entity is also destroyed.
* @deprecated use destroyCameraComponent(Entity) instead
*/
UTILS_DEPRECATED
void destroy(const Camera* camera);
/**
* Invokes one iteration of the render loop, used only on single-threaded platforms.
*

View File

@@ -243,15 +243,6 @@ public:
bool beginFrame(SwapChain* swapChain,
uint64_t vsyncSteadyClockTimeNano = 0u);
/**
* @deprecated, use SwapChain::setFrameScheduledCallback to set the callback instead.
* @see beginFrame(SwapChain*, uint64_t)
*/
UTILS_DEPRECATED
bool beginFrame(SwapChain* swapChain,
uint64_t vsyncSteadyClockTimeNano,
backend::FrameScheduledCallback callback, void* user = nullptr);
/**
* Render a View into this renderer's window.
*

View File

@@ -201,7 +201,6 @@ public:
NONE = 0,
MEDIAN = 2
};
float focusDistance = 10.0f; //!< @deprecated use Camera::setFocusDistance() instead
float cocScale = 1.0f; //!< circle of confusion scale factor (amount of blur)
float maxApertureDiameter = 0.01f; //!< maximum aperture diameter in meters (zero to disable rotation)
bool enabled = false; //!< enable or disable depth of field effect
@@ -525,15 +524,6 @@ public:
*/
void setShadowingEnabled(bool enabled) noexcept;
/**
* Enables or disables shadow mapping. Enabled by default.
* @deprecated use setShadowingEnabled
*/
UTILS_DEPRECATED
void setShadowsEnabled(bool enabled) noexcept {
setShadowingEnabled(enabled);
}
/**
* @return whether shadowing is enabled
*/

View File

@@ -296,10 +296,7 @@ CameraInfo::CameraInfo(FCamera const& camera) noexcept {
d = std::max(zn, camera.getFocusDistance());
}
CameraInfo::CameraInfo(FCamera const& camera, const math::mat4f& worldOriginCamera,
float focusDistance) noexcept {
// note: DepthOfFieldOptions is deprecated, but we continue to support it by passing it here
// and we're using it if the camera focus distance hasn't been set.
CameraInfo::CameraInfo(FCamera const& camera, const math::mat4f& worldOriginCamera) noexcept {
const mat4f modelMatrix{ worldOriginCamera * camera.getModelMatrix() };
projection = mat4f{ camera.getProjectionMatrix() };
cullingProjection = mat4f{ camera.getCullingProjectionMatrix() };
@@ -310,7 +307,7 @@ CameraInfo::CameraInfo(FCamera const& camera, const math::mat4f& worldOriginCame
ev100 = Exposure::ev100(camera);
f = camera.getFocalLength();
A = f / camera.getAperture();
d = std::max(zn, camera.getFocusDistance() > 0.0f ? camera.getFocusDistance() : focusDistance);
d = std::max(zn, camera.getFocusDistance());
worldOffset = camera.getPosition();
worldOrigin = worldOriginCamera;
}
@@ -354,10 +351,6 @@ void Camera::setScaling(math::double2 scaling) noexcept {
upcast(this)->setScaling(scaling);
}
void Camera::setScaling(math::double4 const& scaling) noexcept {
upcast(this)->setScaling(scaling);
}
void Camera::setShift(math::double2 shift) noexcept {
upcast(this)->setShift(shift);
}

View File

@@ -1043,14 +1043,4 @@ DebugRegistry& Engine::getDebugRegistry() noexcept {
return upcast(this)->getDebugRegistry();
}
Camera* Engine::createCamera() noexcept {
return createCamera(upcast(this)->getEntityManager().create());
}
void Engine::destroy(const Camera* camera) {
Entity e = camera->getEntity();
destroyCameraComponent(e);
upcast(this)->getEntityManager().destroy(e);
}
} // namespace filament

View File

@@ -898,8 +898,7 @@ void FRenderer::copyFrame(FSwapChain* dstSwapChain, filament::Viewport const& ds
mSwapChain->makeCurrent(driver);
}
bool FRenderer::beginFrame(FSwapChain* swapChain, uint64_t vsyncSteadyClockTimeNano,
FrameScheduledCallback callback, void* user) {
bool FRenderer::beginFrame(FSwapChain* swapChain, uint64_t vsyncSteadyClockTimeNano) {
assert_invariant(swapChain);
SYSTRACE_CALL();
@@ -955,10 +954,6 @@ bool FRenderer::beginFrame(FSwapChain* swapChain, uint64_t vsyncSteadyClockTimeN
FEngine& engine = getEngine();
FEngine::DriverApi& driver = engine.getDriverApi();
if (UTILS_UNLIKELY(callback)) {
// this is here just to handle the deprecated version of beginFrame()
driver.setFrameScheduledCallback(swapChain->getHwHandle(), callback, user);
}
driver.beginFrame(appVsync.time_since_epoch().count(), mFrameId);
// This need to occur after the backend beginFrame() because some backends need to start
@@ -1159,14 +1154,7 @@ void Renderer::render(View const* view) {
}
bool Renderer::beginFrame(SwapChain* swapChain, uint64_t vsyncSteadyClockTimeNano) {
return upcast(this)->beginFrame(upcast(swapChain), vsyncSteadyClockTimeNano,
nullptr, nullptr);
}
bool Renderer::beginFrame(SwapChain* swapChain, uint64_t vsyncSteadyClockTimeNano,
backend::FrameScheduledCallback callback, void* user) {
return upcast(this)->beginFrame(upcast(swapChain), vsyncSteadyClockTimeNano,
callback, user);
return upcast(this)->beginFrame(upcast(swapChain), vsyncSteadyClockTimeNano);
}
void Renderer::copyFrame(SwapChain* dstSwapChain, filament::Viewport const& dstViewport,

View File

@@ -404,7 +404,7 @@ void FView::prepare(FEngine& engine, backend::DriverApi& driver, ArenaScope& are
// Note: for debugging (i.e. visualize what the camera / objects are doing, using
// the viewing camera), we can set worldOriginScene to identity when mViewingCamera
// is set
mViewingCameraInfo = CameraInfo(*camera, worldOriginScene, mDepthOfFieldOptions.focusDistance);
mViewingCameraInfo = CameraInfo(*camera, worldOriginScene);
mCullingFrustum = FCamera::getFrustum(
mCullingCamera->getCullingProjectionMatrix(),

View File

@@ -63,8 +63,6 @@ public:
void setCustomProjection(math::mat4 const& projection,
math::mat4 const& projectionForCulling, double near, double far) noexcept;
void setScaling(math::double4 const& scaling) noexcept { mScaling = scaling.xy; }
void setScaling(math::double2 scaling) noexcept { mScaling = scaling; }
math::double4 getScaling() const noexcept { return math::double4{ mScaling, 1.0, 1.0 }; }
@@ -200,8 +198,7 @@ private:
struct CameraInfo {
CameraInfo() noexcept = default;
explicit CameraInfo(FCamera const& camera) noexcept;
CameraInfo(FCamera const& camera,
const math::mat4f& worldOriginCamera, float focusDistance) noexcept;
CameraInfo(FCamera const& camera, const math::mat4f& worldOriginCamera) noexcept;
math::mat4f projection; // projection matrix for drawing (infinite zfar)
math::mat4f cullingProjection; // projection matrix for culling

View File

@@ -76,8 +76,7 @@ public:
// do all the work here!
void renderJob(ArenaScope& arena, FView& view);
bool beginFrame(FSwapChain* swapChain, uint64_t vsyncSteadyClockTimeNano,
backend::FrameScheduledCallback callback, void* user);
bool beginFrame(FSwapChain* swapChain, uint64_t vsyncSteadyClockTimeNano);
void render(FView const* view);

View File

@@ -357,7 +357,6 @@ public:
}
void setDepthOfFieldOptions(DepthOfFieldOptions options) noexcept {
options.focusDistance = std::max(0.0f, options.focusDistance);
options.cocScale = std::max(0.0f, options.cocScale);
options.maxApertureDiameter = std::max(0.0f, options.maxApertureDiameter);
mDepthOfFieldOptions = options;

View File

@@ -160,3 +160,5 @@ void postProcess(inout PostProcessInputs postProcess) {
}
postProcess.color = vec4(color, 1.0);
}
}

View File

@@ -1,12 +1,12 @@
Pod::Spec.new do |spec|
spec.name = "Filament"
spec.version = "1.9.25"
spec.version = "1.10.0"
spec.license = { :type => "Apache 2.0", :file => "LICENSE" }
spec.homepage = "https://google.github.io/filament"
spec.authors = "Google LLC."
spec.summary = "Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS, and WASM/WebGL."
spec.platform = :ios, "11.0"
spec.source = { :http => "https://github.com/google/filament/releases/download/v1.9.25/filament-v1.9.25-ios.tgz" }
spec.source = { :http => "https://github.com/google/filament/releases/download/v1.10.0/filament-v1.10.0-ios.tgz" }
# Fix linking error with Xcode 12; we do not yet support the simulator on Apple silicon.
spec.pod_target_xcconfig = {

View File

@@ -183,7 +183,9 @@ FilamentApp::~FilamentApp() {
engine->destroy(renderer);
engine->destroy(scene);
engine->destroy(view);
engine->destroy(camera);
Entity c = camera->getEntity();
engine->destroyCameraComponent(c);
EntityManager::get().destroy(c);
engine->destroy(swapChain);
engine->destroy(&engine);
}
@@ -197,7 +199,8 @@ void FilamentApp::setupFilament() {
swapChain = engine->createSwapChain(nativeLayer);
renderer = engine->createRenderer();
scene = engine->createScene();
camera = engine->createCamera();
Entity c = EntityManager::get().create();
camera = engine->createCamera(c);
camera->setProjection(60, (float) width / height, 0.1, 10);
}

View File

@@ -64,7 +64,9 @@ App::~App() {
engine->destroy(renderer);
engine->destroy(scene);
engine->destroy(view);
engine->destroy(camera);
Entity c = camera->getEntity();
engine->destroyCameraComponent(c);
EntityManager::get().destroy(c);
engine->destroy(swapChain);
engine->destroy(&engine);
}
@@ -78,7 +80,8 @@ void App::setupFilament() {
swapChain = engine->createSwapChain(nativeLayer);
renderer = engine->createRenderer();
scene = engine->createScene();
camera = engine->createCamera();
Entity c = EntityManager::get().create();
camera = engine->createCamera(c);
cameraManipulator.setCamera(camera);
cameraManipulator.setViewport(width, height);
cameraManipulator.lookAt(filament::math::double3(0, 0, 3), filament::math::double3(0, 0, 0));

View File

@@ -41,7 +41,8 @@ void FilamentApp::initialize() {
swapChain = engine->createSwapChain(nativeLayer);
renderer = engine->createRenderer();
scene = engine->createScene();
camera = engine->createCamera();
Entity c = EntityManager::get().create();
camera = engine->createCamera(c);
filaView = engine->createView();
@@ -126,7 +127,9 @@ FilamentApp::~FilamentApp() {
engine->destroy(renderer);
engine->destroy(scene);
engine->destroy(filaView);
engine->destroy(camera);
Entity c = camera->getEntity();
engine->destroyCameraComponent(c);
EntityManager::get().destroy(c);
engine->destroy(swapChain);
engine->destroy(&engine);
}

View File

@@ -112,7 +112,9 @@ static constexpr uint8_t BAKED_COLOR_PACKAGE[] = {
engine->destroy(renderer);
engine->destroy(scene);
engine->destroy(filaView);
engine->destroy(camera);
Entity c = camera->getEntity();
engine->destroyCameraComponent(c);
EntityManager::get().destroy(c);
engine->destroy(swapChain);
engine->destroy(&engine);
}
@@ -144,7 +146,8 @@ static constexpr uint8_t BAKED_COLOR_PACKAGE[] = {
swapChain = engine->createSwapChain((__bridge void*) self.layer);
renderer = engine->createRenderer();
scene = engine->createScene();
camera = engine->createCamera();
Entity c = EntityManager::get().create();
camera = engine->createCamera(c);
renderer->setClearOptions({.clearColor={0.1, 0.125, 0.25, 1.0}, .clear = true});
filaView = engine->createView();

View File

@@ -113,7 +113,9 @@ static constexpr uint8_t BAKED_COLOR_PACKAGE[] = {
engine->destroy(renderer);
engine->destroy(scene);
engine->destroy(filaView);
engine->destroy(camera);
Entity c = camera->getEntity();
engine->destroyCameraComponent(c);
EntityManager::get().destroy(c);
engine->destroy(swapChain);
engine->destroy(&engine);
}
@@ -153,7 +155,8 @@ static constexpr uint8_t BAKED_COLOR_PACKAGE[] = {
renderer = engine->createRenderer();
scene = engine->createScene();
camera = engine->createCamera();
Entity c = EntityManager::get().create();
camera = engine->createCamera(c);
filaView = engine->createView();

View File

@@ -25,6 +25,7 @@
#include <filament/Material.h>
#include <filament/MaterialInstance.h>
#include <filament/Texture.h>
#include <filament/TextureSampler.h>
#include <filament/VertexBuffer.h>
#include <filament/View.h>
@@ -91,6 +92,7 @@ public:
filament::Texture* mTexture = nullptr;
bool mHasSynced = false;
ImGuiContext* mImGuiContext;
filament::TextureSampler mSampler;
};
} // namespace filagui

View File

@@ -65,8 +65,8 @@ ImGuiHelper::ImGuiHelper(Engine* engine, filament::View* view, const Path& fontP
// For proggy, switch to NEAREST for pixel-perfect text.
if (fontPath.isEmpty() && !imGuiContext) {
TextureSampler sampler(MinFilter::NEAREST, MagFilter::NEAREST);
mMaterial->setDefaultParameter("albedo", mTexture, sampler);
mSampler = TextureSampler(MinFilter::NEAREST, MagFilter::NEAREST);
mMaterial->setDefaultParameter("albedo", mTexture, mSampler);
}
utils::EntityManager& em = utils::EntityManager::get();
@@ -108,8 +108,8 @@ void ImGuiHelper::createAtlasTexture(Engine* engine) {
.build(*engine);
mTexture->setImage(*engine, 0, std::move(pb));
TextureSampler sampler(MinFilter::LINEAR, MagFilter::LINEAR);
mMaterial->setDefaultParameter("albedo", mTexture, sampler);
mSampler = TextureSampler(MinFilter::LINEAR, MagFilter::LINEAR);
mMaterial->setDefaultParameter("albedo", mTexture, mSampler);
}
ImGuiHelper::~ImGuiHelper() {
@@ -220,6 +220,8 @@ void ImGuiHelper::processImGuiCommands(ImDrawData* commands, const ImGuiIO& io)
if (pcmd.TextureId) {
TextureSampler sampler(MinFilter::LINEAR, MagFilter::LINEAR);
materialInstance->setParameter("albedo", (Texture const*)pcmd.TextureId, sampler);
} else {
materialInstance->setParameter("albedo", mTexture, mSampler);
}
rbuilder
.geometry(primIndex, RenderableManager::PrimitiveType::TRIANGLES,

View File

@@ -33,7 +33,7 @@ namespace viewer {
* [{
* "name": "simple",
* "base": {
* "view.dof.focusDistance": 0.1,
* "view.dof.cocScale": 1.0,
* "view.bloom.strength": 0.5
* },
* "permute": {

View File

@@ -506,9 +506,7 @@ static int parse(jsmntok_t const* tokens, int i, const char* jsonChunk, DepthOfF
for (int j = 0; j < size; ++j) {
const jsmntok_t tok = tokens[i];
CHECK_KEY(tok);
if (0 == compare(tok, jsonChunk, "focusDistance")) {
i = parse(tokens, i + 1, jsonChunk, &out->focusDistance);
} else if (0 == compare(tok, jsonChunk, "cocScale")) {
if (0 == compare(tok, jsonChunk, "cocScale")) {
i = parse(tokens, i + 1, jsonChunk, &out->cocScale);
} else if (0 == compare(tok, jsonChunk, "maxApertureDiameter")) {
i = parse(tokens, i + 1, jsonChunk, &out->maxApertureDiameter);
@@ -1239,7 +1237,6 @@ static std::ostream& operator<<(std::ostream& out, const ViewerOptions& in) {
static std::ostream& operator<<(std::ostream& out, const DepthOfFieldOptions& in) {
return out << "{\n"
<< "\"focusDistance\": " << (in.focusDistance) << ",\n"
<< "\"cocScale\": " << (in.cocScale) << ",\n"
<< "\"maxApertureDiameter\": " << (in.maxApertureDiameter) << ",\n"
<< "\"enabled\": " << to_string(in.enabled) << ",\n"

View File

@@ -103,7 +103,6 @@ static const char* JSON_TEST_DEFAULTS = R"TXT(
},
"dof": {
"enabled": false,
"focusDistance": 10.0,
"cocScale": 1.0,
"maxApertureDiameter": 0.01
},

View File

@@ -18,11 +18,16 @@
namespace matc {
void MaterialLexer::readBlock() noexcept {
bool MaterialLexer::readBlock() noexcept {
size_t braceCount = 0;
while (hasMore()) {
skipWhiteSpace();
// This can occur if the block is malformed.
if (mCursor >= mEnd) {
return false;
}
if (*mCursor == '{') {
braceCount++;
} else if (*mCursor == '}') {
@@ -31,11 +36,12 @@ void MaterialLexer::readBlock() noexcept {
if (braceCount == 0) {
consume();
break;
return true;
}
consume();
}
return true;
}
void MaterialLexer::readIdentifier() noexcept {
@@ -76,7 +82,11 @@ bool MaterialLexer::readLexeme() noexcept {
size_t line = getLine();
size_t cursor = getCursor();
switch (nextMaterialType) {
case MaterialType::BLOCK : readBlock(); break;
case MaterialType::BLOCK:
if (!readBlock()) {
nextMaterialType = MaterialType::UNKNOWN;
break;
}
case MaterialType::IDENTIFIER: readIdentifier(); break;
case MaterialType::UNKNOWN: readUnknown(); break;
default:

View File

@@ -30,7 +30,7 @@ private:
bool peek(MaterialType* type) const noexcept;
void readBlock() noexcept;
bool readBlock() noexcept;
void readIdentifier() noexcept;
void readUnknown() noexcept;
};

View File

@@ -77,7 +77,7 @@ public class PreviewMeshPanel extends JPanel {
Filament.getInstance().runOnFilamentThread((Engine engine) -> {
mScene = engine.createScene();
mCamera = engine.createCamera();
mCamera = engine.createCamera(EntityManager.get().create());
mView = engine.createView();
mRenderer = engine.createRenderer();
mPreviewCamera = new PreviewCamera(mCamera);
@@ -136,7 +136,8 @@ public class PreviewMeshPanel extends JPanel {
Filament.getInstance().runOnFilamentThread((Engine engine) -> {
engine.destroyRenderer(mRenderer);
engine.destroyScene(mScene);
engine.destroyCamera(mCamera);
engine.destroyCameraComponent(mCamera.getEntity());
EntityManager.get().destroy(mCamera.getEntity());
engine.destroyView(mView);
mFilamentPanel.destroy(engine);
engine.destroyVertexBuffer(mVertexBuffer);

View File

@@ -256,10 +256,9 @@ Filament.loadClassExtensions = function() {
/// setDepthOfFieldOptions ::method::
/// overrides ::argument:: Dictionary with one or more of the following properties: \
/// focusDistance, cocScale, maxApertureDiameter, enabled.
/// cocScale, maxApertureDiameter, enabled.
Filament.View.prototype.setDepthOfFieldOptions = function(overrides) {
const options = {
focusDistance: 10.0,
cocScale: 1.0,
maxApertureDiameter: 0.01,
enabled: false

View File

@@ -102,7 +102,6 @@ export interface View$AmbientOcclusionOptions {
}
export interface View$DepthOfFieldOptions {
focusDistance?: number;
cocScale?: number;
maxApertureDiameter?: number;
enabled?: boolean;

View File

@@ -367,7 +367,6 @@ value_object<filament::View::AmbientOcclusionOptions>("View$AmbientOcclusionOpti
.field("quality", &filament::View::AmbientOcclusionOptions::quality);
value_object<filament::View::DepthOfFieldOptions>("View$DepthOfFieldOptions")
.field("focusDistance", &filament::View::DepthOfFieldOptions::focusDistance)
.field("cocScale", &filament::View::DepthOfFieldOptions::cocScale)
.field("maxApertureDiameter", &filament::View::DepthOfFieldOptions::maxApertureDiameter)
.field("enabled", &filament::View::DepthOfFieldOptions::enabled)

View File

@@ -1,6 +1,6 @@
{
"name": "filament",
"version": "1.9.25",
"version": "1.10.0",
"description": "Real-time physically based rendering engine",
"main": "filament.js",
"module": "filament.js",