three-base 2.0.29 → 2.0.31
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.
- package/MeshBase.js +9 -2
- package/MeshBase.ts +7 -1
- package/package.json +1 -1
package/MeshBase.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnimationMixer, Clock, Group, Object3D, Vector3 } from "three";
|
|
1
|
+
import { AnimationMixer, Clock, Group, Mesh, Object3D, Vector3 } from "three";
|
|
2
2
|
import threeUtils from "./threeUtils";
|
|
3
3
|
import threeLoader from "./threeLoader";
|
|
4
4
|
import * as SkeletonUtils from 'three/examples/jsm/utils/SkeletonUtils';
|
|
@@ -45,6 +45,13 @@ export default class MeshBase extends Group {
|
|
|
45
45
|
console.error(`${url},加载失败`);
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
+
else if (/\.stl$/i.test(url)) {
|
|
49
|
+
await threeLoader.stlLoader.loadAsync(url).then(stlGeo => {
|
|
50
|
+
modal = new Mesh(stlGeo);
|
|
51
|
+
}).catch(() => {
|
|
52
|
+
console.error(`${url},加载失败`);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
48
55
|
else {
|
|
49
56
|
console.error(`${url},不支持的格式`);
|
|
50
57
|
}
|
|
@@ -75,7 +82,7 @@ export default class MeshBase extends Group {
|
|
|
75
82
|
this.add(model);
|
|
76
83
|
}
|
|
77
84
|
else {
|
|
78
|
-
this.add(mesh);
|
|
85
|
+
this.add(mesh.clone(true));
|
|
79
86
|
}
|
|
80
87
|
}
|
|
81
88
|
await new Promise(resolve => requestAnimationFrame(resolve));
|
package/MeshBase.ts
CHANGED
|
@@ -56,6 +56,12 @@ export default class MeshBase extends Group {
|
|
|
56
56
|
}).catch(() => {
|
|
57
57
|
console.error(`${url},加载失败`);
|
|
58
58
|
})
|
|
59
|
+
} else if (/\.stl$/i.test(url)) {
|
|
60
|
+
await threeLoader.stlLoader.loadAsync(url).then(stlGeo => {
|
|
61
|
+
modal = new Mesh(stlGeo);
|
|
62
|
+
}).catch(() => {
|
|
63
|
+
console.error(`${url},加载失败`);
|
|
64
|
+
})
|
|
59
65
|
} else {
|
|
60
66
|
console.error(`${url},不支持的格式`);
|
|
61
67
|
}
|
|
@@ -93,7 +99,7 @@ export default class MeshBase extends Group {
|
|
|
93
99
|
|
|
94
100
|
this.add(model);
|
|
95
101
|
} else {
|
|
96
|
-
this.add(mesh);
|
|
102
|
+
this.add(mesh.clone(true));
|
|
97
103
|
}
|
|
98
104
|
|
|
99
105
|
}
|