soonspacejs 2.14.32 → 2.14.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/dist/index.esm.js CHANGED
@@ -24,7 +24,7 @@ import * as wi from "three/examples/jsm/utils/SkeletonUtils.js";
24
24
  import * as jc from "three/examples/jsm/libs/fflate.module.js";
25
25
  import { NURBSCurve as Uc } from "three/examples/jsm/curves/NURBSCurve.js";
26
26
  import { RectAreaLightHelper as Gc } from "three/examples/jsm/helpers/RectAreaLightHelper.js";
27
- const Vc = "soonspacejs", Hc = "2.14.32", bi = {
27
+ const Vc = "soonspacejs", Hc = "2.14.33", bi = {
28
28
  name: Vc,
29
29
  version: Hc
30
30
  }, wa = "[soonspacejs]: ";
@@ -7212,8 +7212,13 @@ function er(i) {
7212
7212
  }
7213
7213
  function od(i) {
7214
7214
  let e = i, t;
7215
- for (; e; )
7216
- e instanceof De && e.stype !== "BaseObject3D" && (e.stype !== "Group" || !t) && (t = e), e = e.parent;
7215
+ for (; e; ) {
7216
+ if (e instanceof De && e.stype !== "Group") {
7217
+ t = e;
7218
+ break;
7219
+ }
7220
+ e = e.parent;
7221
+ }
7217
7222
  return t;
7218
7223
  }
7219
7224
  function is(i, e) {
@@ -7771,6 +7776,30 @@ class ud {
7771
7776
  clearSignals() {
7772
7777
  for (const e in this.signals) this.signals[e].removeAll();
7773
7778
  }
7779
+ /**
7780
+ * 隔离显示对象 - 使用 Layers API 仅显示指定对象,隐藏场景中其他对象
7781
+ * @param objects 需要隔离显示的对象
7782
+ * @param layerChannel 使用的 layer 通道,默认 1(0 为默认通道)
7783
+ */
7784
+ isolate(e, t = 1) {
7785
+ const n = Array.isArray(e) ? e : [e], s = /* @__PURE__ */ new Set();
7786
+ for (const r of n)
7787
+ r.traverse((a) => {
7788
+ s.add(a);
7789
+ });
7790
+ this.scene.traverse((r) => {
7791
+ s.has(r) ? r.layers.enable(t) : r.layers.disable(0);
7792
+ }), this.camera.layers.disable(0), this.camera.layers.enable(t), this.render();
7793
+ }
7794
+ /**
7795
+ * 取消隔离 - 恢复场景中所有对象的可见性
7796
+ * @param layerChannel 之前隔离使用的 layer 通道,默认 1
7797
+ */
7798
+ unisolate(e = 1) {
7799
+ this.scene.traverse((t) => {
7800
+ t.layers.enable(0), t.layers.disable(e);
7801
+ }), this.camera.layers.enable(0), this.camera.layers.disable(e), this.render();
7802
+ }
7774
7803
  dispose() {
7775
7804
  cancelAnimationFrame(this._loop), this.bvh.dispose(), this.mixer.stopAllAction(), this.clipsSet.forEach((e) => {
7776
7805
  this.mixer.uncacheAction(e), this.mixer.uncacheClip(e);
@@ -8400,7 +8429,7 @@ class ho extends ze {
8400
8429
  opacity: a = 1,
8401
8430
  gradient: o
8402
8431
  } = e ?? {};
8403
- super(e), this.params = e, this.updateGeometry(n, s), this.updateMaterialOpacity(a), this.updateMaterial(r, o), this.stype = "Polygon", this.position.set(0, t, 0), this.rotation.set(-Math.PI / 2, 0, 0);
8432
+ super(e), this.params = e, this.updateGeometry(n, s), this.updateMaterialOpacity(a), this.updateMaterial(r, o), this.stype = "Polygon", this.position.set(0, t, 0), this.rotation.set(-Math.PI / 2, 0, 0), this.scale.setScalar(0.999);
8404
8433
  }
8405
8434
  updateGeometry(e, t) {
8406
8435
  this.geometry.dispose();
@@ -14357,6 +14386,21 @@ class If {
14357
14386
  unEmissiveShow(e) {
14358
14387
  return this.viewport.scener.unEmissiveShow(e);
14359
14388
  }
14389
+ /**
14390
+ * 隔离显示对象 - 使用 Layers API 仅显示指定对象,隐藏场景中其他对象
14391
+ * @param objects 需要隔离显示的对象
14392
+ * @param layerChannel 使用的 layer 通道,默认 1(0 为默认通道)
14393
+ */
14394
+ isolate(e, t = 1) {
14395
+ this.viewport.isolate(e, t);
14396
+ }
14397
+ /**
14398
+ * 取消隔离 - 恢复场景中所有对象的可见性
14399
+ * @param layerChannel 之前隔离使用的 layer 通道,默认 1
14400
+ */
14401
+ unisolate(e = 1) {
14402
+ this.viewport.unisolate(e);
14403
+ }
14360
14404
  /******/
14361
14405
  /******/
14362
14406
  /******* Manager methods */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soonspacejs",
3
- "version": "2.14.32",
3
+ "version": "2.14.33",
4
4
  "homepage": "https://www.xwbuilders.com/soonspacejs/",
5
5
  "description": "soonspacejs 2.x",
6
6
  "module": "./dist/index.esm.js",
@@ -1,4 +1,4 @@
1
- import { Mesh, Timer, Scene, PerspectiveCamera, WebGLRenderer, PMREMGenerator, Vector3, AnimationMixer, Raycaster, Intersection, AnimationClip, Texture, Material, OrthographicCamera } from 'three';
1
+ import { Mesh, Timer, Scene, PerspectiveCamera, WebGLRenderer, PMREMGenerator, Vector3, AnimationMixer, Raycaster, Intersection, AnimationClip, Texture, Material, OrthographicCamera, Object3D } from 'three';
2
2
  import { EffectComposer } from 'postprocessing';
3
3
  import { default as Stats } from 'three/examples/jsm/libs/stats.module.js';
4
4
  import { Sky } from 'three/examples/jsm/objects/Sky.js';
@@ -122,9 +122,20 @@ declare class Viewport {
122
122
  top: number;
123
123
  };
124
124
  getPositionByOffset(offset: OffsetPoint, z?: number, scalar?: number): Vector3;
125
- getIntersects(event: MouseEvent | TouchEvent | OffsetPoint, objects?: import('three').Object3D<import('three').Object3DEventMap>[], options?: IntersectsOptions): Intersection<import('three').Object3D<import('three').Object3DEventMap>>[];
126
- rayClash(startPoint?: Vector3, dir?: Vector3, objects?: Mesh<import('three').BufferGeometry<import('three').NormalBufferAttributes, import('three').BufferGeometryEventMap>, Material | Material[], import('three').Object3DEventMap>[]): Intersection<import('three').Object3D<import('three').Object3DEventMap>>[];
125
+ getIntersects(event: MouseEvent | TouchEvent | OffsetPoint, objects?: Object3D<import('three').Object3DEventMap>[], options?: IntersectsOptions): Intersection<Object3D<import('three').Object3DEventMap>>[];
126
+ rayClash(startPoint?: Vector3, dir?: Vector3, objects?: Mesh<import('three').BufferGeometry<import('three').NormalBufferAttributes, import('three').BufferGeometryEventMap>, Material | Material[], import('three').Object3DEventMap>[]): Intersection<Object3D<import('three').Object3DEventMap>>[];
127
127
  clearSignals(): void;
128
+ /**
129
+ * 隔离显示对象 - 使用 Layers API 仅显示指定对象,隐藏场景中其他对象
130
+ * @param objects 需要隔离显示的对象
131
+ * @param layerChannel 使用的 layer 通道,默认 1(0 为默认通道)
132
+ */
133
+ isolate(objects: Object3D | Object3D[], layerChannel?: number): void;
134
+ /**
135
+ * 取消隔离 - 恢复场景中所有对象的可见性
136
+ * @param layerChannel 之前隔离使用的 layer 通道,默认 1
137
+ */
138
+ unisolate(layerChannel?: number): void;
128
139
  dispose(): void;
129
140
  _signalsEventListenr(): void;
130
141
  }
package/types/index.d.ts CHANGED
@@ -407,6 +407,17 @@ declare class SoonSpace {
407
407
  * @param objects
408
408
  */
409
409
  unEmissiveShow(objects?: Object3D | Object3D[]): Promise<void | void[]>;
410
+ /**
411
+ * 隔离显示对象 - 使用 Layers API 仅显示指定对象,隐藏场景中其他对象
412
+ * @param objects 需要隔离显示的对象
413
+ * @param layerChannel 使用的 layer 通道,默认 1(0 为默认通道)
414
+ */
415
+ isolate(objects: Object3D | Object3D[], layerChannel?: number): void;
416
+ /**
417
+ * 取消隔离 - 恢复场景中所有对象的可见性
418
+ * @param layerChannel 之前隔离使用的 layer 通道,默认 1
419
+ */
420
+ unisolate(layerChannel?: number): void;
410
421
  /******/
411
422
  /******/
412
423
  /******* Manager methods */