lythreeframe 1.0.35 → 1.0.36

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.
@@ -665,8 +665,6 @@ class SceneComponent extends Component {
665
665
  }
666
666
  }
667
667
 
668
- // import {BufferGeometry, Material, Mesh, Texture} from "three/webgpu";
669
- // import {Vector3} from "three/webgpu";
670
668
  class MeshComponent extends SceneComponent {
671
669
  get threeObject() {
672
670
  return this.obj;
@@ -699,14 +697,17 @@ class MeshComponent extends SceneComponent {
699
697
  this._geometryPtr = null;
700
698
  }
701
699
  this._geometryPtr = geo;
702
- if (this.threeObject) {
703
- this.threeObject.geometry = geo.getValue();
700
+ let geometry = geo.getValue();
701
+ if (this.threeObject && geometry) {
702
+ this.threeObject.geometry = geometry;
704
703
  }
705
704
  }
706
705
  get material() {
707
706
  let mats = [];
708
707
  this._materialPtr.forEach((elem) => {
709
- mats.push(elem.getValue());
708
+ let mat = elem.getValue();
709
+ if (mat)
710
+ mats.push(mat);
710
711
  });
711
712
  return mats;
712
713
  }
@@ -731,9 +732,11 @@ class MeshComponent extends SceneComponent {
731
732
  this._materialPtr = [];
732
733
  }
733
734
  let matPtrs = Array.isArray(newMat) ? newMat : [newMat];
734
- let mats = Array.isArray(newMat) ? newMat : [newMat];
735
+ let mats = [];
735
736
  matPtrs.forEach((elem) => {
736
- mats.push(elem.getValue());
737
+ let mat = elem.getValue();
738
+ if (mat)
739
+ mats.push(mat);
737
740
  elem.addRef();
738
741
  });
739
742
  if (this.threeObject) {
@@ -795,10 +798,11 @@ class MeshComponent extends SceneComponent {
795
798
  return ret;
796
799
  }
797
800
  destroyObject() {
801
+ var _a;
798
802
  if (this.threeObject) {
799
803
  this.threeObject.removeFromParent();
800
804
  }
801
- this._geometryPtr.release();
805
+ (_a = this._geometryPtr) === null || _a === void 0 ? void 0 : _a.release();
802
806
  let matPtrs = Array.isArray(this._materialPtr) ? this._materialPtr : [this._materialPtr];
803
807
  matPtrs.forEach((elem) => {
804
808
  elem.release();
@@ -663,8 +663,6 @@ class SceneComponent extends Component {
663
663
  }
664
664
  }
665
665
 
666
- // import {BufferGeometry, Material, Mesh, Texture} from "three/webgpu";
667
- // import {Vector3} from "three/webgpu";
668
666
  class MeshComponent extends SceneComponent {
669
667
  get threeObject() {
670
668
  return this.obj;
@@ -697,14 +695,17 @@ class MeshComponent extends SceneComponent {
697
695
  this._geometryPtr = null;
698
696
  }
699
697
  this._geometryPtr = geo;
700
- if (this.threeObject) {
701
- this.threeObject.geometry = geo.getValue();
698
+ let geometry = geo.getValue();
699
+ if (this.threeObject && geometry) {
700
+ this.threeObject.geometry = geometry;
702
701
  }
703
702
  }
704
703
  get material() {
705
704
  let mats = [];
706
705
  this._materialPtr.forEach((elem) => {
707
- mats.push(elem.getValue());
706
+ let mat = elem.getValue();
707
+ if (mat)
708
+ mats.push(mat);
708
709
  });
709
710
  return mats;
710
711
  }
@@ -729,9 +730,11 @@ class MeshComponent extends SceneComponent {
729
730
  this._materialPtr = [];
730
731
  }
731
732
  let matPtrs = Array.isArray(newMat) ? newMat : [newMat];
732
- let mats = Array.isArray(newMat) ? newMat : [newMat];
733
+ let mats = [];
733
734
  matPtrs.forEach((elem) => {
734
- mats.push(elem.getValue());
735
+ let mat = elem.getValue();
736
+ if (mat)
737
+ mats.push(mat);
735
738
  elem.addRef();
736
739
  });
737
740
  if (this.threeObject) {
@@ -793,10 +796,11 @@ class MeshComponent extends SceneComponent {
793
796
  return ret;
794
797
  }
795
798
  destroyObject() {
799
+ var _a;
796
800
  if (this.threeObject) {
797
801
  this.threeObject.removeFromParent();
798
802
  }
799
- this._geometryPtr.release();
803
+ (_a = this._geometryPtr) === null || _a === void 0 ? void 0 : _a.release();
800
804
  let matPtrs = Array.isArray(this._materialPtr) ? this._materialPtr : [this._materialPtr];
801
805
  matPtrs.forEach((elem) => {
802
806
  elem.release();
@@ -1,7 +1,7 @@
1
+ import { BufferGeometry, Material, Mesh, Vector3 } from "three/webgpu";
1
2
  import { SceneComponent } from "../SceneComponent";
2
- import { ThreeJsApp } from "@/lythreeframe/ThreeJsApp";
3
3
  import { TAssetPointer } from "@/lythreeframe/AssetManagement/AssetPointer/AssetPointer";
4
- import { BufferGeometry, Material, Mesh, Vector3 } from "three/webgpu";
4
+ import { ThreeJsApp } from "@/lythreeframe/ThreeJsApp";
5
5
  export declare class MeshComponent extends SceneComponent {
6
6
  get threeObject(): Mesh | null;
7
7
  set threeObject(newThreeObject: Mesh);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lythreeframe",
3
- "version": "1.0.35",
3
+ "version": "1.0.36",
4
4
  "description": "Three.js 封装",
5
5
  "main": "dist/bundle.cjs.js",
6
6
  "module": "dist/bundle.esm.js",