engine: move setFrontFaceWindingInverted from View to MaterialInstance (#7331)

Moving setFrontFaceWindingInverted to MaterialInstance will enable
finer control over face inversion and aligns better with Vulkan's
pipeline definition (see VkGraphicsPipelineCreateInfo).
This commit is contained in:
Powei Feng
2023-11-06 14:06:00 -08:00
committed by GitHub
parent 62adb234d1
commit 038f07cb34
17 changed files with 140 additions and 136 deletions

View File

@@ -433,6 +433,13 @@ Java_com_google_android_filament_MaterialInstance_nSetStencilWriteMask(JNIEnv*,
instance->setStencilWriteMask(writeMask, static_cast<MaterialInstance::StencilFace>(face));
}
extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_MaterialInstance_nSetFrontFaceWindingInverted(JNIEnv*,
jclass, jlong nativeMaterialInstance, jboolean inverted) {
MaterialInstance* instance = (MaterialInstance*) nativeMaterialInstance;
instance->setFrontFaceWindingInverted(inverted);
}
extern "C"
JNIEXPORT jstring JNICALL
Java_com_google_android_filament_MaterialInstance_nGetName(JNIEnv* env, jclass,
@@ -469,7 +476,7 @@ extern "C"
JNIEXPORT jfloat JNICALL
Java_com_google_android_filament_MaterialInstance_nGetMaskThreshold(JNIEnv* env, jclass clazz,
jlong nativeMaterialInstance) {
MaterialInstance* instance = (MaterialInstance*)nativeMaterialInstance;
MaterialInstance* instance = (MaterialInstance*) nativeMaterialInstance;
return instance->getMaskThreshold();
}
@@ -477,7 +484,7 @@ extern "C"
JNIEXPORT jfloat JNICALL
Java_com_google_android_filament_MaterialInstance_nGetSpecularAntiAliasingVariance(JNIEnv* env,
jclass clazz, jlong nativeMaterialInstance) {
MaterialInstance* instance = (MaterialInstance*)nativeMaterialInstance;
MaterialInstance* instance = (MaterialInstance*) nativeMaterialInstance;
return instance->getSpecularAntiAliasingVariance();
}
@@ -485,7 +492,7 @@ extern "C"
JNIEXPORT jfloat JNICALL
Java_com_google_android_filament_MaterialInstance_nGetSpecularAntiAliasingThreshold(JNIEnv* env,
jclass clazz, jlong nativeMaterialInstance) {
MaterialInstance* instance = (MaterialInstance*)nativeMaterialInstance;
MaterialInstance* instance = (MaterialInstance*) nativeMaterialInstance;
return instance->getSpecularAntiAliasingThreshold();
}
@@ -493,7 +500,7 @@ extern "C"
JNIEXPORT jboolean JNICALL
Java_com_google_android_filament_MaterialInstance_nIsDoubleSided(JNIEnv* env, jclass clazz,
jlong nativeMaterialInstance) {
MaterialInstance* instance = (MaterialInstance*)nativeMaterialInstance;
MaterialInstance* instance = (MaterialInstance*) nativeMaterialInstance;
return instance->isDoubleSided();
}
@@ -501,7 +508,7 @@ extern "C"
JNIEXPORT jint JNICALL
Java_com_google_android_filament_MaterialInstance_nGetCullingMode(JNIEnv* env, jclass clazz,
jlong nativeMaterialInstance) {
MaterialInstance* instance = (MaterialInstance*)nativeMaterialInstance;
MaterialInstance* instance = (MaterialInstance*) nativeMaterialInstance;
return (jint)instance->getCullingMode();
}
@@ -509,7 +516,7 @@ extern "C"
JNIEXPORT jboolean JNICALL
Java_com_google_android_filament_MaterialInstance_nIsColorWriteEnabled(JNIEnv* env, jclass clazz,
jlong nativeMaterialInstance) {
MaterialInstance* instance = (MaterialInstance*)nativeMaterialInstance;
MaterialInstance* instance = (MaterialInstance*) nativeMaterialInstance;
return instance->isColorWriteEnabled();
}
@@ -517,7 +524,7 @@ extern "C"
JNIEXPORT jboolean JNICALL
Java_com_google_android_filament_MaterialInstance_nIsDepthWriteEnabled(JNIEnv* env, jclass clazz,
jlong nativeMaterialInstance) {
MaterialInstance* instance = (MaterialInstance*)nativeMaterialInstance;
MaterialInstance* instance = (MaterialInstance*) nativeMaterialInstance;
return instance->isDepthWriteEnabled();
}
@@ -525,7 +532,7 @@ extern "C"
JNIEXPORT jboolean JNICALL
Java_com_google_android_filament_MaterialInstance_nIsStencilWriteEnabled(JNIEnv* env, jclass clazz,
jlong nativeMaterialInstance) {
MaterialInstance* instance = (MaterialInstance*)nativeMaterialInstance;
MaterialInstance* instance = (MaterialInstance*) nativeMaterialInstance;
return instance->isStencilWriteEnabled();
}
@@ -533,7 +540,7 @@ extern "C"
JNIEXPORT jboolean JNICALL
Java_com_google_android_filament_MaterialInstance_nIsDepthCullingEnabled(JNIEnv* env, jclass clazz,
jlong nativeMaterialInstance) {
MaterialInstance* instance = (MaterialInstance*)nativeMaterialInstance;
MaterialInstance* instance = (MaterialInstance*) nativeMaterialInstance;
return instance->isDepthCullingEnabled();
}
@@ -541,6 +548,13 @@ extern "C"
JNIEXPORT jint JNICALL
Java_com_google_android_filament_MaterialInstance_nGetDepthFunc(JNIEnv* env, jclass clazz,
jlong nativeMaterialInstance) {
MaterialInstance* instance = (MaterialInstance*)nativeMaterialInstance;
MaterialInstance* instance = (MaterialInstance*) nativeMaterialInstance;
return (jint)instance->getDepthFunc();
}
extern "C" JNIEXPORT jboolean JNICALL
Java_com_google_android_filament_MaterialInstance_nIsFrontFaceWindingInverted(JNIEnv*,
jclass, jlong nativeMaterialInstance) {
MaterialInstance* instance = (MaterialInstance*) nativeMaterialInstance;
return static_cast<jboolean>(instance->isFrontFaceWindingInverted());
}