Receive blend shapes as an array in a "well known" order.

This commit is contained in:
Roberto Garrido 2018-05-11 17:27:15 +02:00
Родитель 52045ceb5e
Коммит b1e1222bcb
2 изменённых файлов: 61 добавлений и 3 удалений

Просмотреть файл

@ -4,8 +4,66 @@ import XRAnchor from './XRAnchor.js'
XRFaceAnchor represents a face anchor
*/
export default class XRFaceAnchor extends XRAnchor {
constructor(coordinateSystem, uid=null, geometry) {
constructor(coordinateSystem, uid=null, geometry, blendShapeArray) {
super(coordinateSystem, uid)
this.geometry = geometry
this.blendShapes = {}
for (let i = 0; i < blendShapeNames.length; i++) {
this.blendShapes[blendShapeNames[i]] = blendShapeArray[i]
}
}
}
}
const blendShapeNames = [
"browDownLeft",
"browDownRight",
"browInnerUp",
"browOuterUpLeft",
"browOuterUpRight",
"cheekPuff",
"cheekSquintLeft",
"cheekSquintRight",
"eyeBlinkLeft",
"eyeBlinkRight",
"eyeLookDownLeft",
"eyeLookDownRight",
"eyeLookInLeft",
"eyeLookInRight",
"eyeLookOutLeft",
"eyeLookOutRight",
"eyeLookUpLeft",
"eyeLookUpRight",
"eyeSquintLeft",
"eyeSquintRight",
"eyeWideLeft",
"eyeWideRight",
"jawForward",
"jawLeft",
"jawOpen",
"jawRight",
"mouthClose",
"mouthDimpleLeft",
"mouthDimpleRight",
"mouthFrownLeft",
"mouthFrownRight",
"mouthFunnel",
"mouthLeft",
"mouthLowerDownLeft",
"mouthLowerDownRight",
"mouthPressLeft",
"mouthPressRight",
"mouthPucker",
"mouthRight",
"mouthRollLower",
"mouthRollUpper",
"mouthShrugLower",
"mouthShrugUpper",
"mouthSmileLeft",
"mouthSmileRight",
"mouthStretchLeft",
"mouthStretchRight",
"mouthUpperUpLeft",
"mouthUpperUpRight",
"noseSneerLeft",
"noseSneerRight"
]

Просмотреть файл

@ -138,7 +138,7 @@ export default class FlatDisplay extends XRDisplay {
anchorObject.geometry)
break
case ARKitWrapper.ANCHOR_TYPE_FACE:
anchor = new XRFaceAnchor(coordinateSystem, anchorObject.uuid, anchorObject.geometry)
anchor = new XRFaceAnchor(coordinateSystem, anchorObject.uuid, anchorObject.geometry, anchorObject.blendShapes)
break
case ARKitWrapper.ANCHOR_TYPE_ANCHOR:
anchor = new XRAnchor(coordinateSystem, anchorObject.uuid)