lythreeframe 1.0.35 → 1.0.37
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/bundle.cjs.js
CHANGED
|
@@ -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,16 +697,19 @@ class MeshComponent extends SceneComponent {
|
|
|
699
697
|
this._geometryPtr = null;
|
|
700
698
|
}
|
|
701
699
|
this._geometryPtr = geo;
|
|
702
|
-
|
|
703
|
-
|
|
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
|
-
|
|
708
|
+
let mat = elem.getValue();
|
|
709
|
+
if (mat)
|
|
710
|
+
mats.push(mat);
|
|
710
711
|
});
|
|
711
|
-
return mats;
|
|
712
|
+
return mats.length > 1 ? mats : mats[0];
|
|
712
713
|
}
|
|
713
714
|
get materialPtr() {
|
|
714
715
|
return this.materialPtr;
|
|
@@ -731,13 +732,16 @@ class MeshComponent extends SceneComponent {
|
|
|
731
732
|
this._materialPtr = [];
|
|
732
733
|
}
|
|
733
734
|
let matPtrs = Array.isArray(newMat) ? newMat : [newMat];
|
|
734
|
-
let mats =
|
|
735
|
+
let mats = [];
|
|
735
736
|
matPtrs.forEach((elem) => {
|
|
736
|
-
|
|
737
|
+
let mat = elem.getValue();
|
|
738
|
+
if (mat)
|
|
739
|
+
mats.push(mat);
|
|
737
740
|
elem.addRef();
|
|
738
741
|
});
|
|
739
742
|
if (this.threeObject) {
|
|
740
|
-
|
|
743
|
+
if (mats.length > 0)
|
|
744
|
+
this.threeObject.material = Array.isArray(newMat) ? mats[0] : mats;
|
|
741
745
|
}
|
|
742
746
|
this._materialPtr = matPtrs;
|
|
743
747
|
}
|
|
@@ -749,7 +753,7 @@ class MeshComponent extends SceneComponent {
|
|
|
749
753
|
if (ptr)
|
|
750
754
|
matPtrs.push(ptr);
|
|
751
755
|
});
|
|
752
|
-
let newMesh = new webgpu.Mesh(geometry,
|
|
756
|
+
let newMesh = new webgpu.Mesh(geometry, material);
|
|
753
757
|
super(app, newMesh);
|
|
754
758
|
this.obj = null;
|
|
755
759
|
this._geometryPtr = app.assetManager.addGeometryAsset(geometry);
|
|
@@ -795,10 +799,11 @@ class MeshComponent extends SceneComponent {
|
|
|
795
799
|
return ret;
|
|
796
800
|
}
|
|
797
801
|
destroyObject() {
|
|
802
|
+
var _a;
|
|
798
803
|
if (this.threeObject) {
|
|
799
804
|
this.threeObject.removeFromParent();
|
|
800
805
|
}
|
|
801
|
-
this._geometryPtr.release();
|
|
806
|
+
(_a = this._geometryPtr) === null || _a === void 0 ? void 0 : _a.release();
|
|
802
807
|
let matPtrs = Array.isArray(this._materialPtr) ? this._materialPtr : [this._materialPtr];
|
|
803
808
|
matPtrs.forEach((elem) => {
|
|
804
809
|
elem.release();
|
package/dist/bundle.esm.js
CHANGED
|
@@ -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,16 +695,19 @@ class MeshComponent extends SceneComponent {
|
|
|
697
695
|
this._geometryPtr = null;
|
|
698
696
|
}
|
|
699
697
|
this._geometryPtr = geo;
|
|
700
|
-
|
|
701
|
-
|
|
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
|
-
|
|
706
|
+
let mat = elem.getValue();
|
|
707
|
+
if (mat)
|
|
708
|
+
mats.push(mat);
|
|
708
709
|
});
|
|
709
|
-
return mats;
|
|
710
|
+
return mats.length > 1 ? mats : mats[0];
|
|
710
711
|
}
|
|
711
712
|
get materialPtr() {
|
|
712
713
|
return this.materialPtr;
|
|
@@ -729,13 +730,16 @@ class MeshComponent extends SceneComponent {
|
|
|
729
730
|
this._materialPtr = [];
|
|
730
731
|
}
|
|
731
732
|
let matPtrs = Array.isArray(newMat) ? newMat : [newMat];
|
|
732
|
-
let mats =
|
|
733
|
+
let mats = [];
|
|
733
734
|
matPtrs.forEach((elem) => {
|
|
734
|
-
|
|
735
|
+
let mat = elem.getValue();
|
|
736
|
+
if (mat)
|
|
737
|
+
mats.push(mat);
|
|
735
738
|
elem.addRef();
|
|
736
739
|
});
|
|
737
740
|
if (this.threeObject) {
|
|
738
|
-
|
|
741
|
+
if (mats.length > 0)
|
|
742
|
+
this.threeObject.material = Array.isArray(newMat) ? mats[0] : mats;
|
|
739
743
|
}
|
|
740
744
|
this._materialPtr = matPtrs;
|
|
741
745
|
}
|
|
@@ -747,7 +751,7 @@ class MeshComponent extends SceneComponent {
|
|
|
747
751
|
if (ptr)
|
|
748
752
|
matPtrs.push(ptr);
|
|
749
753
|
});
|
|
750
|
-
let newMesh = new Mesh(geometry,
|
|
754
|
+
let newMesh = new Mesh(geometry, material);
|
|
751
755
|
super(app, newMesh);
|
|
752
756
|
this.obj = null;
|
|
753
757
|
this._geometryPtr = app.assetManager.addGeometryAsset(geometry);
|
|
@@ -793,10 +797,11 @@ class MeshComponent extends SceneComponent {
|
|
|
793
797
|
return ret;
|
|
794
798
|
}
|
|
795
799
|
destroyObject() {
|
|
800
|
+
var _a;
|
|
796
801
|
if (this.threeObject) {
|
|
797
802
|
this.threeObject.removeFromParent();
|
|
798
803
|
}
|
|
799
|
-
this._geometryPtr.release();
|
|
804
|
+
(_a = this._geometryPtr) === null || _a === void 0 ? void 0 : _a.release();
|
|
800
805
|
let matPtrs = Array.isArray(this._materialPtr) ? this._materialPtr : [this._materialPtr];
|
|
801
806
|
matPtrs.forEach((elem) => {
|
|
802
807
|
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 {
|
|
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);
|
|
@@ -10,7 +10,7 @@ export declare class MeshComponent extends SceneComponent {
|
|
|
10
10
|
set geometry(geo: BufferGeometry);
|
|
11
11
|
get geometryPtr(): TAssetPointer<BufferGeometry>;
|
|
12
12
|
set geometryPtr(geo: TAssetPointer<BufferGeometry>);
|
|
13
|
-
get material(): Material[];
|
|
13
|
+
get material(): Material | Material[];
|
|
14
14
|
get materialPtr(): TAssetPointer<Material>[];
|
|
15
15
|
set material(newMat: Material | Material[]);
|
|
16
16
|
set materialPtr(newMat: TAssetPointer<Material> | TAssetPointer<Material>[]);
|