three-base 1.0.32 → 1.0.33
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/index.ts +1 -0
- package/lib/ExtrudeMesh.ts +13 -13
- package/lib/threeUtils.ts +13 -0
- package/package.json +1 -1
package/index.ts
CHANGED
package/lib/ExtrudeMesh.ts
CHANGED
|
@@ -50,8 +50,8 @@ export default class ExtrudeMesh extends Mesh<BufferGeometry, Material> {
|
|
|
50
50
|
static temp2Matrix4 = new Matrix4();
|
|
51
51
|
static temp3Matrix4 = new Matrix4();
|
|
52
52
|
|
|
53
|
-
constructor(props: ExtrudeMeshProps) {
|
|
54
|
-
super();
|
|
53
|
+
constructor(props: ExtrudeMeshProps, material?: Material) {
|
|
54
|
+
super(undefined, material);
|
|
55
55
|
this.updateGeometry(props);
|
|
56
56
|
}
|
|
57
57
|
|
|
@@ -361,17 +361,17 @@ export default class ExtrudeMesh extends Mesh<BufferGeometry, Material> {
|
|
|
361
361
|
});
|
|
362
362
|
|
|
363
363
|
// 清理圆角路径, 如果2个点相距0.001以内就删除一个点
|
|
364
|
-
for (let i = 0; i < this.pointerWidthRadius.length; i++) {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
}
|
|
364
|
+
// for (let i = 0; i < this.pointerWidthRadius.length; i++) {
|
|
365
|
+
// while (
|
|
366
|
+
// this.pointerWidthRadius[i] &&
|
|
367
|
+
// this.pointerWidthRadius[i + 1] &&
|
|
368
|
+
// this.computerPathLength(
|
|
369
|
+
// this.pointerWidthRadius.slice(i, i + 2).map(p => p.vector3)
|
|
370
|
+
// ) < 0.001
|
|
371
|
+
// ) {
|
|
372
|
+
// this.pointerWidthRadius.splice(i, 1);
|
|
373
|
+
// }
|
|
374
|
+
// }
|
|
375
375
|
}
|
|
376
376
|
|
|
377
377
|
// 计算三维路径的总长度
|
package/lib/threeUtils.ts
CHANGED
|
@@ -44,6 +44,19 @@ class ThreeUtils extends EventDispatcher {
|
|
|
44
44
|
}, 45 - this.clock.getDelta());
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
// 获取中心点
|
|
48
|
+
getCenter(object3d: Object3D | BufferGeometry) {
|
|
49
|
+
if (object3d instanceof Object3D) {
|
|
50
|
+
this.box3.setFromObject(object3d);
|
|
51
|
+
this.box3.getCenter(this.center);
|
|
52
|
+
} else if (object3d instanceof BufferGeometry) {
|
|
53
|
+
object3d.computeBoundingBox();
|
|
54
|
+
object3d.boundingBox!.getCenter(this.center);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return this.center;
|
|
58
|
+
}
|
|
59
|
+
|
|
47
60
|
// 获取模型大小
|
|
48
61
|
getSize(object3d: Object3D | BufferGeometry) {
|
|
49
62
|
if (object3d instanceof Object3D) {
|