Skip to content

Commit

Permalink
Merge branch 'rc/1.9.16' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
bejado committed Mar 15, 2021
2 parents d9a6e2e + 3452fb3 commit c15db68
Show file tree
Hide file tree
Showing 112 changed files with 7,816 additions and 3,532 deletions.
12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ endif()

# On Android RELEASE builds, we disable exceptions and RTTI to save some space (about 75 KiB
# saved by -fno-exception and 10 KiB saved by -fno-rtti).
if (ANDROID OR WEBGL)
if (ANDROID OR IOS OR WEBGL)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti")
endif()

Expand Down Expand Up @@ -572,6 +572,7 @@ add_subdirectory(${EXTERNAL}/libgtest/tnt)
add_subdirectory(${LIBRARIES}/camutils)
add_subdirectory(${LIBRARIES}/filabridge)
add_subdirectory(${LIBRARIES}/filaflat)
add_subdirectory(${LIBRARIES}/filagui)
add_subdirectory(${LIBRARIES}/filameshio)
add_subdirectory(${LIBRARIES}/geometry)
add_subdirectory(${LIBRARIES}/gltfio)
Expand All @@ -580,15 +581,19 @@ add_subdirectory(${LIBRARIES}/image)
add_subdirectory(${LIBRARIES}/math)
add_subdirectory(${LIBRARIES}/mathio)
add_subdirectory(${LIBRARIES}/utils)
add_subdirectory(${LIBRARIES}/viewer)
add_subdirectory(${FILAMENT}/filament)
add_subdirectory(${FILAMENT}/shaders)
add_subdirectory(${EXTERNAL}/civetweb/tnt)
add_subdirectory(${EXTERNAL}/hat-trie/tnt)
add_subdirectory(${EXTERNAL}/imgui/tnt)
add_subdirectory(${EXTERNAL}/robin-map/tnt)
add_subdirectory(${EXTERNAL}/smol-v/tnt)
add_subdirectory(${EXTERNAL}/benchmark/tnt)
add_subdirectory(${EXTERNAL}/meshoptimizer)
add_subdirectory(${EXTERNAL}/cgltf/tnt)
add_subdirectory(${EXTERNAL}/draco/tnt)
add_subdirectory(${EXTERNAL}/jsmn/tnt)
add_subdirectory(${EXTERNAL}/stb/tnt)
add_subdirectory(${EXTERNAL}/getopt)

Expand All @@ -602,7 +607,6 @@ if (FILAMENT_BUILD_FILAMAT OR IS_HOST_PLATFORM)

# the material debugger requires filamat
if (FILAMENT_ENABLE_MATDBG OR IS_HOST_PLATFORM)
add_subdirectory(${EXTERNAL}/civetweb/tnt)
add_subdirectory(${LIBRARIES}/matdbg)
endif()
endif()
Expand All @@ -626,9 +630,7 @@ endif()
if (IS_HOST_PLATFORM)
add_subdirectory(${LIBRARIES}/bluegl)
add_subdirectory(${LIBRARIES}/filamentapp)
add_subdirectory(${LIBRARIES}/filagui)
add_subdirectory(${LIBRARIES}/imageio)
add_subdirectory(${LIBRARIES}/viewer)

add_subdirectory(${FILAMENT}/java/filamat)
add_subdirectory(${FILAMENT}/java/filament)
Expand All @@ -638,8 +640,6 @@ if (IS_HOST_PLATFORM)

add_subdirectory(${EXTERNAL}/astcenc/tnt)
add_subdirectory(${EXTERNAL}/etc2comp)
add_subdirectory(${EXTERNAL}/imgui/tnt)
add_subdirectory(${EXTERNAL}/jsmn/tnt)
add_subdirectory(${EXTERNAL}/libassimp/tnt)
add_subdirectory(${EXTERNAL}/libpng/tnt)
add_subdirectory(${EXTERNAL}/libsdl2/tnt)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ repositories {
}
dependencies {
implementation 'com.google.android.filament:filament-android:1.9.15'
implementation 'com.google.android.filament:filament-android:1.9.16'
}
```

Expand Down Expand Up @@ -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.15'
pod 'Filament', '~> 1.9.16'
```

### Snapshots
Expand Down
6 changes: 6 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ A new header is inserted each time a *tag* is created.

## Next release (main branch)

## v1.9.16

gltfio: Add ResourceLoader evict API.
gltfio: Fix ResourceLoader cache bug.
iOS: Disable exceptions to reduce binary size.

## v1.9.15

filamat / matc: fix sporatic crash.
Expand Down
2 changes: 2 additions & 0 deletions android/filament-android/libfilament-jni.map
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ LIBFILAMENT {
*filament*Aabb*;
*filament*IndirectLight*;
*filament*LightManager*;
*filament*Renderer*;
*filament*Transform*;
*filament*Material*;
*filament*IndexBuffer*;
*filament*VertexBuffer*;
*filament*View*;
*filament*Texture*;
*filament*geometry*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ public Builder irradiance(@NonNull Texture cubemap) {
* range can be adjusted with this method.</p>
*
* @param envIntensity Scale factor applied to the environment and irradiance such that
* the result is in cd/m^2 (lux) units (default = 30000)
* the result is in <i>lux</i>, or <i>lumen/m^2</i> (default = 30000)
*
* @return This Builder, for chaining calls.
*/
Expand Down Expand Up @@ -354,14 +354,14 @@ public void finalize() {
* range can be adjusted with this method.</p>
*
* @param intensity Scale factor applied to the environment and irradiance such that
* the result is in cd/m^2 units (default = 30000)
* the result is in <i>lux</i>, or <i>lumen/m^2</i> (default = 30000)
*/
public void setIntensity(float intensity) {
nSetIntensity(getNativeObject(), intensity);
}

/**
* Returns the environment's intensity in cd/m<sup>2</sup>.
* Returns the environment's intensity in <i>lux</i>, or <i>lumen/m^2</i>.
*/
public float getIntensity() {
return nGetIntensity(getNativeObject());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public Builder showSun(boolean show) {
* its place.</p>
*
* @param envIntensity Scale factor applied to the skybox texel values such that
* the result is in cd/m<sup>2</sup> (lux) units (default = 30000)
* the result is in <i>lux</i>, or <i>lumen/m^2</i> (default = 30000)
*
* @return This Builder, for chaining calls.
*
Expand Down Expand Up @@ -237,7 +237,7 @@ public int getLayerMask() {
}

/**
* Returns the <code>Skybox</code>'s intensity in cd/m<sup>2</sup>.
* Returns the <code>Skybox</code>'s intensity in <i>lux</i>, or <i>lumen/m^2</i>.
*/
public float getIntensity() { return nGetIntensity(getNativeObject()); }

Expand Down
12 changes: 12 additions & 0 deletions android/filament-utils-android/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,26 @@ add_library(image STATIC IMPORTED)
set_target_properties(image PROPERTIES IMPORTED_LOCATION
${FILAMENT_DIR}/lib/${ANDROID_ABI}/libimage.a)

add_library(viewer STATIC IMPORTED)
set_target_properties(viewer PROPERTIES IMPORTED_LOCATION
${FILAMENT_DIR}/lib/${ANDROID_ABI}/libviewer.a)

add_library(civetweb STATIC IMPORTED)
set_target_properties(civetweb PROPERTIES IMPORTED_LOCATION
${FILAMENT_DIR}/lib/${ANDROID_ABI}/libcivetweb.a)

include_directories(${FILAMENT_DIR}/include
..
../../libs/utils/include)

set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libfilament-utils-jni.map")

add_library(filament-utils-jni SHARED
src/main/cpp/AutomationEngine.cpp
src/main/cpp/Bookmark.cpp
src/main/cpp/Utils.cpp
src/main/cpp/Manipulator.cpp
src/main/cpp/RemoteServer.cpp

../common/CallbackUtils.cpp
../common/NioUtils.cpp
Expand All @@ -33,6 +43,8 @@ set_target_properties(filament-utils-jni PROPERTIES LINK_DEPENDS
# The ordering in the following list is important because CMake does not have dependency information.
target_link_libraries(filament-utils-jni
gltfio-jni
civetweb
camutils
image
viewer
)
115 changes: 115 additions & 0 deletions android/filament-utils-android/src/main/cpp/AutomationEngine.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
/*
* Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include <jni.h>

#include <viewer/AutomationEngine.h>

using namespace filament;
using namespace filament::viewer;

extern "C" JNIEXPORT jlong JNICALL
Java_com_google_android_filament_utils_AutomationEngine_nCreateAutomationEngine(JNIEnv* env, jclass,
jstring spec_) {
const char* spec = env->GetStringUTFChars(spec_, 0);
jlong result = (jlong) AutomationEngine::createFromJSON(spec, strlen(spec));
env->ReleaseStringUTFChars(spec_, spec);
return result;
}

extern "C" JNIEXPORT jlong JNICALL
Java_com_google_android_filament_utils_AutomationEngine_nCreateDefaultAutomationEngine(JNIEnv* env,
jclass klass) {
return (jlong) AutomationEngine::createDefaultTest();
}

extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_utils_AutomationEngine_nSetOptions(JNIEnv* env, jclass klass,
jlong nativeAutomation, jfloat sleepDuration, jint minFrameCount, jboolean verbose) {
AutomationEngine* automation = (AutomationEngine*) nativeAutomation;
AutomationEngine::Options options = {
.sleepDuration = sleepDuration,
.minFrameCount = minFrameCount,
.verbose = (bool) verbose,

// Since they write to the filesystem, we do not currently support exporting screenshots
// and JSON files on Android.
.exportScreenshots = false,
.exportSettings = false,
};
automation->setOptions(options);
}

extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_utils_AutomationEngine_nStartRunning(JNIEnv* env, jclass klass,
jlong nativeAutomation) {
AutomationEngine* automation = (AutomationEngine*) nativeAutomation;
automation->startRunning();
}

extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_utils_AutomationEngine_nStartBatchMode(JNIEnv* env, jclass klass,
jlong nativeAutomation) {
AutomationEngine* automation = (AutomationEngine*) nativeAutomation;
automation->startBatchMode();
}

extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_utils_AutomationEngine_nTick(JNIEnv* env, jclass klass,
jlong nativeAutomation, jlong view, jlongArray materials, jlong renderer, jfloat deltaTime) {
using MaterialPointer = MaterialInstance*;
jsize materialCount = 0;
jlong* longMaterials = nullptr;
MaterialPointer* ptrMaterials = nullptr;
if (materials) {
materialCount = env->GetArrayLength(materials);
ptrMaterials = new MaterialPointer[materialCount];
longMaterials = env->GetLongArrayElements(materials, nullptr);
for (jsize i = 0; i < materialCount; i++) {
ptrMaterials[i] = (MaterialPointer) longMaterials[i];
}
}
AutomationEngine* automation = (AutomationEngine*) nativeAutomation;
automation->tick((View*) view, ptrMaterials, materialCount, (Renderer*) renderer, deltaTime);
if (longMaterials) {
env->ReleaseLongArrayElements(materials, longMaterials, 0);
delete[] ptrMaterials;
}
}

extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_utils_AutomationEngine_nSignalBatchMode(JNIEnv*, jclass, jlong native) {
AutomationEngine* automation = (AutomationEngine*) native;
automation->signalBatchMode();
}

extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_utils_AutomationEngine_nStopRunning(JNIEnv*, jclass, jlong native) {
AutomationEngine* automation = (AutomationEngine*) native;
automation->stopRunning();
}

extern "C" JNIEXPORT jboolean JNICALL
Java_com_google_android_filament_utils_AutomationEngine_nShouldClose(JNIEnv*, jclass, jlong native) {
AutomationEngine* automation = (AutomationEngine*) native;
return automation->shouldClose();
}

extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_utils_AutomationEngine_nDestroy(JNIEnv*, jclass, jlong native) {
AutomationEngine* automation = (AutomationEngine*) native;
delete automation;
}
77 changes: 77 additions & 0 deletions android/filament-utils-android/src/main/cpp/RemoteServer.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include <jni.h>

#include <viewer/RemoteServer.h>

using namespace filament::viewer;

extern "C" JNIEXPORT jlong JNICALL
Java_com_google_android_filament_utils_RemoteServer_nCreate(JNIEnv* env, jclass, jint port) {
RemoteServer* server = new RemoteServer(port);
if (!server->isValid()) {
delete server;
return 0;
}
return (jlong) server;
}

extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_utils_RemoteServer_nDestroy(JNIEnv*, jclass, jlong native) {
RemoteServer* server = (RemoteServer*) native;
delete server;
}

extern "C" JNIEXPORT jstring JNICALL
Java_com_google_android_filament_utils_RemoteServer_nPeekIncomingLabel(JNIEnv* env, jclass, jlong native) {
RemoteServer* server = (RemoteServer*) native;
char const* label = server->peekIncomingLabel();
return label ? env->NewStringUTF(label) : nullptr;
}

extern "C" JNIEXPORT jstring JNICALL
Java_com_google_android_filament_utils_RemoteServer_nPeekReceivedLabel(JNIEnv* env, jclass, jlong native) {
RemoteServer* server = (RemoteServer*) native;
ReceivedMessage const* msg = server->peekReceivedMessage();
return msg ? env->NewStringUTF(msg->label) : nullptr;
}

extern "C" JNIEXPORT jint JNICALL
Java_com_google_android_filament_utils_RemoteServer_nPeekReceivedBufferLength(JNIEnv* env, jclass, jlong native) {
RemoteServer* server = (RemoteServer*) native;
ReceivedMessage const* msg = server->peekReceivedMessage();
return msg ? msg->bufferByteCount : 0;
}

extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_utils_RemoteServer_nAcquireReceivedMessage(JNIEnv* env, jclass, jlong native, jobject buffer, jint length) {
RemoteServer* server = (RemoteServer*) native;
ReceivedMessage const* msg = server->acquireReceivedMessage();
if (msg == nullptr) {
return;
}

void* address = env->GetDirectBufferAddress(buffer);
if (address == nullptr) {
// This should never happen because the Java layer does allocateDirect.
return;
}

memcpy(address, msg->buffer, length);
server->releaseReceivedMessage(msg);
}

Loading

0 comments on commit c15db68

Please sign in to comment.