three-base 1.0.32 → 1.0.34

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/README.md CHANGED
@@ -87,3 +87,6 @@ homeRenderer.setContainer( document.getElementById("div") );
87
87
 
88
88
 
89
89
  ```
90
+
91
+ git仓库地址: https://gitee.com/drm/three-base;
92
+ demo仓库地址: https://gitee.com/drm/vite_react_mobx_threebase
package/index.ts CHANGED
@@ -7,6 +7,7 @@ export { default as EventMesh } from "./lib/EventMesh";
7
7
  // 挤出模型
8
8
  export { default as ExtrudeMesh } from "./lib/ExtrudeMesh";
9
9
  export type { ExtrudePath } from "./lib/ExtrudeMesh";
10
+ export type { ExtrudeMeshProps } from "./lib/ExtrudeMesh";
10
11
 
11
12
 
12
13
  // 关键帧动画对象
@@ -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
- 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
- }
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "three-base",
3
- "version": "1.0.32",
3
+ "version": "1.0.34",
4
4
  "description": "three 3d three-base",
5
5
  "keywords": [
6
6
  "three",