Skip to content

Commit ff49f0f

Browse files
Check for Android for mapping
1 parent ad95938 commit ff49f0f

File tree

1 file changed

+57
-25
lines changed

1 file changed

+57
-25
lines changed

source/ft/adaptors/vtsproto.d

+57-25
Original file line numberDiff line numberDiff line change
@@ -288,31 +288,63 @@ public:
288288

289289
if (data.blendShapesDict.length > 0) {
290290

291-
// LEFT EYE
292-
this.blendshapes[BlendshapeNames.ftEyeBlinkLeft] = this.nativeBlendshapes["EyeBlinkLeft"];
293-
this.blendshapes[BlendshapeNames.ftEyeXLeft] = this.nativeBlendshapes["EyeLookOutLeft"]-this.nativeBlendshapes["EyeLookInLeft"];
294-
this.blendshapes[BlendshapeNames.ftEyeYLeft] = this.nativeBlendshapes["EyeLookUpLeft"]-this.nativeBlendshapes["EyeLookDownLeft"];
295-
this.blendshapes[BlendshapeNames.ftEyeSquintLeft] = this.nativeBlendshapes["EyeSquintLeft"];
296-
this.blendshapes[BlendshapeNames.ftEyeWidenLeft] = this.nativeBlendshapes["EyeSquintLeft"];
297-
298-
// RIGHT EYE
299-
this.blendshapes[BlendshapeNames.ftEyeBlinkRight] = this.nativeBlendshapes["EyeBlinkRight"];
300-
this.blendshapes[BlendshapeNames.ftEyeXRight] = this.nativeBlendshapes["EyeLookInRight"]-this.nativeBlendshapes["EyeLookOutRight"];
301-
this.blendshapes[BlendshapeNames.ftEyeYRight] = this.nativeBlendshapes["EyeLookUpRight"]-this.nativeBlendshapes["EyeLookDownRight"];
302-
this.blendshapes[BlendshapeNames.ftEyeSquintRight] = this.nativeBlendshapes["EyeSquintRight"];
303-
this.blendshapes[BlendshapeNames.ftEyeWidenRight] = this.nativeBlendshapes["EyeSquintRight"];
304-
305-
// MOUTH
306-
this.blendshapes[BlendshapeNames.ftMouthOpen] = this.nativeBlendshapes["JawOpen"];
307-
this.blendshapes[BlendshapeNames.ftMouthX] = (1 + this.nativeBlendshapes["MouthLeft"]-this.nativeBlendshapes["MouthRight"]) / 2.0;
308-
this.blendshapes[BlendshapeNames.ftMouthEmotion] = (
309-
clamp(
310-
1 +
311-
(this.nativeBlendshapes["MouthSmileLeft"]+this.nativeBlendshapes["MouthSmileRight"]/2.0) -
312-
(this.nativeBlendshapes["MouthFrownLeft"]+this.nativeBlendshapes["MouthFrownRight"]/2.0),
313-
0, 2
314-
)
315-
) / 2.0;
291+
// CHECK FOR ANDROID
292+
if ("jawOpen" in this.nativeBlendshapes) { // LEFT EYE
293+
this.blendshapes[BlendshapeNames.ftEyeBlinkLeft] = this.nativeBlendshapes["EyeBlinkLeft"];
294+
this.blendshapes[BlendshapeNames.ftEyeXLeft] = this.nativeBlendshapes["eyeLookOut_L"]-this.nativeBlendshapes["eyeLookIn_L"];
295+
this.blendshapes[BlendshapeNames.ftEyeYLeft] = this.nativeBlendshapes["eyeLookUp_L"]-this.nativeBlendshapes["eyeLookDown_L"];
296+
this.blendshapes[BlendshapeNames.ftEyeSquintLeft] = this.nativeBlendshapes["eyeSquint_L"];
297+
this.blendshapes[BlendshapeNames.ftEyeWidenLeft] = this.nativeBlendshapes["eyeSquint_L"];
298+
299+
// RIGHT EYE
300+
this.blendshapes[BlendshapeNames.ftEyeBlinkRight] = this.nativeBlendshapes["EyeBlinkRight"];
301+
this.blendshapes[BlendshapeNames.ftEyeXRight] = this.nativeBlendshapes["eyeLookIn_R"]-this.nativeBlendshapes["eyeLookOut_R"];
302+
this.blendshapes[BlendshapeNames.ftEyeYRight] = this.nativeBlendshapes["eyeLookUp_R"]-this.nativeBlendshapes["eyeLookDown_R"];
303+
this.blendshapes[BlendshapeNames.ftEyeSquintRight] = this.nativeBlendshapes["eyeSquint_R"];
304+
this.blendshapes[BlendshapeNames.ftEyeWidenRight] = this.nativeBlendshapes["eyeSquint_R"];
305+
306+
// MOUTH
307+
this.blendshapes[BlendshapeNames.ftMouthOpen] = this.nativeBlendshapes["jawOpen"];
308+
this.blendshapes[BlendshapeNames.ftMouthX] = (1 + this.nativeBlendshapes["mouthLeft"]-this.nativeBlendshapes["mouthRight"]) / 2.0;
309+
this.blendshapes[BlendshapeNames.ftMouthEmotion] = (
310+
clamp(
311+
1 +
312+
(this.nativeBlendshapes["mouthSmile_L"]+this.nativeBlendshapes["mouthSmile_R"]/2.0) -
313+
(this.nativeBlendshapes["mouthFrown_L"]+this.nativeBlendshapes["mouthFrown_R"]/2.0),
314+
0, 2
315+
)
316+
) / 2.0;
317+
318+
} else {
319+
320+
// WE'RE ON IOS
321+
322+
// LEFT EYE
323+
this.blendshapes[BlendshapeNames.ftEyeBlinkLeft] = this.nativeBlendshapes["EyeBlinkLeft"];
324+
this.blendshapes[BlendshapeNames.ftEyeXLeft] = this.nativeBlendshapes["EyeLookOutLeft"]-this.nativeBlendshapes["EyeLookInLeft"];
325+
this.blendshapes[BlendshapeNames.ftEyeYLeft] = this.nativeBlendshapes["EyeLookUpLeft"]-this.nativeBlendshapes["EyeLookDownLeft"];
326+
this.blendshapes[BlendshapeNames.ftEyeSquintLeft] = this.nativeBlendshapes["EyeSquintLeft"];
327+
this.blendshapes[BlendshapeNames.ftEyeWidenLeft] = this.nativeBlendshapes["EyeSquintLeft"];
328+
329+
// RIGHT EYE
330+
this.blendshapes[BlendshapeNames.ftEyeBlinkRight] = this.nativeBlendshapes["EyeBlinkRight"];
331+
this.blendshapes[BlendshapeNames.ftEyeXRight] = this.nativeBlendshapes["EyeLookInRight"]-this.nativeBlendshapes["EyeLookOutRight"];
332+
this.blendshapes[BlendshapeNames.ftEyeYRight] = this.nativeBlendshapes["EyeLookUpRight"]-this.nativeBlendshapes["EyeLookDownRight"];
333+
this.blendshapes[BlendshapeNames.ftEyeSquintRight] = this.nativeBlendshapes["EyeSquintRight"];
334+
this.blendshapes[BlendshapeNames.ftEyeWidenRight] = this.nativeBlendshapes["EyeSquintRight"];
335+
336+
// MOUTH
337+
this.blendshapes[BlendshapeNames.ftMouthOpen] = this.nativeBlendshapes["JawOpen"];
338+
this.blendshapes[BlendshapeNames.ftMouthX] = (1 + this.nativeBlendshapes["MouthLeft"]-this.nativeBlendshapes["MouthRight"]) / 2.0;
339+
this.blendshapes[BlendshapeNames.ftMouthEmotion] = (
340+
clamp(
341+
1 +
342+
(this.nativeBlendshapes["MouthSmileLeft"]+this.nativeBlendshapes["MouthSmileRight"]/2.0) -
343+
(this.nativeBlendshapes["MouthFrownLeft"]+this.nativeBlendshapes["MouthFrownRight"]/2.0),
344+
0, 2
345+
)
346+
) / 2.0;
347+
}
316348
}
317349
}
318350
}

0 commit comments

Comments
 (0)