lythreeframe 1.0.22 → 1.0.23
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 +104 -105
- package/dist/bundle.esm.js +1 -2
- package/dist/lythreeframe/AssetManagement/AssetManager.d.ts +1 -1
- package/dist/lythreeframe/AssetManagement/AssetPointer/AssetPointer.d.ts +1 -1
- package/dist/lythreeframe/Factory/CameraFactory.d.ts +2 -2
- package/dist/lythreeframe/Frame/Controller.d.ts +1 -1
- package/dist/lythreeframe/Frame/World.d.ts +1 -1
- package/dist/lythreeframe/Geometry/PlaneGeometry.d.ts +1 -1
- package/dist/lythreeframe/Geometry/TriangleGeometry.d.ts +1 -1
- package/dist/lythreeframe/Library/Math.d.ts +5 -5
- package/dist/lythreeframe/Library/ResourceLibrary.d.ts +1 -1
- package/dist/lythreeframe/Object/Actor.d.ts +5 -5
- package/dist/lythreeframe/Object/Actors/Light/DirectionalLightActor.d.ts +1 -1
- package/dist/lythreeframe/Object/Actors/Shape/BoxActor.d.ts +1 -1
- package/dist/lythreeframe/Object/Actors/Shape/PlaneActor.d.ts +1 -1
- package/dist/lythreeframe/Object/Actors/Sky/SkyActor.d.ts +8 -0
- package/dist/lythreeframe/Object/Components/2D/2DComponent.d.ts +1 -2
- package/dist/lythreeframe/Object/Components/Camera/CameraComponent.d.ts +1 -1
- package/dist/lythreeframe/Object/Components/Component.d.ts +1 -1
- package/dist/lythreeframe/Object/Components/Light/DirectionalLight/DirectionalLightComponent.d.ts +1 -1
- package/dist/lythreeframe/Object/Components/Light/LightComponent.d.ts +1 -1
- package/dist/lythreeframe/Object/Components/Mesh/InstanceMesh/InstanceMeshComponent.d.ts +1 -1
- package/dist/lythreeframe/Object/Components/Mesh/InstanceMesh/MultiInstanceMeshComponent.d.ts +1 -1
- package/dist/lythreeframe/Object/Components/Mesh/MeshComponent.d.ts +6 -7
- package/dist/lythreeframe/Object/Components/Mesh/Shape/BoxComponent.d.ts +1 -1
- package/dist/lythreeframe/Object/Components/Mesh/Shape/PlaneComponent.d.ts +1 -1
- package/dist/lythreeframe/Object/Components/Mesh/Shape/SphereComponent.d.ts +1 -2
- package/dist/lythreeframe/Object/Components/Mesh/Sprite/SpriteComponent.d.ts +1 -1
- package/dist/lythreeframe/Object/Components/SceneComponent.d.ts +13 -13
- package/dist/lythreeframe/Object/Components/Sky/SkyComponent.d.ts +20 -0
- package/dist/lythreeframe/Object/PawnV2/Oribital.d.ts +2 -2
- package/dist/lythreeframe/Object/PawnV2/Pawn.d.ts +2 -2
- package/dist/lythreeframe/Object/PawnV2/TransformControl.d.ts +1 -1
- package/dist/lythreeframe/PostProcess/Param/Outline.d.ts +1 -1
- package/dist/lythreeframe/PostProcess/Param/ToneMapping.d.ts +1 -1
- package/dist/lythreeframe/PostProcess/WebGPUPostProcessFactory.d.ts +1 -1
- package/dist/lythreeframe/ThreeJsApp.d.ts +1 -1
- package/package.json +5 -5
package/dist/bundle.cjs.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var webgpu = require('three/webgpu');
|
|
4
4
|
var Addons_js = require('three/examples/jsm/Addons.js');
|
|
5
5
|
var tsl = require('three/tsl');
|
|
6
|
-
var webgpu = require('three/webgpu');
|
|
7
6
|
var BloomNode_js = require('three/examples/jsm/tsl/display/BloomNode.js');
|
|
8
7
|
var DenoiseNode_js = require('three/examples/jsm/tsl/display/DenoiseNode.js');
|
|
9
8
|
var DepthOfFieldNode_js = require('three/examples/jsm/tsl/display/DepthOfFieldNode.js');
|
|
@@ -47,7 +46,7 @@ class BaseObject {
|
|
|
47
46
|
get uuid() {
|
|
48
47
|
return this._uuid;
|
|
49
48
|
}
|
|
50
|
-
constructor(uuid =
|
|
49
|
+
constructor(uuid = webgpu.MathUtils.generateUUID()) {
|
|
51
50
|
this.bCanTick = false;
|
|
52
51
|
this.bCanTick = false;
|
|
53
52
|
this._uuid = uuid;
|
|
@@ -132,7 +131,7 @@ class SceneComponent extends Component {
|
|
|
132
131
|
this._name = "SceneComponent";
|
|
133
132
|
}
|
|
134
133
|
createDefaultThreeObject() {
|
|
135
|
-
this.threeObject = new
|
|
134
|
+
this.threeObject = new webgpu.Group();
|
|
136
135
|
}
|
|
137
136
|
get isVisible() {
|
|
138
137
|
if (!this.threeObject) {
|
|
@@ -160,19 +159,19 @@ class SceneComponent extends Component {
|
|
|
160
159
|
});
|
|
161
160
|
}
|
|
162
161
|
getBoundsCenterPositionWS() {
|
|
163
|
-
let ret = new
|
|
162
|
+
let ret = new webgpu.Vector3();
|
|
164
163
|
this.getBounds().getCenter(ret);
|
|
165
164
|
return this.getWorldPosition();
|
|
166
165
|
}
|
|
167
166
|
getBoundsTopCenterPositionWS() {
|
|
168
|
-
let ret = new
|
|
167
|
+
let ret = new webgpu.Vector3();
|
|
169
168
|
let bounds = this.getBounds();
|
|
170
169
|
bounds.getCenter(ret);
|
|
171
170
|
ret.y = bounds.max.y;
|
|
172
171
|
return ret;
|
|
173
172
|
}
|
|
174
173
|
getBoundsBottomCenterPositionWS() {
|
|
175
|
-
let ret = new
|
|
174
|
+
let ret = new webgpu.Vector3();
|
|
176
175
|
let bounds = this.getBounds();
|
|
177
176
|
bounds.getCenter(ret);
|
|
178
177
|
ret.y = bounds.min.y;
|
|
@@ -182,7 +181,7 @@ class SceneComponent extends Component {
|
|
|
182
181
|
if (!this.threeObject) {
|
|
183
182
|
throw Error("threeObject is invalid");
|
|
184
183
|
}
|
|
185
|
-
let ret = new
|
|
184
|
+
let ret = new webgpu.Box3();
|
|
186
185
|
ret.setFromObject(this.threeObject, false);
|
|
187
186
|
if (ret.isEmpty()) {
|
|
188
187
|
ret.min = ret.max = this.getWorldPosition();
|
|
@@ -259,9 +258,9 @@ class SceneComponent extends Component {
|
|
|
259
258
|
return this.threeObject.position.clone();
|
|
260
259
|
}
|
|
261
260
|
else {
|
|
262
|
-
const position = new
|
|
263
|
-
const quaternion = new
|
|
264
|
-
const scale = new
|
|
261
|
+
const position = new webgpu.Vector3();
|
|
262
|
+
const quaternion = new webgpu.Quaternion();
|
|
263
|
+
const scale = new webgpu.Vector3();
|
|
265
264
|
this.threeObject.matrix.decompose(position, quaternion, scale);
|
|
266
265
|
return position;
|
|
267
266
|
}
|
|
@@ -271,14 +270,14 @@ class SceneComponent extends Component {
|
|
|
271
270
|
throw Error("threeObject is invalid");
|
|
272
271
|
}
|
|
273
272
|
let newPosition = null;
|
|
274
|
-
if (args.length === 1 && args[0] instanceof
|
|
275
|
-
newPosition = new
|
|
273
|
+
if (args.length === 1 && args[0] instanceof webgpu.Vector3) {
|
|
274
|
+
newPosition = new webgpu.Vector3().copy(args[0]);
|
|
276
275
|
}
|
|
277
276
|
else if (args.length === 3 &&
|
|
278
277
|
typeof args[0] === "number" &&
|
|
279
278
|
typeof args[1] === "number" &&
|
|
280
279
|
typeof args[2] === "number") {
|
|
281
|
-
newPosition = new
|
|
280
|
+
newPosition = new webgpu.Vector3(args[0], args[1], args[2]);
|
|
282
281
|
}
|
|
283
282
|
if (!newPosition) {
|
|
284
283
|
return;
|
|
@@ -302,11 +301,11 @@ class SceneComponent extends Component {
|
|
|
302
301
|
return this.threeObject.rotation.clone();
|
|
303
302
|
}
|
|
304
303
|
else {
|
|
305
|
-
const position = new
|
|
306
|
-
const quaternion = new
|
|
307
|
-
const scale = new
|
|
304
|
+
const position = new webgpu.Vector3();
|
|
305
|
+
const quaternion = new webgpu.Quaternion();
|
|
306
|
+
const scale = new webgpu.Vector3();
|
|
308
307
|
this.threeObject.matrix.decompose(position, quaternion, scale);
|
|
309
|
-
return new
|
|
308
|
+
return new webgpu.Euler().setFromQuaternion(quaternion);
|
|
310
309
|
}
|
|
311
310
|
}
|
|
312
311
|
setRotation(...args) {
|
|
@@ -314,11 +313,11 @@ class SceneComponent extends Component {
|
|
|
314
313
|
throw Error("threeObject is invalid");
|
|
315
314
|
}
|
|
316
315
|
let newRotation = null;
|
|
317
|
-
if (args[0] instanceof
|
|
318
|
-
newRotation = new
|
|
316
|
+
if (args[0] instanceof webgpu.Euler) {
|
|
317
|
+
newRotation = new webgpu.Euler().copy(args[0]);
|
|
319
318
|
}
|
|
320
319
|
if (typeof (args[0]) === "number" && typeof (args[1]) === "number" && typeof (args[2]) === "number") {
|
|
321
|
-
newRotation = new
|
|
320
|
+
newRotation = new webgpu.Euler(args[0], args[1], args[2]);
|
|
322
321
|
}
|
|
323
322
|
if (!newRotation) {
|
|
324
323
|
return;
|
|
@@ -339,9 +338,9 @@ class SceneComponent extends Component {
|
|
|
339
338
|
return this.threeObject.quaternion.clone();
|
|
340
339
|
}
|
|
341
340
|
else {
|
|
342
|
-
const position = new
|
|
343
|
-
const quaternion = new
|
|
344
|
-
const scale = new
|
|
341
|
+
const position = new webgpu.Vector3();
|
|
342
|
+
const quaternion = new webgpu.Quaternion();
|
|
343
|
+
const scale = new webgpu.Vector3();
|
|
345
344
|
this.threeObject.matrix.decompose(position, quaternion, scale);
|
|
346
345
|
return quaternion;
|
|
347
346
|
}
|
|
@@ -351,11 +350,11 @@ class SceneComponent extends Component {
|
|
|
351
350
|
throw Error("threeObject is invalid");
|
|
352
351
|
}
|
|
353
352
|
let newQuat = null;
|
|
354
|
-
if (args[0] instanceof
|
|
355
|
-
newQuat = new
|
|
353
|
+
if (args[0] instanceof webgpu.Quaternion) {
|
|
354
|
+
newQuat = new webgpu.Quaternion().copy(args[0]);
|
|
356
355
|
}
|
|
357
356
|
if (typeof args[0] === "number" && typeof args[1] === "number" && typeof args[2] === "number" && typeof args[3] === "number") {
|
|
358
|
-
newQuat = new
|
|
357
|
+
newQuat = new webgpu.Quaternion(args[0], args[1], args[2], args[3]);
|
|
359
358
|
}
|
|
360
359
|
if (!newQuat) {
|
|
361
360
|
console.error("setQuaternion failed,param is invalid", args);
|
|
@@ -363,9 +362,9 @@ class SceneComponent extends Component {
|
|
|
363
362
|
}
|
|
364
363
|
this.threeObject.quaternion.copy(newQuat);
|
|
365
364
|
if (!this.threeObject.matrixAutoUpdate) {
|
|
366
|
-
const position = new
|
|
367
|
-
const quaternion = new
|
|
368
|
-
const scale = new
|
|
365
|
+
const position = new webgpu.Vector3();
|
|
366
|
+
const quaternion = new webgpu.Quaternion();
|
|
367
|
+
const scale = new webgpu.Vector3();
|
|
369
368
|
this.threeObject.matrix.decompose(position, quaternion, scale);
|
|
370
369
|
this.threeObject.matrix.compose(position, newQuat, scale);
|
|
371
370
|
}
|
|
@@ -384,9 +383,9 @@ class SceneComponent extends Component {
|
|
|
384
383
|
return this.threeObject.scale.clone();
|
|
385
384
|
}
|
|
386
385
|
else {
|
|
387
|
-
const position = new
|
|
388
|
-
const quaternion = new
|
|
389
|
-
const scale = new
|
|
386
|
+
const position = new webgpu.Vector3();
|
|
387
|
+
const quaternion = new webgpu.Quaternion();
|
|
388
|
+
const scale = new webgpu.Vector3();
|
|
390
389
|
this.threeObject.matrix.decompose(position, quaternion, scale);
|
|
391
390
|
return scale;
|
|
392
391
|
}
|
|
@@ -396,11 +395,11 @@ class SceneComponent extends Component {
|
|
|
396
395
|
throw Error("threeObject is invalid");
|
|
397
396
|
}
|
|
398
397
|
let newScale = null;
|
|
399
|
-
if (args[0] instanceof
|
|
400
|
-
newScale = new
|
|
398
|
+
if (args[0] instanceof webgpu.Vector3) {
|
|
399
|
+
newScale = new webgpu.Vector3().copy(args[0]);
|
|
401
400
|
}
|
|
402
401
|
if (typeof (args[0]) === "number" && typeof (args[1]) === "number" && typeof (args[2]) === "number") {
|
|
403
|
-
newScale = new
|
|
402
|
+
newScale = new webgpu.Vector3(args[0], args[1], args[2]);
|
|
404
403
|
}
|
|
405
404
|
if (!newScale) {
|
|
406
405
|
return;
|
|
@@ -444,7 +443,7 @@ class SceneComponent extends Component {
|
|
|
444
443
|
if (!this.threeObject) {
|
|
445
444
|
throw Error("threeObject is invalid");
|
|
446
445
|
}
|
|
447
|
-
let location = new
|
|
446
|
+
let location = new webgpu.Vector3();
|
|
448
447
|
this.threeObject.getWorldPosition(location);
|
|
449
448
|
return location;
|
|
450
449
|
}
|
|
@@ -453,16 +452,16 @@ class SceneComponent extends Component {
|
|
|
453
452
|
if (!this.threeObject) {
|
|
454
453
|
throw Error("threeObject is invalid");
|
|
455
454
|
}
|
|
456
|
-
let rotation = new
|
|
455
|
+
let rotation = new webgpu.Quaternion();
|
|
457
456
|
this.threeObject.getWorldQuaternion(rotation);
|
|
458
|
-
return new
|
|
457
|
+
return new webgpu.Euler().setFromQuaternion(rotation);
|
|
459
458
|
}
|
|
460
459
|
// // rotation(quat)
|
|
461
460
|
getWorldQuaternion() {
|
|
462
461
|
if (!this.threeObject) {
|
|
463
462
|
throw Error("threeObject is invalid");
|
|
464
463
|
}
|
|
465
|
-
let rotation = new
|
|
464
|
+
let rotation = new webgpu.Quaternion();
|
|
466
465
|
this.threeObject.getWorldQuaternion(rotation);
|
|
467
466
|
return rotation;
|
|
468
467
|
}
|
|
@@ -471,7 +470,7 @@ class SceneComponent extends Component {
|
|
|
471
470
|
if (!this.threeObject) {
|
|
472
471
|
throw Error("threeObject is invalid");
|
|
473
472
|
}
|
|
474
|
-
let scale = new
|
|
473
|
+
let scale = new webgpu.Vector3();
|
|
475
474
|
this.threeObject.getWorldScale(scale);
|
|
476
475
|
return scale;
|
|
477
476
|
}
|
|
@@ -492,7 +491,7 @@ class SceneComponent extends Component {
|
|
|
492
491
|
// 计算父对象的逆世界矩阵
|
|
493
492
|
const parentInverseWorldMatrix = this.threeObject.parent.matrixWorld.clone().invert();
|
|
494
493
|
// 计算物体的本地矩阵
|
|
495
|
-
const cLocalMatrix = new
|
|
494
|
+
const cLocalMatrix = new webgpu.Matrix4().multiplyMatrices(parentInverseWorldMatrix, newMatrix);
|
|
496
495
|
// 更新物体的本地矩阵
|
|
497
496
|
this.setMatrix(cLocalMatrix);
|
|
498
497
|
// this.threeObject.matrix.copy(cLocalMatrix);
|
|
@@ -516,7 +515,7 @@ class SceneComponent extends Component {
|
|
|
516
515
|
if (!this.threeObject) {
|
|
517
516
|
throw Error("threeObject is invalid");
|
|
518
517
|
}
|
|
519
|
-
let ret = new
|
|
518
|
+
let ret = new webgpu.Vector3();
|
|
520
519
|
this.threeObject.getWorldDirection(ret);
|
|
521
520
|
return ret;
|
|
522
521
|
}
|
|
@@ -524,7 +523,7 @@ class SceneComponent extends Component {
|
|
|
524
523
|
if (!this.threeObject) {
|
|
525
524
|
throw Error("threeObject is invalid");
|
|
526
525
|
}
|
|
527
|
-
let ret = new
|
|
526
|
+
let ret = new webgpu.Vector3(0, 1, 0);
|
|
528
527
|
ret.applyQuaternion(this.getWorldQuaternion());
|
|
529
528
|
return ret;
|
|
530
529
|
}
|
|
@@ -532,7 +531,7 @@ class SceneComponent extends Component {
|
|
|
532
531
|
if (!this.threeObject) {
|
|
533
532
|
throw Error("threeObject is invalid");
|
|
534
533
|
}
|
|
535
|
-
let ret = new
|
|
534
|
+
let ret = new webgpu.Vector3(1, 0, 0);
|
|
536
535
|
ret.applyQuaternion(this.getWorldQuaternion());
|
|
537
536
|
return ret;
|
|
538
537
|
}
|
|
@@ -711,12 +710,12 @@ class MeshComponent extends SceneComponent {
|
|
|
711
710
|
}
|
|
712
711
|
constructor(...args) {
|
|
713
712
|
let newMesh = null;
|
|
714
|
-
if (args[0] instanceof
|
|
713
|
+
if (args[0] instanceof webgpu.Mesh) {
|
|
715
714
|
newMesh = args[0];
|
|
716
715
|
}
|
|
717
716
|
else {
|
|
718
|
-
if (args[0] instanceof
|
|
719
|
-
newMesh = new
|
|
717
|
+
if (args[0] instanceof webgpu.BufferGeometry && (args[1] instanceof webgpu.Material || Array.isArray(args[1]))) {
|
|
718
|
+
newMesh = new webgpu.Mesh(args[0], args[1]);
|
|
720
719
|
}
|
|
721
720
|
else {
|
|
722
721
|
throw new Error('Invalid arguments for A constructor');
|
|
@@ -744,19 +743,19 @@ class MeshComponent extends SceneComponent {
|
|
|
744
743
|
return this.threeObject ? this.threeObject.receiveShadow : false;
|
|
745
744
|
}
|
|
746
745
|
getBoundsCenterPosition() {
|
|
747
|
-
let ret = new
|
|
746
|
+
let ret = new webgpu.Vector3();
|
|
748
747
|
this.getBounds().getCenter(ret);
|
|
749
748
|
return ret;
|
|
750
749
|
}
|
|
751
750
|
getBoundsTopCenterPosition() {
|
|
752
|
-
let ret = new
|
|
751
|
+
let ret = new webgpu.Vector3();
|
|
753
752
|
let bounds = this.getBounds();
|
|
754
753
|
bounds.getCenter(ret);
|
|
755
754
|
ret.y = bounds.max.y;
|
|
756
755
|
return ret;
|
|
757
756
|
}
|
|
758
757
|
getBoundsBottomCenterPosition() {
|
|
759
|
-
let ret = new
|
|
758
|
+
let ret = new webgpu.Vector3();
|
|
760
759
|
let bounds = this.getBounds();
|
|
761
760
|
bounds.getCenter(ret);
|
|
762
761
|
ret.y = bounds.min.y;
|
|
@@ -769,9 +768,9 @@ class MeshComponent extends SceneComponent {
|
|
|
769
768
|
let assetManager = LYAssetManager.Get();
|
|
770
769
|
const mats = Array.isArray(this.material) ? this.material : [this.material];
|
|
771
770
|
mats.forEach((material) => {
|
|
772
|
-
if (material instanceof
|
|
771
|
+
if (material instanceof webgpu.Material) {
|
|
773
772
|
Object.entries(material).forEach(([key, value]) => {
|
|
774
|
-
if (value instanceof
|
|
773
|
+
if (value instanceof webgpu.Texture) {
|
|
775
774
|
assetManager.releaseAsset(value);
|
|
776
775
|
value = null;
|
|
777
776
|
}
|
|
@@ -780,7 +779,7 @@ class MeshComponent extends SceneComponent {
|
|
|
780
779
|
}
|
|
781
780
|
});
|
|
782
781
|
this.material = [];
|
|
783
|
-
if (this.geometry instanceof
|
|
782
|
+
if (this.geometry instanceof webgpu.BufferGeometry) {
|
|
784
783
|
assetManager.releaseAsset(this.geometry);
|
|
785
784
|
this.geometry = null;
|
|
786
785
|
}
|
|
@@ -854,7 +853,7 @@ class LYAssetManager {
|
|
|
854
853
|
constructor() {
|
|
855
854
|
this.assetPointer = new Map();
|
|
856
855
|
this.dracoLoader = null;
|
|
857
|
-
this.loadingManager = new
|
|
856
|
+
this.loadingManager = new webgpu.LoadingManager();
|
|
858
857
|
this.gltfLoader = new Addons_js.GLTFLoader(this.loadingManager);
|
|
859
858
|
}
|
|
860
859
|
get LoadingManager() {
|
|
@@ -922,7 +921,7 @@ class LYAssetManager {
|
|
|
922
921
|
textures: new Map()
|
|
923
922
|
};
|
|
924
923
|
gltf.scene.traverse((child) => {
|
|
925
|
-
if (child.geometry && child.geometry instanceof
|
|
924
|
+
if (child.geometry && child.geometry instanceof webgpu.BufferGeometry) {
|
|
926
925
|
countResource(resources.geometries, child.geometry);
|
|
927
926
|
}
|
|
928
927
|
if (child.material) {
|
|
@@ -931,7 +930,7 @@ class LYAssetManager {
|
|
|
931
930
|
if (mat) {
|
|
932
931
|
countResource(resources.materials, mat);
|
|
933
932
|
Object.entries(mat).forEach(([key, value]) => {
|
|
934
|
-
if (value instanceof
|
|
933
|
+
if (value instanceof webgpu.Texture) {
|
|
935
934
|
countResource(resources.textures, value);
|
|
936
935
|
}
|
|
937
936
|
});
|
|
@@ -966,7 +965,7 @@ class LYAssetManager {
|
|
|
966
965
|
this.addAsset(material);
|
|
967
966
|
}
|
|
968
967
|
Object.entries(material).forEach(([key, value]) => {
|
|
969
|
-
if (value instanceof
|
|
968
|
+
if (value instanceof webgpu.Texture) {
|
|
970
969
|
if (!value.userData["assetPointer"]) {
|
|
971
970
|
this.addAsset(value);
|
|
972
971
|
}
|
|
@@ -1010,7 +1009,7 @@ class LYAssetManager {
|
|
|
1010
1009
|
this.gltfLoader.parse(data, path, onLoadFinished);
|
|
1011
1010
|
}
|
|
1012
1011
|
loadFile(filepath = '', onLoadFinished) {
|
|
1013
|
-
const loader = new
|
|
1012
|
+
const loader = new webgpu.FileLoader();
|
|
1014
1013
|
loader.load(filepath, (data) => {
|
|
1015
1014
|
onLoadFinished(data);
|
|
1016
1015
|
});
|
|
@@ -1109,7 +1108,7 @@ class World {
|
|
|
1109
1108
|
constructor(app) {
|
|
1110
1109
|
this.actors = new Set();
|
|
1111
1110
|
this.app = app;
|
|
1112
|
-
this._scene = new
|
|
1111
|
+
this._scene = new webgpu.Scene();
|
|
1113
1112
|
}
|
|
1114
1113
|
init() {
|
|
1115
1114
|
}
|
|
@@ -1124,7 +1123,7 @@ class World {
|
|
|
1124
1123
|
});
|
|
1125
1124
|
this.actors.clear();
|
|
1126
1125
|
this.scene.traverse((child) => {
|
|
1127
|
-
if (child instanceof
|
|
1126
|
+
if (child instanceof webgpu.Mesh) {
|
|
1128
1127
|
ThreeObjectLibrary.disposeMeshResource(child);
|
|
1129
1128
|
}
|
|
1130
1129
|
});
|
|
@@ -1147,13 +1146,13 @@ const DefaultToneMappingParams = {
|
|
|
1147
1146
|
toneMapping: 'AgX',
|
|
1148
1147
|
};
|
|
1149
1148
|
const ToneMappingOptions = new Map([
|
|
1150
|
-
["None",
|
|
1151
|
-
["Linear",
|
|
1152
|
-
["Reinhard",
|
|
1153
|
-
["Cineon",
|
|
1154
|
-
["ACESFilmic",
|
|
1155
|
-
["AgX",
|
|
1156
|
-
["Neutral",
|
|
1149
|
+
["None", webgpu.NoToneMapping],
|
|
1150
|
+
["Linear", webgpu.LinearToneMapping],
|
|
1151
|
+
["Reinhard", webgpu.ReinhardToneMapping],
|
|
1152
|
+
["Cineon", webgpu.CineonToneMapping],
|
|
1153
|
+
["ACESFilmic", webgpu.ACESFilmicToneMapping],
|
|
1154
|
+
["AgX", webgpu.AgXToneMapping],
|
|
1155
|
+
["Neutral", webgpu.NeutralToneMapping]
|
|
1157
1156
|
]);
|
|
1158
1157
|
|
|
1159
1158
|
class WebGPUPostProcessFactory {
|
|
@@ -1755,8 +1754,8 @@ class Orbital extends Pawn {
|
|
|
1755
1754
|
focusTo(targetPos, targetQuat, distance, time, onGoing = null, onFinished = null) {
|
|
1756
1755
|
this.stopFocusing();
|
|
1757
1756
|
let finalQuat = null;
|
|
1758
|
-
if (targetQuat instanceof
|
|
1759
|
-
finalQuat = new
|
|
1757
|
+
if (targetQuat instanceof webgpu.Euler) {
|
|
1758
|
+
finalQuat = new webgpu.Quaternion().setFromEuler(targetQuat);
|
|
1760
1759
|
}
|
|
1761
1760
|
else {
|
|
1762
1761
|
finalQuat = targetQuat;
|
|
@@ -1765,20 +1764,20 @@ class Orbital extends Pawn {
|
|
|
1765
1764
|
finalQuat = this.controller.camera.quaternion;
|
|
1766
1765
|
}
|
|
1767
1766
|
finalQuat.normalize();
|
|
1768
|
-
let dir = new
|
|
1767
|
+
let dir = new webgpu.Vector3(0, 0, 1);
|
|
1769
1768
|
dir.applyQuaternion(finalQuat).multiplyScalar(-1);
|
|
1770
1769
|
dir.normalize();
|
|
1771
1770
|
// quat
|
|
1772
1771
|
// let startQuat = this.camera.quaternion.clone();
|
|
1773
1772
|
// position
|
|
1774
1773
|
let startPos = this.camera.position.clone();
|
|
1775
|
-
let endPos = new
|
|
1776
|
-
let posDir = new
|
|
1774
|
+
let endPos = new webgpu.Vector3(targetPos.x + dir.x * distance * -1, targetPos.y + dir.y * distance * -1, targetPos.z + dir.z * distance * -1);
|
|
1775
|
+
let posDir = new webgpu.Vector3().subVectors(endPos, startPos);
|
|
1777
1776
|
let movingLength = posDir.length();
|
|
1778
1777
|
posDir.normalize();
|
|
1779
1778
|
// target
|
|
1780
1779
|
let startTarget = this.control.target.clone();
|
|
1781
|
-
let targetDir = new
|
|
1780
|
+
let targetDir = new webgpu.Vector3().subVectors(targetPos, startTarget);
|
|
1782
1781
|
let targetDistance = targetDir.length();
|
|
1783
1782
|
targetDir.normalize();
|
|
1784
1783
|
// start animation
|
|
@@ -1793,8 +1792,8 @@ class Orbital extends Pawn {
|
|
|
1793
1792
|
alpha: 1,
|
|
1794
1793
|
onUpdate: () => {
|
|
1795
1794
|
let alpha = obj.alpha;
|
|
1796
|
-
let camPos = new
|
|
1797
|
-
let targetPos = new
|
|
1795
|
+
let camPos = new webgpu.Vector3(startPos.x + posDir.x * alpha * movingLength, startPos.y + posDir.y * alpha * movingLength, startPos.z + posDir.z * alpha * movingLength);
|
|
1796
|
+
let targetPos = new webgpu.Vector3(startTarget.x + targetDir.x * alpha * targetDistance, startTarget.y + targetDir.y * alpha * targetDistance, startTarget.z + targetDir.z * alpha * targetDistance);
|
|
1798
1797
|
_this.control.object.position.copy(camPos);
|
|
1799
1798
|
_this.control.target.copy(targetPos);
|
|
1800
1799
|
_this.control.update();
|
|
@@ -1849,17 +1848,17 @@ class Controller {
|
|
|
1849
1848
|
this.onPointerLeave = (event) => { this.onPointerLeaveEvent(event); };
|
|
1850
1849
|
this.onPointerUp = (event) => { this.onPointerUpEvent(event); };
|
|
1851
1850
|
this.onPointerDown = (event) => { this.onPointerDownEvent(event); };
|
|
1852
|
-
this.pointerPosition = new
|
|
1851
|
+
this.pointerPosition = new webgpu.Vector2();
|
|
1853
1852
|
this.doubleClickDelay = 250; // 双击判定时间间隔(毫秒)
|
|
1854
1853
|
this.leftClickTimer = null;
|
|
1855
|
-
this.pointerLeftDownPosition = new
|
|
1854
|
+
this.pointerLeftDownPosition = new webgpu.Vector2();
|
|
1856
1855
|
this.hoveringComponent = null;
|
|
1857
1856
|
this._pointButtonIsDown = new Set();
|
|
1858
1857
|
this._onClickNothingDelegate = new Delegate();
|
|
1859
1858
|
this.app = app;
|
|
1860
1859
|
this._pawn = new Orbital(this);
|
|
1861
1860
|
this.pawn.possess();
|
|
1862
|
-
this.raycaster = new
|
|
1861
|
+
this.raycaster = new webgpu.Raycaster();
|
|
1863
1862
|
if (!this.viewPort.canvas) {
|
|
1864
1863
|
throw Error("canvas is null");
|
|
1865
1864
|
}
|
|
@@ -1898,7 +1897,7 @@ class Controller {
|
|
|
1898
1897
|
const canvasRect = this.viewPort.canvas.getBoundingClientRect();
|
|
1899
1898
|
const offsetX = canvasRect.left;
|
|
1900
1899
|
const offsetY = canvasRect.top;
|
|
1901
|
-
const pointer = new
|
|
1900
|
+
const pointer = new webgpu.Vector2(((event.clientX - offsetX) / this.viewPort.canvas.clientWidth) * 2 - 1, 1 - ((event.clientY - offsetY) / this.viewPort.canvas.clientHeight) * 2);
|
|
1902
1901
|
this.pointerPosition = pointer;
|
|
1903
1902
|
if (this._pointButtonIsDown.size > 0) {
|
|
1904
1903
|
return;
|
|
@@ -1923,7 +1922,7 @@ class Controller {
|
|
|
1923
1922
|
onPointerUpEvent(event) {
|
|
1924
1923
|
this._pointButtonIsDown.delete(event.button);
|
|
1925
1924
|
if (event.button === 0) {
|
|
1926
|
-
const pointerOffset = new
|
|
1925
|
+
const pointerOffset = new webgpu.Vector2().subVectors(this.pointerLeftDownPosition, this.pointerPosition).length();
|
|
1927
1926
|
if (pointerOffset > 0.005) {
|
|
1928
1927
|
if (this.leftClickTimer) {
|
|
1929
1928
|
window.clearTimeout(this.leftClickTimer);
|
|
@@ -1988,7 +1987,7 @@ class Controller {
|
|
|
1988
1987
|
return this.getHitResultFromScreenPoint(this.pointerPosition.x, this.pointerPosition.y);
|
|
1989
1988
|
}
|
|
1990
1989
|
getHitResultFromScreenPoint(x, y) {
|
|
1991
|
-
this.raycaster.setFromCamera(new
|
|
1990
|
+
this.raycaster.setFromCamera(new webgpu.Vector2(x, y), this.camera);
|
|
1992
1991
|
let out = this.raycaster.intersectObjects(this.world.scene.children, true);
|
|
1993
1992
|
for (let i = 0; i < out.length; i++) {
|
|
1994
1993
|
if (out[i].object.userData["rayIgnored"]) {
|
|
@@ -2007,10 +2006,10 @@ class CameraFactory {
|
|
|
2007
2006
|
static createCamera(param) {
|
|
2008
2007
|
let cam = null;
|
|
2009
2008
|
if ("fov" in param.param && "aspect" in param.param) {
|
|
2010
|
-
cam = new
|
|
2009
|
+
cam = new webgpu.PerspectiveCamera(param.param.fov, param.param.aspect, param.near, param.far);
|
|
2011
2010
|
}
|
|
2012
2011
|
if ("left" in param.param && "right" in param.param && "top" in param.param && "bottom" in param.param) {
|
|
2013
|
-
cam = new
|
|
2012
|
+
cam = new webgpu.OrthographicCamera(param.param.left, param.param.right, param.param.top, param.param.bottom, param.near, param.far);
|
|
2014
2013
|
}
|
|
2015
2014
|
if (!cam) {
|
|
2016
2015
|
console.error("create camera failed");
|
|
@@ -2021,7 +2020,7 @@ class CameraFactory {
|
|
|
2021
2020
|
}
|
|
2022
2021
|
static updataCamera(param, camera) {
|
|
2023
2022
|
if ("fov" in param.param && "aspect" in param.param) {
|
|
2024
|
-
if (camera instanceof
|
|
2023
|
+
if (camera instanceof webgpu.PerspectiveCamera) {
|
|
2025
2024
|
camera.near = param.near;
|
|
2026
2025
|
camera.far = param.far;
|
|
2027
2026
|
camera.fov = param.param.fov;
|
|
@@ -2029,11 +2028,11 @@ class CameraFactory {
|
|
|
2029
2028
|
return camera;
|
|
2030
2029
|
}
|
|
2031
2030
|
else {
|
|
2032
|
-
return new
|
|
2031
|
+
return new webgpu.PerspectiveCamera(param.param.fov, param.param.aspect, param.near, param.far);
|
|
2033
2032
|
}
|
|
2034
2033
|
}
|
|
2035
2034
|
if ("left" in param.param && "right" in param.param && "top" in param.param && "bottom" in param.param) {
|
|
2036
|
-
if (camera instanceof
|
|
2035
|
+
if (camera instanceof webgpu.OrthographicCamera) {
|
|
2037
2036
|
camera.near = param.near;
|
|
2038
2037
|
camera.far = param.far;
|
|
2039
2038
|
camera.left = param.param.left;
|
|
@@ -2043,7 +2042,7 @@ class CameraFactory {
|
|
|
2043
2042
|
return camera;
|
|
2044
2043
|
}
|
|
2045
2044
|
else {
|
|
2046
|
-
return new
|
|
2045
|
+
return new webgpu.OrthographicCamera(param.param.left, param.param.right, param.param.top, param.param.bottom, param.near, param.far);
|
|
2047
2046
|
}
|
|
2048
2047
|
}
|
|
2049
2048
|
return camera;
|
|
@@ -2105,7 +2104,7 @@ class ThreeJsApp {
|
|
|
2105
2104
|
this._appParam.cameraParam = appParam.cameraParam ? appParam.cameraParam : DefaultCameraParam;
|
|
2106
2105
|
this._appParam.renderParam = appParam.renderParam ? appParam.renderParam : DefaultRenderParam;
|
|
2107
2106
|
this._appParam.postProcessParam = appParam.postProcessParam ? appParam.postProcessParam : DefaultPostProcessParam;
|
|
2108
|
-
this._clock = new
|
|
2107
|
+
this._clock = new webgpu.Clock();
|
|
2109
2108
|
this._camera = CameraFactory.createCamera(this._appParam.cameraParam);
|
|
2110
2109
|
this._world = new this.worldClass(this);
|
|
2111
2110
|
this._viewport = new this.viewportClass(this, elementId, this._appParam.renderParam, this._appParam.postProcessParam);
|
|
@@ -2141,7 +2140,7 @@ class ThreeJsApp {
|
|
|
2141
2140
|
this.viewport.markRenderStateDirty();
|
|
2142
2141
|
}
|
|
2143
2142
|
onWindowResize(width, height) {
|
|
2144
|
-
if (this.camera instanceof
|
|
2143
|
+
if (this.camera instanceof webgpu.PerspectiveCamera) {
|
|
2145
2144
|
this.camera.aspect = width / height;
|
|
2146
2145
|
}
|
|
2147
2146
|
// if(this.camera instanceof OrthographicCamera)
|
|
@@ -2216,7 +2215,7 @@ class Actor extends BaseObject {
|
|
|
2216
2215
|
this.constructRootComponent(myThreeObject);
|
|
2217
2216
|
}
|
|
2218
2217
|
constructRootComponent(myThreeObject = null) {
|
|
2219
|
-
let tObject = myThreeObject ? myThreeObject : new
|
|
2218
|
+
let tObject = myThreeObject ? myThreeObject : new webgpu.Group();
|
|
2220
2219
|
if (tObject.isMesh) {
|
|
2221
2220
|
let mesh = tObject;
|
|
2222
2221
|
this._rootComponent = new MeshComponent(mesh);
|
|
@@ -2228,7 +2227,7 @@ class Actor extends BaseObject {
|
|
|
2228
2227
|
}
|
|
2229
2228
|
}
|
|
2230
2229
|
getBoundsCenterPosition(bInWorldSpace = true) {
|
|
2231
|
-
let ret = new
|
|
2230
|
+
let ret = new webgpu.Vector3();
|
|
2232
2231
|
this.getBounds().getCenter(ret);
|
|
2233
2232
|
if (!bInWorldSpace) {
|
|
2234
2233
|
return ret.sub(this.getPosition());
|
|
@@ -2238,7 +2237,7 @@ class Actor extends BaseObject {
|
|
|
2238
2237
|
}
|
|
2239
2238
|
}
|
|
2240
2239
|
getBoundsTopCenterPosition(bInWorldSpace = true) {
|
|
2241
|
-
let ret = new
|
|
2240
|
+
let ret = new webgpu.Vector3();
|
|
2242
2241
|
let bounds = this.rootComponent.getBounds();
|
|
2243
2242
|
bounds.getCenter(ret);
|
|
2244
2243
|
ret.y = bounds.max.y;
|
|
@@ -2250,7 +2249,7 @@ class Actor extends BaseObject {
|
|
|
2250
2249
|
}
|
|
2251
2250
|
}
|
|
2252
2251
|
getBoundsBottomCenterPosition(bInWorldSpace = true) {
|
|
2253
|
-
let ret = new
|
|
2252
|
+
let ret = new webgpu.Vector3();
|
|
2254
2253
|
let bounds = this.getBounds();
|
|
2255
2254
|
bounds.getCenter(ret);
|
|
2256
2255
|
ret.y = bounds.min.y;
|
|
@@ -2582,7 +2581,7 @@ class DirectionalLightComponent extends LightComponent {
|
|
|
2582
2581
|
this.threeObject.castShadow = value;
|
|
2583
2582
|
}
|
|
2584
2583
|
constructor(color = 0xffffff, intensity = 10) {
|
|
2585
|
-
let obj = new
|
|
2584
|
+
let obj = new webgpu.DirectionalLight(color, intensity);
|
|
2586
2585
|
super(obj);
|
|
2587
2586
|
this.obj = obj;
|
|
2588
2587
|
obj.castShadow = true;
|
|
@@ -2621,13 +2620,13 @@ class DirectionalLightActor extends Actor {
|
|
|
2621
2620
|
}
|
|
2622
2621
|
|
|
2623
2622
|
class BoxComponent extends MeshComponent {
|
|
2624
|
-
constructor(width = 1, height = 1, depth = 1, widthSegments = 1, heightSegments = 1, depthSegments = 1, material = new
|
|
2625
|
-
super(new
|
|
2623
|
+
constructor(width = 1, height = 1, depth = 1, widthSegments = 1, heightSegments = 1, depthSegments = 1, material = new webgpu.MeshStandardMaterial()) {
|
|
2624
|
+
super(new webgpu.BoxGeometry(width, height, depth, widthSegments, heightSegments, depthSegments), material);
|
|
2626
2625
|
}
|
|
2627
2626
|
}
|
|
2628
2627
|
|
|
2629
2628
|
class BoxActor extends Actor {
|
|
2630
|
-
constructor(width = 1, height = 1, depth = 1, widthSegments = 1, heightSegments = 1, depthSegments = 1, material = new
|
|
2629
|
+
constructor(width = 1, height = 1, depth = 1, widthSegments = 1, heightSegments = 1, depthSegments = 1, material = new webgpu.MeshBasicMaterial()) {
|
|
2631
2630
|
super();
|
|
2632
2631
|
this.addComponent(new BoxComponent(width, height, depth, widthSegments, heightSegments, depthSegments, material));
|
|
2633
2632
|
}
|
|
@@ -2635,7 +2634,7 @@ class BoxActor extends Actor {
|
|
|
2635
2634
|
|
|
2636
2635
|
class PlaneComponent extends MeshComponent {
|
|
2637
2636
|
constructor(width, height, material, widthSegments = 1, heightSegments = 1) {
|
|
2638
|
-
super(new
|
|
2637
|
+
super(new webgpu.PlaneGeometry(width, height, widthSegments, heightSegments), material);
|
|
2639
2638
|
}
|
|
2640
2639
|
}
|
|
2641
2640
|
|
|
@@ -2643,7 +2642,7 @@ class PlaneActor extends Actor {
|
|
|
2643
2642
|
get planeComponent() {
|
|
2644
2643
|
return this._planeComponent;
|
|
2645
2644
|
}
|
|
2646
|
-
constructor(width, height, material = new
|
|
2645
|
+
constructor(width, height, material = new webgpu.MeshBasicMaterial(), widthSegments = 1, heightSegments = 1) {
|
|
2647
2646
|
super();
|
|
2648
2647
|
this._planeComponent = new PlaneComponent(width, height, material, widthSegments, heightSegments);
|
|
2649
2648
|
this._planeComponent.setRotation(Math.PI * 0.5 * -1, 0, 0);
|
|
@@ -2694,8 +2693,8 @@ const DefaultSSRParam = {
|
|
|
2694
2693
|
};
|
|
2695
2694
|
|
|
2696
2695
|
class SphereComponent extends MeshComponent {
|
|
2697
|
-
constructor(radius, material = new
|
|
2698
|
-
super(new
|
|
2696
|
+
constructor(radius, material = new webgpu.MeshBasicMaterial(), widthSegments = 32, heightSegments = 16) {
|
|
2697
|
+
super(new webgpu.SphereGeometry(radius, widthSegments, heightSegments), material);
|
|
2699
2698
|
}
|
|
2700
2699
|
}
|
|
2701
2700
|
|
|
@@ -2709,7 +2708,7 @@ class LabelComponent extends SceneComponent {
|
|
|
2709
2708
|
this.obj.userData["LYObject"] = this;
|
|
2710
2709
|
}
|
|
2711
2710
|
}
|
|
2712
|
-
constructor(domElement, center = new
|
|
2711
|
+
constructor(domElement, center = new webgpu.Vector2(0.5, 1)) {
|
|
2713
2712
|
let obj = new CSS2DRenderer_js.CSS2DObject(domElement);
|
|
2714
2713
|
super(obj);
|
|
2715
2714
|
this.obj = obj;
|
|
@@ -2759,7 +2758,7 @@ class TransformGizmo extends Pawn {
|
|
|
2759
2758
|
constructor(controller) {
|
|
2760
2759
|
super(controller);
|
|
2761
2760
|
this._control = null;
|
|
2762
|
-
this.helperObject = new
|
|
2761
|
+
this.helperObject = new webgpu.Object3D();
|
|
2763
2762
|
this.targets = [];
|
|
2764
2763
|
this.primaryTarget = null;
|
|
2765
2764
|
this.targetMatrixMap = new Map();
|
|
@@ -2833,7 +2832,7 @@ class TransformGizmo extends Pawn {
|
|
|
2833
2832
|
if (tar !== this.primaryTarget) {
|
|
2834
2833
|
let t = this.targetMatrixMap.get(tar);
|
|
2835
2834
|
if (t) {
|
|
2836
|
-
let TB2 = new
|
|
2835
|
+
let TB2 = new webgpu.Matrix4().multiplyMatrices(TA2, t); // B
|
|
2837
2836
|
tar.onTransforming(TB2);
|
|
2838
2837
|
}
|
|
2839
2838
|
}
|
package/dist/bundle.esm.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { MathUtils, Group, Vector3, Box3, Quaternion, Euler, Matrix4, Mesh, BufferGeometry, Material, Texture, LoadingManager, FileLoader, Scene, NoToneMapping, LinearToneMapping, ReinhardToneMapping, CineonToneMapping, ACESFilmicToneMapping, AgXToneMapping, NeutralToneMapping, Vector2, Raycaster, PerspectiveCamera, OrthographicCamera, Clock, DirectionalLight, MeshStandardMaterial, BoxGeometry, MeshBasicMaterial, PlaneGeometry, SphereGeometry, Object3D } from 'three';
|
|
1
|
+
import { MathUtils, Group, Vector3, Box3, Quaternion, Euler, Matrix4, Mesh, BufferGeometry, Material, Texture, LoadingManager, FileLoader, Scene, NoToneMapping, LinearToneMapping, ReinhardToneMapping, CineonToneMapping, ACESFilmicToneMapping, AgXToneMapping, NeutralToneMapping, WebGPURenderer, PostProcessing, Color, Vector2, Raycaster, PerspectiveCamera, OrthographicCamera, Clock, DirectionalLight, MeshStandardMaterial, BoxGeometry, MeshBasicMaterial, PlaneGeometry, SphereGeometry, Object3D } from 'three/webgpu';
|
|
2
2
|
import { GLTFLoader, DRACOLoader, CSS2DRenderer, OrbitControls } from 'three/examples/jsm/Addons.js';
|
|
3
3
|
import { pass, mrt, output, uniform, velocity, metalness, transformedNormalView, blendColor, time, oscSine } from 'three/tsl';
|
|
4
|
-
import { WebGPURenderer, PostProcessing, Color } from 'three/webgpu';
|
|
5
4
|
import { bloom } from 'three/examples/jsm/tsl/display/BloomNode.js';
|
|
6
5
|
import { denoise } from 'three/examples/jsm/tsl/display/DenoiseNode.js';
|
|
7
6
|
import { dof } from 'three/examples/jsm/tsl/display/DepthOfFieldNode.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BufferGeometry, LoadingManager, Material, Mesh, Texture } from
|
|
1
|
+
import { BufferGeometry, LoadingManager, Material, Mesh, Texture } from "three/webgpu";
|
|
2
2
|
import { SceneComponent } from "../Object/Components/SceneComponent";
|
|
3
3
|
import { LYLoadTask } from "./Task/Task";
|
|
4
4
|
import { TAssetPointer } from "./AssetPointer/AssetPointer";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BufferGeometry, Material, Texture } from "three";
|
|
1
|
+
import { BufferGeometry, Material, Texture } from "three/webgpu";
|
|
2
2
|
import { TSmartPointer } from "../../Container/SmartPointer";
|
|
3
3
|
export declare class TAssetPointer<T extends BufferGeometry | Texture | Material> extends TSmartPointer<T> {
|
|
4
4
|
get uuid(): string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { OrthographicCamera, PerspectiveCamera } from "three";
|
|
1
|
+
import { OrthographicCamera, PerspectiveCamera } from "three/webgpu";
|
|
2
2
|
import { CameraParam } from "../Frame/Parameters/CameraParameter";
|
|
3
3
|
export declare class CameraFactory {
|
|
4
|
-
static createCamera(param: CameraParam):
|
|
4
|
+
static createCamera(param: CameraParam): any;
|
|
5
5
|
static updataCamera(param: CameraParam, camera: PerspectiveCamera | OrthographicCamera): PerspectiveCamera | OrthographicCamera;
|
|
6
6
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ThreeJsApp } from "../ThreeJsApp";
|
|
2
|
-
import { Euler, Intersection, OrthographicCamera, PerspectiveCamera, Quaternion, Vector3 } from "three";
|
|
2
|
+
import { Euler, Intersection, OrthographicCamera, PerspectiveCamera, Quaternion, Vector3 } from "three/webgpu";
|
|
3
3
|
import { World } from "./World";
|
|
4
4
|
import { Viewport } from "./Viewport";
|
|
5
5
|
import { Pawn } from "../Object/PawnV2/Pawn";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Vector3, Quaternion, Object3D, Box3,
|
|
1
|
+
import { Vector3, Quaternion, Object3D, Box3, Euler } from "three/webgpu";
|
|
2
2
|
export interface Segment {
|
|
3
3
|
pointA: Vector3;
|
|
4
4
|
pointB: Vector3;
|
|
@@ -11,8 +11,8 @@ export declare class LYMath {
|
|
|
11
11
|
y: number;
|
|
12
12
|
z: number;
|
|
13
13
|
};
|
|
14
|
-
static getQuatFromAxis(forwardVector: Vector3, upVector?: Vector3):
|
|
15
|
-
static MaxVector(v1: Vector3, v2: Vector3):
|
|
14
|
+
static getQuatFromAxis(forwardVector: Vector3, upVector?: Vector3): any;
|
|
15
|
+
static MaxVector(v1: Vector3, v2: Vector3): any;
|
|
16
16
|
static clamp(value: number, min: number, max: number): number;
|
|
17
17
|
static getPlaneConstantFromPointAndNormal(point: Vector3, normal: Vector3): number;
|
|
18
18
|
static getSizeAndCenterOfObject3D(object: Object3D): {
|
|
@@ -22,6 +22,6 @@ export declare class LYMath {
|
|
|
22
22
|
};
|
|
23
23
|
static SegmentsIntersection(segmentA: Segment, segmentB: Segment): Vector3 | null;
|
|
24
24
|
static getCenterPointInPoints(points: Vector3[]): Vector3;
|
|
25
|
-
static contructPlane(dirction: Vector3, position: Vector3, quaternion: Quaternion, scale: Vector3):
|
|
26
|
-
static intersectRayPlane(rayOrigin: Vector3, rayDirection: Vector3, planeNormal: Vector3, planePoint: Vector3):
|
|
25
|
+
static contructPlane(dirction: Vector3, position: Vector3, quaternion: Quaternion, scale: Vector3): any;
|
|
26
|
+
static intersectRayPlane(rayOrigin: Vector3, rayDirection: Vector3, planeNormal: Vector3, planePoint: Vector3): any;
|
|
27
27
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Vector3, Quaternion, Euler, Matrix4, Object3D } from "three";
|
|
1
|
+
import { Vector3, Quaternion, Euler, Matrix4, Object3D } from "three/webgpu";
|
|
2
2
|
import { BaseObject } from "./BaseObject";
|
|
3
3
|
import { AttachmentRules } from "../Defines";
|
|
4
4
|
import { SceneComponent } from "./Components/SceneComponent";
|
|
@@ -22,10 +22,10 @@ export declare class Actor extends BaseObject {
|
|
|
22
22
|
protected onHoverEndEvent: ((component?: SceneComponent) => void)[];
|
|
23
23
|
constructor(myThreeObject?: Object3D | null);
|
|
24
24
|
protected constructRootComponent(myThreeObject?: Object3D | null): void;
|
|
25
|
-
getBoundsCenterPosition(bInWorldSpace?: boolean):
|
|
26
|
-
getBoundsTopCenterPosition(bInWorldSpace?: boolean):
|
|
27
|
-
getBoundsBottomCenterPosition(bInWorldSpace?: boolean):
|
|
28
|
-
getBounds():
|
|
25
|
+
getBoundsCenterPosition(bInWorldSpace?: boolean): any;
|
|
26
|
+
getBoundsTopCenterPosition(bInWorldSpace?: boolean): any;
|
|
27
|
+
getBoundsBottomCenterPosition(bInWorldSpace?: boolean): any;
|
|
28
|
+
getBounds(): Box3;
|
|
29
29
|
destroy(): void;
|
|
30
30
|
setVisible(bVisible: boolean): void;
|
|
31
31
|
setLayers(layer: number, bAffectChildActor?: boolean): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ColorRepresentation } from "three";
|
|
1
|
+
import { ColorRepresentation } from "three/webgpu";
|
|
2
2
|
import { Actor } from "../../Actor";
|
|
3
3
|
import { DirectionalLightComponent } from "../../Components/Light/DirectionalLight/DirectionalLightComponent";
|
|
4
4
|
export declare class DirectionalLightActor extends Actor {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Material } from "three";
|
|
1
|
+
import { Material } from "three/webgpu";
|
|
2
2
|
import { Actor } from "../../Actor";
|
|
3
3
|
export declare class BoxActor extends Actor {
|
|
4
4
|
constructor(width?: number, height?: number, depth?: number, widthSegments?: number, heightSegments?: number, depthSegments?: number, material?: Material);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EditorSkyComponent } from "@editor/Object/Components/Sky/EditorSkyComponent";
|
|
2
|
+
import { EditorActor } from "../EditorActor";
|
|
3
|
+
export declare class EditorSkyActor extends EditorActor {
|
|
4
|
+
protected _name: string;
|
|
5
|
+
protected skyComponent: EditorSkyComponent | null;
|
|
6
|
+
constructor();
|
|
7
|
+
protected constructRootComponent(): void;
|
|
8
|
+
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { CSS2DObject } from "three/examples/jsm/renderers/CSS2DRenderer.js";
|
|
2
|
-
import { Vector2 } from "three";
|
|
3
2
|
import { SceneComponent } from "../SceneComponent";
|
|
4
3
|
export declare class LabelComponent extends SceneComponent {
|
|
5
4
|
get threeObject(): CSS2DObject;
|
|
6
5
|
set threeObject(newThreeObject: CSS2DObject);
|
|
7
6
|
protected obj: CSS2DObject;
|
|
8
|
-
constructor(domElement: HTMLElement, center?:
|
|
7
|
+
constructor(domElement: HTMLElement, center?: any);
|
|
9
8
|
set isHoverEnabled(bCanHorver: boolean);
|
|
10
9
|
set isClickEnabled(bCanClick: boolean);
|
|
11
10
|
setVisible(bVisible: boolean): void;
|
package/dist/lythreeframe/Object/Components/Light/DirectionalLight/DirectionalLightComponent.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LightComponent } from "../LightComponent";
|
|
2
|
-
import { ColorRepresentation, DirectionalLight, Vector3 } from "three";
|
|
2
|
+
import { ColorRepresentation, DirectionalLight, Vector3 } from "three/webgpu";
|
|
3
3
|
import { World } from "../../../../Frame/World";
|
|
4
4
|
export declare class DirectionalLightComponent extends LightComponent {
|
|
5
5
|
get threeObject(): DirectionalLight;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BufferGeometry, Material, Matrix4 } from "three";
|
|
1
|
+
import { BufferGeometry, Material, Matrix4 } from "three/webgpu";
|
|
2
2
|
import { MeshComponent } from "../MeshComponent";
|
|
3
3
|
export declare class LYInstanceMeshComponent extends MeshComponent {
|
|
4
4
|
constructor(geometry: BufferGeometry, material: Material | Material[], matrices: Matrix4[]);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { BufferGeometry, Material, Mesh } from
|
|
2
|
-
import { Vector3 } from "three";
|
|
1
|
+
import { BufferGeometry, Material, Mesh } from "three/webgpu";
|
|
3
2
|
import { SceneComponent } from "../SceneComponent";
|
|
4
3
|
export declare class MeshComponent extends SceneComponent {
|
|
5
4
|
get threeObject(): Mesh | null;
|
|
@@ -13,10 +12,10 @@ export declare class MeshComponent extends SceneComponent {
|
|
|
13
12
|
constructor(geometry: BufferGeometry, material: Material | Material[] | null);
|
|
14
13
|
set castShadow(bCast: boolean);
|
|
15
14
|
get castShadow(): boolean;
|
|
16
|
-
set receiveShadow(bReceive:
|
|
17
|
-
get receiveShadow():
|
|
18
|
-
getBoundsCenterPosition():
|
|
19
|
-
getBoundsTopCenterPosition():
|
|
20
|
-
getBoundsBottomCenterPosition():
|
|
15
|
+
set receiveShadow(bReceive: any);
|
|
16
|
+
get receiveShadow(): any;
|
|
17
|
+
getBoundsCenterPosition(): any;
|
|
18
|
+
getBoundsTopCenterPosition(): any;
|
|
19
|
+
getBoundsBottomCenterPosition(): any;
|
|
21
20
|
destroyObject(): void;
|
|
22
21
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Material } from "three";
|
|
1
|
+
import { Material } from "three/webgpu";
|
|
2
2
|
import { MeshComponent } from "../MeshComponent";
|
|
3
3
|
export declare class BoxComponent extends MeshComponent {
|
|
4
4
|
constructor(width?: number, height?: number, depth?: number, widthSegments?: number, heightSegments?: number, depthSegments?: number, material?: Material);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Material } from "three";
|
|
1
|
+
import { Material } from "three/webgpu";
|
|
2
2
|
import { MeshComponent } from "../MeshComponent";
|
|
3
3
|
export declare class PlaneComponent extends MeshComponent {
|
|
4
4
|
constructor(width: number, height: number, material: Material, widthSegments?: number, heightSegments?: number);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { MeshBasicMaterial } from "three";
|
|
2
1
|
import { MeshComponent } from "../MeshComponent";
|
|
3
2
|
export declare class SphereComponent extends MeshComponent {
|
|
4
|
-
constructor(radius: number, material?:
|
|
3
|
+
constructor(radius: number, material?: any, widthSegments?: number, heightSegments?: number);
|
|
5
4
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Actor } from "../Actor";
|
|
2
|
-
import { Box3, Euler, Matrix4, Object3D, Quaternion, Vector3 } from "three";
|
|
2
|
+
import { Box3, Euler, Matrix4, Object3D, Quaternion, Vector3 } from "three/webgpu";
|
|
3
3
|
import { Component } from "./Component";
|
|
4
4
|
import { World } from "../../Frame/World";
|
|
5
5
|
import { AttachmentRules } from "../../Defines";
|
|
@@ -23,29 +23,29 @@ export declare class SceneComponent extends Component {
|
|
|
23
23
|
onAddedToWorld(world: World): void;
|
|
24
24
|
destroy(): void;
|
|
25
25
|
destroyObject(): void;
|
|
26
|
-
getPosition():
|
|
26
|
+
getPosition(): any;
|
|
27
27
|
setPosition(position: Vector3): void;
|
|
28
28
|
setPosition(x: number, y: number, z: number): void;
|
|
29
|
-
getRotation():
|
|
29
|
+
getRotation(): any;
|
|
30
30
|
setRotation(rotation: Euler): void;
|
|
31
31
|
setRotation(x: number, y: number, z: number): void;
|
|
32
|
-
getQuaternion():
|
|
32
|
+
getQuaternion(): any;
|
|
33
33
|
setQuaternion(quat: Quaternion): void;
|
|
34
34
|
setQuaternion(x: number, y: number, z: number, w: number): void;
|
|
35
|
-
getScale():
|
|
35
|
+
getScale(): any;
|
|
36
36
|
setScale(position: Vector3): void;
|
|
37
37
|
setScale(x: number, y: number, z: number): void;
|
|
38
38
|
getMatrix(): Matrix4;
|
|
39
39
|
setMatrix(matrix: Matrix4): void;
|
|
40
|
-
getWorldPosition():
|
|
41
|
-
getWorldRotation():
|
|
42
|
-
getWorldQuaternion():
|
|
43
|
-
getWorldScale():
|
|
44
|
-
getWorldMatrix():
|
|
40
|
+
getWorldPosition(): any;
|
|
41
|
+
getWorldRotation(): any;
|
|
42
|
+
getWorldQuaternion(): any;
|
|
43
|
+
getWorldScale(): any;
|
|
44
|
+
getWorldMatrix(): any;
|
|
45
45
|
setWorldMatrix(newMatrix: Matrix4): void;
|
|
46
|
-
getWorldForwardDirection():
|
|
47
|
-
getWorldUpDirection():
|
|
48
|
-
getWorldRightDirection():
|
|
46
|
+
getWorldForwardDirection(): any;
|
|
47
|
+
getWorldUpDirection(): any;
|
|
48
|
+
getWorldRightDirection(): any;
|
|
49
49
|
worldToLocal(vec: Vector3): Vector3;
|
|
50
50
|
localToWorld(vec: Vector3): Vector3;
|
|
51
51
|
attachComponent(newComponent: SceneComponent): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SkyMesh } from "three/examples/jsm/objects/SkyMesh.js";
|
|
2
|
+
import { SceneComponent } from "../SceneComponent";
|
|
3
|
+
export interface SkyComponentParam {
|
|
4
|
+
turbidity: number;
|
|
5
|
+
rayleigh: number;
|
|
6
|
+
mieCoefficient: number;
|
|
7
|
+
mieDirectionalG: number;
|
|
8
|
+
elevation: number;
|
|
9
|
+
azimuth: number;
|
|
10
|
+
}
|
|
11
|
+
export declare const DefaultSkyParam: SkyComponentParam;
|
|
12
|
+
export declare class SkyComponent extends SceneComponent {
|
|
13
|
+
get threeObject(): SkyMesh;
|
|
14
|
+
set threeObject(newThreeObject: SkyMesh);
|
|
15
|
+
protected obj: SkyMesh | null;
|
|
16
|
+
private skyParam;
|
|
17
|
+
private sunPosition;
|
|
18
|
+
constructor(skyparam?: SkyComponentParam);
|
|
19
|
+
private updateSky;
|
|
20
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Pawn } from "./Pawn";
|
|
2
2
|
import { Controller } from "../../Frame/Controller";
|
|
3
3
|
import { OrbitControls } from "three/examples/jsm/Addons.js";
|
|
4
|
-
import { Euler, Quaternion, Vector3 } from "three";
|
|
4
|
+
import { Euler, Quaternion, Vector3 } from "three/webgpu";
|
|
5
5
|
export declare class Orbital extends Pawn {
|
|
6
6
|
private anim;
|
|
7
7
|
get control(): OrbitControls;
|
|
8
8
|
protected _control: OrbitControls;
|
|
9
9
|
protected changeEvent: () => void;
|
|
10
|
-
get camera():
|
|
10
|
+
get camera(): any;
|
|
11
11
|
constructor(controller: Controller);
|
|
12
12
|
possess(): void;
|
|
13
13
|
unpossess(): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Euler, Quaternion, Vector3 } from "three";
|
|
1
|
+
import { Euler, Quaternion, Vector3 } from "three/webgpu";
|
|
2
2
|
import { Controller } from "../../Frame/Controller";
|
|
3
3
|
export declare abstract class Pawn {
|
|
4
|
-
get camera():
|
|
4
|
+
get camera(): any;
|
|
5
5
|
set enabled(value: boolean);
|
|
6
6
|
get control(): any;
|
|
7
7
|
protected _control: any | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Pawn } from "./Pawn";
|
|
2
|
-
import { Matrix4 } from "three";
|
|
2
|
+
import { Matrix4 } from "three/webgpu";
|
|
3
3
|
import { TransformControls } from "three/examples/jsm/controls/TransformControls.js";
|
|
4
4
|
import { Controller } from "../../Frame/Controller";
|
|
5
5
|
export interface TransformType {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OutlineParams } from './Param/Outline';
|
|
2
|
-
import { Scene, Camera, Object3D } from "three";
|
|
2
|
+
import { Scene, Camera, Object3D } from "three/webgpu";
|
|
3
3
|
import BloomNode from "three/examples/jsm/tsl/display/BloomNode.js";
|
|
4
4
|
import DenoiseNode from "three/examples/jsm/tsl/display/DenoiseNode.js";
|
|
5
5
|
import DepthOfFieldNode from "three/examples/jsm/tsl/display/DepthOfFieldNode.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { World } from "./Frame/World";
|
|
2
2
|
import { Viewport } from "./Frame/Viewport";
|
|
3
3
|
import { Controller } from "./Frame/Controller";
|
|
4
|
-
import { Clock, OrthographicCamera, PerspectiveCamera } from "three";
|
|
4
|
+
import { Clock, OrthographicCamera, PerspectiveCamera } from "three/webgpu";
|
|
5
5
|
import { Delegate } from './Delegate';
|
|
6
6
|
import { CameraParam } from './Frame/Parameters/CameraParameter';
|
|
7
7
|
import { AppParam } from './Frame/Parameters/AppParameter';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lythreeframe",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.23",
|
|
4
4
|
"description": "Three.js 封装",
|
|
5
5
|
"main": "dist/bundle.cjs.js",
|
|
6
6
|
"module": "dist/bundle.esm.js",
|
|
@@ -12,18 +12,18 @@
|
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
14
14
|
"gsap": "^3.12.2",
|
|
15
|
-
"three": "^0.
|
|
16
|
-
"@types/three": "^0.
|
|
15
|
+
"three": "^0.174.0",
|
|
16
|
+
"@types/three": "^0.174.0"
|
|
17
17
|
},
|
|
18
18
|
"files": [
|
|
19
19
|
"dist"
|
|
20
20
|
],
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@rollup/plugin-typescript": "^12.1.2",
|
|
23
|
-
"@types/three": "^0.
|
|
23
|
+
"@types/three": "^0.174.0",
|
|
24
24
|
"gsap": "^3.12.2",
|
|
25
25
|
"rollup": "^4.35.0",
|
|
26
|
-
"three": "^0.
|
|
26
|
+
"three": "^0.174.0",
|
|
27
27
|
"tslib": "^2.8.1",
|
|
28
28
|
"typescript": "^5.8.2"
|
|
29
29
|
},
|