Allow dynamic doubleSided and materialThreshold. (#1072)

* MaterialInstance now has setMaskThreshold for convenience.

* Materials now support dynamic doubleSided property.

This does not change the format of material packages because they
already have both getDoubleSided() and getDoubleSidedSet().

The only way in which this change could impact existing applications is
that materials that explicity set doubleSided to "false" will now
respect the material's culling mode, rather than forcing it to NONE.

Fixes gltf_viewer with littlest_tokyo in ubershader mode.

Fixes #963.

* JNI for dynamic material properties.

* Add underscore prefix to internal material params.

* Remove un-needed mat info field.
This commit is contained in:
Philip Rideout
2019-04-08 11:43:01 -07:00
committed by GitHub
parent 1634a8a2db
commit dcc17b9b7e
19 changed files with 122 additions and 38 deletions

View File

@@ -217,3 +217,19 @@ Java_com_google_android_filament_MaterialInstance_nSetPolygonOffset(JNIEnv*,
MaterialInstance* instance = (MaterialInstance*) nativeMaterialInstance;
instance->setPolygonOffset(scale, constant);
}
extern "C"
JNIEXPORT void JNICALL
Java_com_google_android_filament_MaterialInstance_nSetMaskThreshold(JNIEnv*,
jclass, jlong nativeMaterialInstance, jfloat threshold) {
MaterialInstance* instance = (MaterialInstance*) nativeMaterialInstance;
instance->setMaskThreshold(threshold);
}
extern "C"
JNIEXPORT void JNICALL
Java_com_google_android_filament_MaterialInstance_nSetDoubleSided(JNIEnv*,
jclass, jlong nativeMaterialInstance, jboolean doubleSided) {
MaterialInstance* instance = (MaterialInstance*) nativeMaterialInstance;
instance->setDoubleSided(doubleSided);
}