lythreeframe 1.2.5 → 1.2.7

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.
@@ -91,11 +91,17 @@ class Component extends BaseObject {
91
91
  this._parentActor = null;
92
92
  this._name = "Component";
93
93
  this._parentActor = null;
94
- this.threeObject = this.createDefaultObject();
95
- this._name = `${this.threeObject.type}Component`;
94
+ let obj = this.createDefaultObject();
95
+ if (obj) {
96
+ this.threeObject = obj;
97
+ this._name = `${this.threeObject.type}Component`;
98
+ }
99
+ else {
100
+ console.warn("Component createDefaultObject return null");
101
+ }
96
102
  }
97
103
  createDefaultObject(_arg) {
98
- return new webgpu.Object3D();
104
+ return null;
99
105
  }
100
106
  destroyObject() {
101
107
  if (!this.obj) {
@@ -2818,13 +2824,15 @@ class ThreeJsApp {
2818
2824
  this.viewport.renderer.setAnimationLoop(() => {
2819
2825
  this.tick();
2820
2826
  });
2821
- this.init();
2827
+ this.postConstruct();
2822
2828
  }
2823
- init() {
2829
+ postConstruct() {
2824
2830
  this.controller.init();
2825
2831
  this.world.init();
2826
2832
  this.viewport.init();
2827
2833
  }
2834
+ init() {
2835
+ }
2828
2836
  tick() {
2829
2837
  const delta = this._clock.getDelta();
2830
2838
  this._controller.tick(delta);
@@ -89,11 +89,17 @@ class Component extends BaseObject {
89
89
  this._parentActor = null;
90
90
  this._name = "Component";
91
91
  this._parentActor = null;
92
- this.threeObject = this.createDefaultObject();
93
- this._name = `${this.threeObject.type}Component`;
92
+ let obj = this.createDefaultObject();
93
+ if (obj) {
94
+ this.threeObject = obj;
95
+ this._name = `${this.threeObject.type}Component`;
96
+ }
97
+ else {
98
+ console.warn("Component createDefaultObject return null");
99
+ }
94
100
  }
95
101
  createDefaultObject(_arg) {
96
- return new Object3D();
102
+ return null;
97
103
  }
98
104
  destroyObject() {
99
105
  if (!this.obj) {
@@ -2816,13 +2822,15 @@ class ThreeJsApp {
2816
2822
  this.viewport.renderer.setAnimationLoop(() => {
2817
2823
  this.tick();
2818
2824
  });
2819
- this.init();
2825
+ this.postConstruct();
2820
2826
  }
2821
- init() {
2827
+ postConstruct() {
2822
2828
  this.controller.init();
2823
2829
  this.world.init();
2824
2830
  this.viewport.init();
2825
2831
  }
2832
+ init() {
2833
+ }
2826
2834
  tick() {
2827
2835
  const delta = this._clock.getDelta();
2828
2836
  this._controller.tick(delta);
@@ -12,7 +12,7 @@ export declare abstract class Component extends BaseObject {
12
12
  protected _parentActor: Actor | null;
13
13
  protected _name: string;
14
14
  protected constructor(uuid?: string);
15
- protected createDefaultObject(_arg?: any): Object3D;
15
+ protected createDefaultObject(_arg?: any): Object3D | null;
16
16
  destroyObject(): void;
17
17
  destroy(): void;
18
18
  }
@@ -24,6 +24,7 @@ export declare class ThreeJsApp {
24
24
  get onCameraChangedDelegate(): Delegate<[void]>;
25
25
  protected _onCameraChangedDelegate: Delegate<[void]>;
26
26
  constructor(appParam?: AppParam);
27
+ protected postConstruct(): void;
27
28
  init(): void;
28
29
  tick(): void;
29
30
  destroy(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lythreeframe",
3
- "version": "1.2.5",
3
+ "version": "1.2.7",
4
4
  "description": "Three.js 封装",
5
5
  "main": "dist/bundle.cjs.js",
6
6
  "module": "dist/bundle.esm.js",