From 5e51ff78d94232e62f5ac3759aa21d1520ec3cf4 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Tue, 27 Jul 2021 14:56:50 -0700 Subject: [PATCH] Add KHR_material_volume support to MaterialProvider (#4391) * Add KHR_material_volume support to MaterialProvider * Fix typo --- android/gltfio-android/src/main/cpp/MaterialKey.cpp | 6 ++++++ android/gltfio-android/src/main/cpp/MaterialKey.h | 2 ++ .../google/android/filament/gltfio/MaterialProvider.java | 2 ++ 3 files changed, 10 insertions(+) diff --git a/android/gltfio-android/src/main/cpp/MaterialKey.cpp b/android/gltfio-android/src/main/cpp/MaterialKey.cpp index dae7c5a43e..d3c63d36e0 100644 --- a/android/gltfio-android/src/main/cpp/MaterialKey.cpp +++ b/android/gltfio-android/src/main/cpp/MaterialKey.cpp @@ -63,6 +63,8 @@ void MaterialKeyHelper::init(JNIEnv* env) { sheenColorUV = field("sheenColorUV", "I"); hasSheenRoughnessTexture = field("hasSheenRoughnessTexture", "Z"); sheenRoughnessUV = field("sheenRoughnessUV", "I"); + hasVolumeThicknessTexture = field("hasVolumeThicknessTexture", "Z"); + volumeThicknessUV = field("volumeThicknessUV", "I"); hasSheen = field("hasSheen", "Z"); hasIOR = field("hasIOR", "Z"); } @@ -104,6 +106,8 @@ void MaterialKeyHelper::copy(JNIEnv* env, MaterialKey& dst, jobject src) { dst.sheenColorUV = env->GetIntField(src, sheenColorUV); dst.hasSheenRoughnessTexture = env->GetBooleanField(src, hasSheenRoughnessTexture); dst.sheenRoughnessUV = env->GetIntField(src, sheenRoughnessUV); + dst.hasVolumeThicknessTexture = env->GetBooleanField(src, hasVolumeThicknessTexture); + dst.volumeThicknessUV = env->GetIntField(src, volumeThicknessUV); dst.hasSheen = env->GetBooleanField(src, hasSheen); dst.hasIOR = env->GetBooleanField(src, hasIOR); } @@ -140,6 +144,8 @@ void MaterialKeyHelper::copy(JNIEnv* env, jobject dst, const MaterialKey& src) { env->SetIntField(dst, sheenColorUV, src.sheenColorUV); env->SetBooleanField(dst, hasSheenRoughnessTexture, src.hasSheenRoughnessTexture); env->SetIntField(dst, sheenRoughnessUV, src.sheenRoughnessUV); + env->SetBooleanField(dst, hasVolumeThicknessTexture, src.hasVolumeThicknessTexture); + env->SetIntField(dst, volumeThicknessUV, src.volumeThicknessUV); env->SetBooleanField(dst, hasSheen, src.hasSheen); env->SetBooleanField(dst, hasIOR, src.hasIOR); } diff --git a/android/gltfio-android/src/main/cpp/MaterialKey.h b/android/gltfio-android/src/main/cpp/MaterialKey.h index 10890605fc..10406c9dbc 100644 --- a/android/gltfio-android/src/main/cpp/MaterialKey.h +++ b/android/gltfio-android/src/main/cpp/MaterialKey.h @@ -61,6 +61,8 @@ private: jfieldID sheenColorUV; jfieldID hasSheenRoughnessTexture; jfieldID sheenRoughnessUV; + jfieldID hasVolumeThicknessTexture; + jfieldID volumeThicknessUV; jfieldID hasSheen; jfieldID hasIOR; }; diff --git a/android/gltfio-android/src/main/java/com/google/android/filament/gltfio/MaterialProvider.java b/android/gltfio-android/src/main/java/com/google/android/filament/gltfio/MaterialProvider.java index 5191d983cc..8da62c8e26 100644 --- a/android/gltfio-android/src/main/java/com/google/android/filament/gltfio/MaterialProvider.java +++ b/android/gltfio-android/src/main/java/com/google/android/filament/gltfio/MaterialProvider.java @@ -62,6 +62,8 @@ public interface MaterialProvider { public int sheenColorUV; public boolean hasSheenRoughnessTexture; public int sheenRoughnessUV; + public boolean hasVolumeThicknessTexture; + public int volumeThicknessUV; public boolean hasSheen; public boolean hasIOR;