metamaker-for-three 0.1.18 → 0.1.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -433,12 +433,15 @@ async function replaceIdol(opts: string | Uint8Array) {
433
433
  idol = await MMFT.core.parseGLTFModel(idolBuffer.buffer);
434
434
  } else {
435
435
  idol = await MMFT.core.parseGLTFModel(opts.buffer);
436
+ idol.scale.x = 5;
437
+ idol.scale.y = 5;
438
+ idol.scale.z = 5;
436
439
  }
437
440
  // MMFT.ClothPhysics.ClothPhysicManagerInstance.setClothPhysics(idol);
438
441
 
439
442
  // idol.traverse((child) => {
440
443
  // if (child.type == "Mesh" || child.type == "SkinnedMesh") {
441
-
444
+
442
445
  // const anyTing: any = child;
443
446
  // anyTing.material.envMapIntensity = 0.3;
444
447
  // anyTing.material.needsUpdate = true;
@@ -522,9 +525,10 @@ async function handleTTS(audio, teeth, emo) {
522
525
  */
523
526
  async function fetchTTSToAnim(text: string) {
524
527
  const tts = {
525
- voice_name: "zh-CN-XiaoxiaoNeural",
526
- speed: 42,
527
- volume: 100,
528
+ speed: 50,
529
+ volume: 50,
530
+ anim_agent: "mms",
531
+ voice_name: "zh-CN-YunyangNeural",
528
532
  };
529
533
  let response: any = await fetch("//open.metamaker.cn/api/openmm/v1/text_to_anim", {
530
534
  method: "post",
@@ -711,3 +715,5 @@ makeSignCode();
711
715
  setInterval(() => {
712
716
  makeSignCode();
713
717
  }, 60 * 1000 * 10);
718
+
719
+ MMFT.Env.TTSAnimationRatio = 1.5;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "metamaker-for-three",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "main": "libs/metamaker-for-three.js",
5
5
  "types": "types/index.d.ts",
6
6
  "scripts": {
package/src/lib/Env.ts ADDED
@@ -0,0 +1,6 @@
1
+ const Env = {
2
+ TTSAnimationRatio: 0.65,
3
+ AnimationURL: `//img.metamaker.cn/webgl/app`,
4
+ };
5
+
6
+ export default Env;
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable */
2
2
  import * as THREE from "three";
3
3
  import cloneDeep from "lodash-es/cloneDeep";
4
+ import Env from './../../Env'
4
5
  let bodyMorphTargetDictionary = {};
5
6
  let teethMorphTargetDictionary = {};
6
7
  export let bodyMeshName;
@@ -213,7 +214,7 @@ export default function Convert(fp, isEmotion = false) {
213
214
  "]";
214
215
  const keys = element["Keys"] as Array<JSON>;
215
216
  const times = keys.map((k) => k["Time"] as number);
216
- const values = keys.map((k) => ((k["Value"] as number) / 100) * 0.65);
217
+ const values = keys.map((k) => ((k["Value"] as number) / 100) * Env.TTSAnimationRatio);
217
218
  const track = new THREE.KeyframeTrack(trackName, times, values);
218
219
  kfs.push(track);
219
220
  if (beardName.length) {
@@ -244,7 +245,7 @@ export default function Convert(fp, isEmotion = false) {
244
245
  "]";
245
246
  const keys = element["Keys"] as Array<JSON>;
246
247
  const times = keys.map((k) => k["Time"] as number);
247
- const values = keys.map((k) => ((k["Value"] as number) / 100) * 0.65);
248
+ const values = keys.map((k) => ((k["Value"] as number) / 100) * Env.TTSAnimationRatio);
248
249
  const track = new THREE.KeyframeTrack(trackName, times, values);
249
250
  kfs.push(track);
250
251
  }
@@ -4,7 +4,12 @@ import * as fflate from "fflate";
4
4
  import { getSuffixName, largeUint8ArrayToString } from ".";
5
5
  import cryptoModule from "./metacrypto.js";
6
6
  import { loadGLTFAnimation } from "..";
7
- export async function downloadAnimation(animationName, geometryName, ratio = 0.65) {
7
+ import Env from "../../Env";
8
+ export async function downloadAnimation(
9
+ animationName,
10
+ geometryName,
11
+ ratio = Env.TTSAnimationRatio
12
+ ) {
8
13
  let arraybuffer: ArrayBuffer;
9
14
  // eslint-disable-next-line prefer-const
10
15
  arraybuffer = (await downloadData(animationName, "arraybuffer")) as ArrayBuffer;
@@ -69,7 +74,7 @@ export async function downloadAnimation(animationName, geometryName, ratio = 0.6
69
74
  */
70
75
  export const loadAnimationData = async function (
71
76
  animateName: string,
72
- baseUrl = "//img.metamaker.cn/webgl/app"
77
+ baseUrl = Env.AnimationURL
73
78
  ): Promise<object> {
74
79
  let url: string;
75
80
  if (!animateName) {
@@ -84,7 +89,7 @@ export const loadAnimationData = async function (
84
89
  let ret;
85
90
  const result = (await downloadData(url, "arraybuffer")) as ArrayBuffer;
86
91
  const buffer = new Uint8Array(result) as Uint8Array;
87
- let fileBuffer:number[] | Uint8Array = await new Promise((resolve) => {
92
+ let fileBuffer: number[] | Uint8Array = await new Promise((resolve) => {
88
93
  const unzipper = new fflate.Unzip();
89
94
  unzipper.register(fflate.UnzipInflate);
90
95
  unzipper.onfile = (file) => {
@@ -107,7 +112,7 @@ export const loadAnimationData = async function (
107
112
  unzipper.push(buffer, true);
108
113
  });
109
114
 
110
- fileBuffer = new Uint8Array(fileBuffer as any) as Uint8Array;
115
+ fileBuffer = new Uint8Array(fileBuffer as any) as Uint8Array;
111
116
 
112
117
  let s = await largeUint8ArrayToString(fileBuffer);
113
118
 
package/src/lib/index.ts CHANGED
@@ -1,10 +1,12 @@
1
1
  import * as core from "./core";
2
2
  import sign from "./sign/index";
3
3
  import * as ClothPhysics from "./core/utils/ClothPhysics";
4
+ import Env from "./Env";
4
5
  const MMFT = {
5
6
  core,
6
7
  ClothPhysics,
7
8
  sign,
9
+ Env,
8
10
  };
9
11
 
10
12
  export default MMFT;