lythreeframe 1.1.12 → 1.1.13

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,11 @@ const DefaultPostProcessParam = {
1250
1250
 
1251
1251
  class World {
1252
1252
  get scene() {
1253
- return this.rootActor.scene;
1253
+ let scene = this.rootActor.scene;
1254
+ if (!scene) {
1255
+ throw new Error("scene is null");
1256
+ }
1257
+ return scene;
1254
1258
  }
1255
1259
  get viewport() {
1256
1260
  return this.app.viewport;
@@ -1259,12 +1263,14 @@ class World {
1259
1263
  return this.app.controller;
1260
1264
  }
1261
1265
  constructor(app, worldParam) {
1266
+ this.rootActor = null;
1262
1267
  this.actors = new Set();
1263
1268
  this.tickableActors = new Set();
1264
1269
  this.app = app;
1265
- this.rootActor = new worldParam.levelActorClass(app);
1270
+ this.worldParam = worldParam;
1266
1271
  }
1267
1272
  init() {
1273
+ this.rootActor = new this.worldParam.levelActorClass(this.app);
1268
1274
  }
1269
1275
  addTickableActor(actor) {
1270
1276
  this.tickableActors.add(actor);
@@ -1278,6 +1284,7 @@ class World {
1278
1284
  });
1279
1285
  }
1280
1286
  destroy() {
1287
+ this.tickableActors.clear();
1281
1288
  this.actors.forEach((elem) => {
1282
1289
  elem.destroy();
1283
1290
  });
@@ -1248,7 +1248,11 @@ const DefaultPostProcessParam = {
1248
1248
 
1249
1249
  class World {
1250
1250
  get scene() {
1251
- return this.rootActor.scene;
1251
+ let scene = this.rootActor.scene;
1252
+ if (!scene) {
1253
+ throw new Error("scene is null");
1254
+ }
1255
+ return scene;
1252
1256
  }
1253
1257
  get viewport() {
1254
1258
  return this.app.viewport;
@@ -1257,12 +1261,14 @@ class World {
1257
1261
  return this.app.controller;
1258
1262
  }
1259
1263
  constructor(app, worldParam) {
1264
+ this.rootActor = null;
1260
1265
  this.actors = new Set();
1261
1266
  this.tickableActors = new Set();
1262
1267
  this.app = app;
1263
- this.rootActor = new worldParam.levelActorClass(app);
1268
+ this.worldParam = worldParam;
1264
1269
  }
1265
1270
  init() {
1271
+ this.rootActor = new this.worldParam.levelActorClass(this.app);
1266
1272
  }
1267
1273
  addTickableActor(actor) {
1268
1274
  this.tickableActors.add(actor);
@@ -1276,6 +1282,7 @@ class World {
1276
1282
  });
1277
1283
  }
1278
1284
  destroy() {
1285
+ this.tickableActors.clear();
1279
1286
  this.actors.forEach((elem) => {
1280
1287
  elem.destroy();
1281
1288
  });
@@ -9,10 +9,11 @@ export declare class World {
9
9
  get scene(): Scene;
10
10
  get viewport(): Viewport;
11
11
  get controller(): Controller;
12
- protected rootActor: LevelActor;
12
+ protected rootActor: LevelActor | null;
13
13
  protected app: ThreeJsApp;
14
14
  protected actors: Set<Actor>;
15
15
  protected tickableActors: Set<Actor>;
16
+ protected worldParam: WorldParam;
16
17
  constructor(app: ThreeJsApp, worldParam: WorldParam);
17
18
  init(): void;
18
19
  addTickableActor(actor: Actor): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lythreeframe",
3
- "version": "1.1.12",
3
+ "version": "1.1.13",
4
4
  "description": "Three.js 封装",
5
5
  "main": "dist/bundle.cjs.js",
6
6
  "module": "dist/bundle.esm.js",