From 1e21dcbd1f4ed9deddcc22025d56b817d57324d3 Mon Sep 17 00:00:00 2001
From: Robert Long <robert@robertlong.me>
Date: Mon, 6 Aug 2018 18:44:52 -0700
Subject: [PATCH] Make gltf-mode-plus use quality qs. Fix materials on mobile.

---
 src/components/gltf-model-plus.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/components/gltf-model-plus.js b/src/components/gltf-model-plus.js
index 304bd1e31..c31aefea5 100644
--- a/src/components/gltf-model-plus.js
+++ b/src/components/gltf-model-plus.js
@@ -260,7 +260,7 @@ async function loadGLTF(src, preferredTechnique, onProgress) {
         material.extensions.MOZ_alt_materials[preferredTechnique] !== undefined
       ) {
         const altMaterialIndex = material.extensions.MOZ_alt_materials[preferredTechnique];
-        materials[i] = altMaterialIndex;
+        materials[i] = materials[altMaterialIndex];
       }
     }
   }
@@ -312,7 +312,8 @@ AFRAME.registerComponent("gltf-model-plus", {
   },
 
   init() {
-    this.preferredTechnique = AFRAME.utils.device.isMobile() ? "KHR_materials_unlit" : "pbrMetallicRoughness";
+    this.preferredTechnique =
+      window.APP && window.APP.quality === "low" ? "KHR_materials_unlit" : "pbrMetallicRoughness";
     this.loadTemplates();
   },
 
-- 
GitLab