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
This commit is contained in:
@@ -50,32 +50,6 @@ Java_com_google_android_filament_View_nSetViewport(JNIEnv*, jclass,
|
||||
view->setViewport({left, bottom, (uint32_t) width, (uint32_t) height});
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
Java_com_google_android_filament_View_nSetClearColor(JNIEnv*, jclass, jlong nativeView,
|
||||
jfloat linearR, jfloat linearG, jfloat linearB, jfloat linearA) {
|
||||
View* view = (View*) nativeView;
|
||||
view->setClearColor({linearR, linearG, linearB, linearA});
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
Java_com_google_android_filament_View_nGetClearColor(JNIEnv* env, jclass, jlong nativeView, jfloatArray out_) {
|
||||
View* view = (View*) nativeView;
|
||||
jfloat* out = env->GetFloatArrayElements(out_, NULL);
|
||||
auto linearColor = view->getClearColor();
|
||||
out[0] = linearColor[0];
|
||||
out[1] = linearColor[1];
|
||||
out[2] = linearColor[2];
|
||||
out[3] = linearColor[3];
|
||||
env->ReleaseFloatArrayElements(out_, out, 0);
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
Java_com_google_android_filament_View_nSetClearTargets(JNIEnv*, jclass,
|
||||
jlong nativeView, jboolean color, jboolean depth, jboolean stencil) {
|
||||
View* view = (View*) nativeView;
|
||||
view->setClearTargets(color, depth, stencil);
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
Java_com_google_android_filament_View_nSetVisibleLayers(JNIEnv*, jclass, jlong nativeView, jint select, jint value) {
|
||||
View* view = (View*) nativeView;
|
||||
@@ -90,9 +64,9 @@ Java_com_google_android_filament_View_nSetShadowsEnabled(JNIEnv*, jclass, jlong
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
Java_com_google_android_filament_View_nSetRenderTarget(JNIEnv*, jclass,
|
||||
jlong nativeView, jlong nativeTarget, jint flags) {
|
||||
jlong nativeView, jlong nativeTarget) {
|
||||
View* view = (View*) nativeView;
|
||||
view->setRenderTarget((RenderTarget*) nativeTarget, (View::TargetBufferFlags) flags);
|
||||
view->setRenderTarget((RenderTarget*) nativeTarget);
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
@@ -272,3 +246,9 @@ Java_com_google_android_filament_View_nSetFogOptions(JNIEnv *, jclass , jlong na
|
||||
};
|
||||
view->setFogOptions(options);
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
Java_com_google_android_filament_View_nSetBlendMode(JNIEnv *, jclass , jlong nativeView, jint blendMode) {
|
||||
View* view = (View*) nativeView;
|
||||
view->setBlendMode((View::BlendMode)blendMode);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user