three-base 2.0.46 → 2.0.48

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/ThreeBase.js CHANGED
@@ -405,7 +405,7 @@ export default class ThreeBase extends EventDispatcher {
405
405
  this.renderer.render(this.scene, camera);
406
406
  if (has_stroke_or_pass) {
407
407
  // 查找需要绘制描边的对象,并且绘制描边
408
- this.scene.traverse(obj => {
408
+ this.scene.traverseVisible(obj => {
409
409
  stroke_pass(this.renderer, camera, obj, this.baseDepthTexture);
410
410
  glow_pass(this.renderer, camera, obj, this.baseDepthTexture);
411
411
  });
package/ThreeBase.ts CHANGED
@@ -488,7 +488,7 @@ export default class ThreeBase extends EventDispatcher {
488
488
 
489
489
  if (has_stroke_or_pass) {
490
490
  // 查找需要绘制描边的对象,并且绘制描边
491
- this.scene.traverse(obj => {
491
+ this.scene.traverseVisible(obj => {
492
492
  stroke_pass(this.renderer, camera, obj, this.baseDepthTexture);
493
493
  glow_pass(this.renderer, camera, obj, this.baseDepthTexture);
494
494
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "three-base",
3
- "version": "2.0.46",
3
+ "version": "2.0.48",
4
4
  "description": "three 3d three-base",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
package/pass/glow_pass.js CHANGED
@@ -467,7 +467,7 @@ const scene = new Scene();
467
467
  // 对象发光
468
468
  export default function glow_pass(renderer, camera, object3d, baseDepthTexture) {
469
469
  const { glow_enable = false, glow_color = "#04fa12", glow_width = 1, glow_opacity = 1 } = object3d.userData;
470
- if (!glow_enable || glow_width === 0 || !object3d.visible) {
470
+ if (!glow_enable || glow_width === 0) {
471
471
  return;
472
472
  }
473
473
  // 保存原帧缓冲区
package/pass/glow_pass.ts CHANGED
@@ -486,7 +486,7 @@ export default function glow_pass(renderer: WebGLRenderer, camera: Camera, objec
486
486
 
487
487
  const { glow_enable = false, glow_color = "#04fa12", glow_width = 1, glow_opacity = 1 } = object3d.userData;
488
488
 
489
- if (!glow_enable || glow_width === 0 || !object3d.visible) {
489
+ if (!glow_enable || glow_width === 0) {
490
490
  return;
491
491
  }
492
492
 
@@ -463,7 +463,7 @@ const scene = new Scene();
463
463
  // 对象描边
464
464
  export default function stroke_pass(renderer, camera, object3d, baseDepthTexture) {
465
465
  const { stroke_enable = false, stroke_color = "#04fa12", stroke_width = 1 } = object3d.userData;
466
- if (!stroke_enable || stroke_width === 0 || !object3d.visible) {
466
+ if (!stroke_enable || stroke_width === 0) {
467
467
  return;
468
468
  }
469
469
  // 保存原帧缓冲区
@@ -480,7 +480,7 @@ const scene = new Scene();
480
480
  export default function stroke_pass(renderer: WebGLRenderer, camera: Camera, object3d: Object3D, baseDepthTexture: DepthTexture) {
481
481
 
482
482
  const { stroke_enable = false, stroke_color = "#04fa12", stroke_width = 1 } = object3d.userData;
483
- if (!stroke_enable || stroke_width === 0 || !object3d.visible) {
483
+ if (!stroke_enable || stroke_width === 0) {
484
484
  return;
485
485
  }
486
486
 
package/threeUtils.js CHANGED
@@ -116,7 +116,7 @@ class ThreeUtils extends EventDispatcher {
116
116
  object3d.computeBoundingBox();
117
117
  object3d.boundingBox.getCenter(this._center);
118
118
  }
119
- return this._center;
119
+ return this._center.clone();
120
120
  }
121
121
  // 获取模型大小
122
122
  getSize(object3d) {
@@ -128,7 +128,7 @@ class ThreeUtils extends EventDispatcher {
128
128
  object3d.computeBoundingBox();
129
129
  object3d.boundingBox.getSize(this._size);
130
130
  }
131
- return this._size;
131
+ return this._size.clone();
132
132
  }
133
133
  // 模型对齐底面
134
134
  alignBottom(object3d, y = 0) {
package/threeUtils.ts CHANGED
@@ -139,7 +139,7 @@ class ThreeUtils extends EventDispatcher {
139
139
  (object3d as BufferGeometry).boundingBox!.getCenter(this._center);
140
140
  }
141
141
 
142
- return this._center;
142
+ return this._center.clone();
143
143
  }
144
144
 
145
145
  // 获取模型大小
@@ -152,7 +152,7 @@ class ThreeUtils extends EventDispatcher {
152
152
  (object3d as BufferGeometry).boundingBox!.getSize(this._size);
153
153
  }
154
154
 
155
- return this._size;
155
+ return this._size.clone();
156
156
  }
157
157
 
158
158
  // 模型对齐底面