From 473677320445397a818b095660cf92d464baa38e Mon Sep 17 00:00:00 2001 From: Xavier Bourry Date: Tue, 8 Sep 2020 15:09:42 -0400 Subject: [PATCH] [QUAL] - Flexible mask helper - add possibility to specify geometry name for load_geometryFromGLTF() - see https://github.com/xavierjs/WebAR.rocks.face/issues/1 --- demos/flexibleMask/main.js | 2 +- helpers/WebARRocksFaceFlexibleMaskHelper.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/demos/flexibleMask/main.js b/demos/flexibleMask/main.js index 611c179..616e60b 100644 --- a/demos/flexibleMask/main.js +++ b/demos/flexibleMask/main.js @@ -141,7 +141,7 @@ function build_scene(threeInstances){ //WebARRocksFaceHelper.add_threejsOccluderFromFile('assets/occluder.glb', null, threeLoadingManager); // build and add the flexible mask: - _flexibleMaskHelper.load_geometryFromGLTF(threeLoadingManager, _spec.flexibleMaskURL).then(function(geom){ + _flexibleMaskHelper.load_geometryFromGLTF(threeLoadingManager, _spec.flexibleMaskURL, null).then(function(geom){ const face3DKeypoints = (_spec.flexibleMaskPoints) ? _spec.flexibleMaskPoints : WebARRocksFaceHelper.get_facePointPositions(); _flexibleMaskMesh = _flexibleMaskHelper.build_flexibleMask(geom, face3DKeypoints, { kpInfluenceDecay: _spec.kpInfluenceDecay // [ distance from the keypoint where decay start, distance from the keypoint where decay ends ] diff --git a/helpers/WebARRocksFaceFlexibleMaskHelper.js b/helpers/WebARRocksFaceFlexibleMaskHelper.js index 0b61b86..4c8c8d4 100644 --- a/helpers/WebARRocksFaceFlexibleMaskHelper.js +++ b/helpers/WebARRocksFaceFlexibleMaskHelper.js @@ -145,10 +145,10 @@ const WebARRocksFaceFlexibleMaskHelper = (function(){ // END MISC HELPERS const that = { - load_geometryFromGLTF: function(loadingManager, GLTFUrl){ + load_geometryFromGLTF: function(loadingManager, GLTFUrl, flexibleGeometryName){ return new Promise(function(resolve, reject){ new THREE.GLTFLoader(loadingManager).load(GLTFUrl, function(model){ - const geom = that.extract_flexibleMaskGeometry(model.scene, null); + const geom = that.extract_flexibleMaskGeometry(model.scene, flexibleGeometryName); resolve(geom); }); //end GLTF loading }); //end return new Promise