lythreeframe 1.2.9 → 1.2.10
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
|
@@ -3259,15 +3259,42 @@ class TransformGizmo extends Pawn {
|
|
|
3259
3259
|
//const TA1 = this.primaryTarget.getMatrixInWorld();
|
|
3260
3260
|
this.helperObject.updateMatrixWorld(true);
|
|
3261
3261
|
const TA2 = this.helperObject.matrixWorld.clone();
|
|
3262
|
-
|
|
3262
|
+
let p1 = new webgpu.Vector3();
|
|
3263
|
+
let q1 = new webgpu.Quaternion();
|
|
3264
|
+
let s1 = new webgpu.Vector3();
|
|
3265
|
+
TA2.decompose(p1, q1, s1);
|
|
3266
|
+
let mode = this.getMode();
|
|
3267
|
+
if (mode === "translate") {
|
|
3268
|
+
this.primaryTarget.onTranslating(p1);
|
|
3269
|
+
}
|
|
3270
|
+
else if (mode === "rotate") {
|
|
3271
|
+
this.primaryTarget.onRotating(q1);
|
|
3272
|
+
}
|
|
3273
|
+
else if (mode === "scale") {
|
|
3274
|
+
this.primaryTarget.onScaling(s1);
|
|
3275
|
+
}
|
|
3276
|
+
// this.primaryTarget.onTransforming(TA2);
|
|
3263
3277
|
// const TA1Inverse = TA1.clone().invert();
|
|
3264
3278
|
//const transformMatrix = new Matrix4().multiplyMatrices(TA2, TA1Inverse);
|
|
3265
3279
|
this.targets.forEach((tar) => {
|
|
3266
3280
|
if (tar !== this.primaryTarget) {
|
|
3267
3281
|
let t = this.targetMatrixMap.get(tar);
|
|
3268
3282
|
if (t) {
|
|
3283
|
+
let p2 = new webgpu.Vector3();
|
|
3284
|
+
let q2 = new webgpu.Quaternion();
|
|
3285
|
+
let s2 = new webgpu.Vector3();
|
|
3269
3286
|
let TB2 = new webgpu.Matrix4().multiplyMatrices(TA2, t); // B
|
|
3270
|
-
|
|
3287
|
+
TB2.decompose(p2, q2, s2);
|
|
3288
|
+
if (mode === "translate") {
|
|
3289
|
+
tar.onTranslating(p2);
|
|
3290
|
+
}
|
|
3291
|
+
else if (mode === "rotate") {
|
|
3292
|
+
tar.onRotating(q2);
|
|
3293
|
+
}
|
|
3294
|
+
else if (mode === "scale") {
|
|
3295
|
+
tar.onScaling(s2);
|
|
3296
|
+
}
|
|
3297
|
+
// tar.onTransforming(TB2);
|
|
3271
3298
|
}
|
|
3272
3299
|
}
|
|
3273
3300
|
});
|
|
@@ -3275,7 +3302,7 @@ class TransformGizmo extends Pawn {
|
|
|
3275
3302
|
if (this.onUpdateFunction) {
|
|
3276
3303
|
this.onUpdateFunction();
|
|
3277
3304
|
}
|
|
3278
|
-
},
|
|
3305
|
+
}, 50);
|
|
3279
3306
|
de();
|
|
3280
3307
|
}
|
|
3281
3308
|
set enable(newEnable) {
|
package/dist/bundle.esm.js
CHANGED
|
@@ -3257,15 +3257,42 @@ class TransformGizmo extends Pawn {
|
|
|
3257
3257
|
//const TA1 = this.primaryTarget.getMatrixInWorld();
|
|
3258
3258
|
this.helperObject.updateMatrixWorld(true);
|
|
3259
3259
|
const TA2 = this.helperObject.matrixWorld.clone();
|
|
3260
|
-
|
|
3260
|
+
let p1 = new Vector3();
|
|
3261
|
+
let q1 = new Quaternion();
|
|
3262
|
+
let s1 = new Vector3();
|
|
3263
|
+
TA2.decompose(p1, q1, s1);
|
|
3264
|
+
let mode = this.getMode();
|
|
3265
|
+
if (mode === "translate") {
|
|
3266
|
+
this.primaryTarget.onTranslating(p1);
|
|
3267
|
+
}
|
|
3268
|
+
else if (mode === "rotate") {
|
|
3269
|
+
this.primaryTarget.onRotating(q1);
|
|
3270
|
+
}
|
|
3271
|
+
else if (mode === "scale") {
|
|
3272
|
+
this.primaryTarget.onScaling(s1);
|
|
3273
|
+
}
|
|
3274
|
+
// this.primaryTarget.onTransforming(TA2);
|
|
3261
3275
|
// const TA1Inverse = TA1.clone().invert();
|
|
3262
3276
|
//const transformMatrix = new Matrix4().multiplyMatrices(TA2, TA1Inverse);
|
|
3263
3277
|
this.targets.forEach((tar) => {
|
|
3264
3278
|
if (tar !== this.primaryTarget) {
|
|
3265
3279
|
let t = this.targetMatrixMap.get(tar);
|
|
3266
3280
|
if (t) {
|
|
3281
|
+
let p2 = new Vector3();
|
|
3282
|
+
let q2 = new Quaternion();
|
|
3283
|
+
let s2 = new Vector3();
|
|
3267
3284
|
let TB2 = new Matrix4().multiplyMatrices(TA2, t); // B
|
|
3268
|
-
|
|
3285
|
+
TB2.decompose(p2, q2, s2);
|
|
3286
|
+
if (mode === "translate") {
|
|
3287
|
+
tar.onTranslating(p2);
|
|
3288
|
+
}
|
|
3289
|
+
else if (mode === "rotate") {
|
|
3290
|
+
tar.onRotating(q2);
|
|
3291
|
+
}
|
|
3292
|
+
else if (mode === "scale") {
|
|
3293
|
+
tar.onScaling(s2);
|
|
3294
|
+
}
|
|
3295
|
+
// tar.onTransforming(TB2);
|
|
3269
3296
|
}
|
|
3270
3297
|
}
|
|
3271
3298
|
});
|
|
@@ -3273,7 +3300,7 @@ class TransformGizmo extends Pawn {
|
|
|
3273
3300
|
if (this.onUpdateFunction) {
|
|
3274
3301
|
this.onUpdateFunction();
|
|
3275
3302
|
}
|
|
3276
|
-
},
|
|
3303
|
+
}, 50);
|
|
3277
3304
|
de();
|
|
3278
3305
|
}
|
|
3279
3306
|
set enable(newEnable) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Pawn } from "./Pawn";
|
|
2
|
-
import { Matrix4 } from "three/webgpu";
|
|
2
|
+
import { Matrix4, Quaternion, Vector3 } 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 {
|
|
@@ -10,6 +10,9 @@ export interface TransformType {
|
|
|
10
10
|
export interface ITransforming {
|
|
11
11
|
isTransformAllowed(): boolean;
|
|
12
12
|
onTransforming(worldMatrix: Matrix4): void;
|
|
13
|
+
onTranslating(worldPos: Vector3): void;
|
|
14
|
+
onRotating(worldQuat: Quaternion): void;
|
|
15
|
+
onScaling(worldScale: Vector3): void;
|
|
13
16
|
getMatrixInWorld(): Matrix4;
|
|
14
17
|
getAllowedTransformType(): TransformType;
|
|
15
18
|
}
|