lythreeframe 1.1.13 → 1.1.15

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.
@@ -1250,7 +1250,8 @@ const DefaultPostProcessParam = {
1250
1250
 
1251
1251
  class World {
1252
1252
  get scene() {
1253
- let scene = this.rootActor.scene;
1253
+ var _a;
1254
+ let scene = (_a = this.rootActor) === null || _a === void 0 ? void 0 : _a.scene;
1254
1255
  if (!scene) {
1255
1256
  throw new Error("scene is null");
1256
1257
  }
@@ -1284,19 +1285,22 @@ class World {
1284
1285
  });
1285
1286
  }
1286
1287
  destroy() {
1288
+ var _a;
1287
1289
  this.tickableActors.clear();
1288
1290
  this.actors.forEach((elem) => {
1289
1291
  elem.destroy();
1290
1292
  });
1291
1293
  this.actors.clear();
1292
- this.rootActor.destroy();
1294
+ (_a = this.rootActor) === null || _a === void 0 ? void 0 : _a.destroy();
1295
+ this.rootActor = null;
1293
1296
  }
1294
1297
  addActor(actor) {
1298
+ var _a;
1295
1299
  if (!actor.rootComponent.threeObject) {
1296
1300
  throw new Error("actor.threeObject is null");
1297
1301
  }
1298
1302
  actor.removeFromParent();
1299
- this.rootActor.addChildActor(actor);
1303
+ (_a = this.rootActor) === null || _a === void 0 ? void 0 : _a.addChildActor(actor, exports.AttachmentRules.KeepRelative);
1300
1304
  this.actors.add(actor);
1301
1305
  actor.onAddedToWorld(this);
1302
1306
  this.viewport.markRenderStateDirty();
@@ -1554,9 +1558,9 @@ class Viewport {
1554
1558
  this.app.onCameraChangedDelegate.add(() => {
1555
1559
  this.setupPostProcess();
1556
1560
  });
1557
- this.setupPostProcess();
1558
1561
  }
1559
1562
  init() {
1563
+ this.setupPostProcess();
1560
1564
  }
1561
1565
  setupPostProcess() {
1562
1566
  if (this.postProcessParam.toneMapping) {
@@ -2071,6 +2075,8 @@ class Controller {
2071
2075
  this._pawn = new Orbital(this);
2072
2076
  this.pawn.possess();
2073
2077
  this.raycaster = new webgpu.Raycaster();
2078
+ }
2079
+ init() {
2074
2080
  if (this.viewPort.canvas) {
2075
2081
  this.viewPort.canvas.addEventListener("pointermove", this.onPointerMove);
2076
2082
  this.viewPort.canvas.addEventListener("pointerenter", this.onPointerEnter);
@@ -2079,8 +2085,6 @@ class Controller {
2079
2085
  this.viewPort.canvas.addEventListener("pointerdown", this.onPointerDown);
2080
2086
  }
2081
2087
  }
2082
- init() {
2083
- }
2084
2088
  tick(deltaTime) {
2085
2089
  this.pawn.tick(deltaTime);
2086
2090
  }
@@ -1248,7 +1248,8 @@ const DefaultPostProcessParam = {
1248
1248
 
1249
1249
  class World {
1250
1250
  get scene() {
1251
- let scene = this.rootActor.scene;
1251
+ var _a;
1252
+ let scene = (_a = this.rootActor) === null || _a === void 0 ? void 0 : _a.scene;
1252
1253
  if (!scene) {
1253
1254
  throw new Error("scene is null");
1254
1255
  }
@@ -1282,19 +1283,22 @@ class World {
1282
1283
  });
1283
1284
  }
1284
1285
  destroy() {
1286
+ var _a;
1285
1287
  this.tickableActors.clear();
1286
1288
  this.actors.forEach((elem) => {
1287
1289
  elem.destroy();
1288
1290
  });
1289
1291
  this.actors.clear();
1290
- this.rootActor.destroy();
1292
+ (_a = this.rootActor) === null || _a === void 0 ? void 0 : _a.destroy();
1293
+ this.rootActor = null;
1291
1294
  }
1292
1295
  addActor(actor) {
1296
+ var _a;
1293
1297
  if (!actor.rootComponent.threeObject) {
1294
1298
  throw new Error("actor.threeObject is null");
1295
1299
  }
1296
1300
  actor.removeFromParent();
1297
- this.rootActor.addChildActor(actor);
1301
+ (_a = this.rootActor) === null || _a === void 0 ? void 0 : _a.addChildActor(actor, AttachmentRules.KeepRelative);
1298
1302
  this.actors.add(actor);
1299
1303
  actor.onAddedToWorld(this);
1300
1304
  this.viewport.markRenderStateDirty();
@@ -1552,9 +1556,9 @@ class Viewport {
1552
1556
  this.app.onCameraChangedDelegate.add(() => {
1553
1557
  this.setupPostProcess();
1554
1558
  });
1555
- this.setupPostProcess();
1556
1559
  }
1557
1560
  init() {
1561
+ this.setupPostProcess();
1558
1562
  }
1559
1563
  setupPostProcess() {
1560
1564
  if (this.postProcessParam.toneMapping) {
@@ -2069,6 +2073,8 @@ class Controller {
2069
2073
  this._pawn = new Orbital(this);
2070
2074
  this.pawn.possess();
2071
2075
  this.raycaster = new Raycaster();
2076
+ }
2077
+ init() {
2072
2078
  if (this.viewPort.canvas) {
2073
2079
  this.viewPort.canvas.addEventListener("pointermove", this.onPointerMove);
2074
2080
  this.viewPort.canvas.addEventListener("pointerenter", this.onPointerEnter);
@@ -2077,8 +2083,6 @@ class Controller {
2077
2083
  this.viewPort.canvas.addEventListener("pointerdown", this.onPointerDown);
2078
2084
  }
2079
2085
  }
2080
- init() {
2081
- }
2082
2086
  tick(deltaTime) {
2083
2087
  this.pawn.tick(deltaTime);
2084
2088
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lythreeframe",
3
- "version": "1.1.13",
3
+ "version": "1.1.15",
4
4
  "description": "Three.js 封装",
5
5
  "main": "dist/bundle.cjs.js",
6
6
  "module": "dist/bundle.esm.js",