@vived/app 2.50.1 → 3.0.0
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/lib/AppObject/AppObject.d.ts +15 -0
- package/lib/AppObject/AppObject.js +65 -0
- package/lib/AppObject/AppObjectComponent.d.ts +6 -0
- package/lib/AppObject/AppObjectComponent.js +2 -0
- package/lib/AppObject/AppObjectEntity.d.ts +16 -0
- package/lib/AppObject/AppObjectEntity.js +40 -0
- package/lib/AppObject/AppObjectEntityRepo.d.ts +15 -0
- package/lib/AppObject/AppObjectEntityRepo.js +54 -0
- package/lib/AppObject/AppObjectPM.d.ts +15 -0
- package/lib/AppObject/AppObjectPM.js +38 -0
- package/lib/AppObject/AppObjectRepo.d.ts +19 -0
- package/lib/AppObject/AppObjectRepo.js +95 -0
- package/lib/AppObject/AppObjectUC.d.ts +8 -0
- package/lib/AppObject/AppObjectUC.js +17 -0
- package/lib/AppObject/IsEnabledPM.d.ts +11 -0
- package/lib/AppObject/IsEnabledPM.js +29 -0
- package/lib/AppObject/index.d.ts +7 -0
- package/lib/{UseCases/FocusCamera → AppObject}/index.js +7 -7
- package/lib/AppObjectComponents/ChannelModel/Entities/ChannelModel.d.ts +42 -0
- package/lib/AppObjectComponents/ChannelModel/Entities/ChannelModel.js +99 -0
- package/lib/AppObjectComponents/ChannelModel/Entities/ChannelModelRepo.d.ts +12 -0
- package/lib/AppObjectComponents/ChannelModel/Entities/ChannelModelRepo.js +45 -0
- package/lib/AppObjectComponents/ChannelModel/index.d.ts +2 -0
- package/lib/AppObjectComponents/ChannelModel/index.js +14 -0
- package/lib/AppObjectComponents/Hideable/Entities/Hideable.d.ts +10 -0
- package/lib/AppObjectComponents/Hideable/Entities/Hideable.js +31 -0
- package/lib/AppObjectComponents/Hideable/PresentationManagers/IsHiddenPM.d.ts +12 -0
- package/lib/AppObjectComponents/Hideable/PresentationManagers/IsHiddenPM.js +42 -0
- package/lib/AppObjectComponents/Hideable/index.d.ts +2 -0
- package/lib/AppObjectComponents/Hideable/index.js +14 -0
- package/lib/AppObjectComponents/Label/Entities/Label.d.ts +17 -0
- package/lib/AppObjectComponents/Label/Entities/Label.js +58 -0
- package/lib/AppObjectComponents/Label/PresentationManagers/LabelPM.d.ts +19 -0
- package/lib/AppObjectComponents/Label/PresentationManagers/LabelPM.js +62 -0
- package/lib/AppObjectComponents/Label/index.d.ts +2 -0
- package/lib/AppObjectComponents/Label/index.js +14 -0
- package/lib/AppObjectComponents/Mesh/Entities/Mesh.d.ts +21 -0
- package/lib/AppObjectComponents/Mesh/Entities/Mesh.js +45 -0
- package/lib/AppObjectComponents/Mesh/index.d.ts +1 -0
- package/lib/{UseCases/SceneObjects → AppObjectComponents/Mesh}/index.js +1 -1
- package/lib/AppObjectComponents/OverlayColor/Entities/OverlayColor.d.ts +25 -0
- package/lib/AppObjectComponents/OverlayColor/Entities/OverlayColor.js +59 -0
- package/lib/AppObjectComponents/OverlayColor/PresentationManagers/OverlayColorPM.d.ts +13 -0
- package/lib/AppObjectComponents/OverlayColor/PresentationManagers/OverlayColorPM.js +42 -0
- package/lib/AppObjectComponents/OverlayColor/index.d.ts +2 -0
- package/lib/AppObjectComponents/OverlayColor/index.js +14 -0
- package/lib/AppObjectComponents/Transform3D/Entities/Transform3D.d.ts +44 -0
- package/lib/AppObjectComponents/Transform3D/Entities/Transform3D.js +221 -0
- package/lib/AppObjectComponents/Transform3D/PresentationManagers/CanBeStuckPM.d.ts +12 -0
- package/lib/AppObjectComponents/Transform3D/PresentationManagers/CanBeStuckPM.js +45 -0
- package/lib/AppObjectComponents/Transform3D/PresentationManagers/Transform3DPM.d.ts +19 -0
- package/lib/AppObjectComponents/Transform3D/PresentationManagers/Transform3DPM.js +59 -0
- package/lib/AppObjectComponents/Transform3D/UseCases/PeelTransform3D.d.ts +20 -0
- package/lib/AppObjectComponents/Transform3D/UseCases/PeelTransform3D.js +67 -0
- package/lib/AppObjectComponents/Transform3D/UseCases/StickTransform3D.d.ts +14 -0
- package/lib/AppObjectComponents/Transform3D/UseCases/StickTransform3D.js +45 -0
- package/lib/AppObjectComponents/Transform3D/UseCases/getStickUC.d.ts +3 -0
- package/lib/AppObjectComponents/Transform3D/UseCases/getStickUC.js +8 -0
- package/lib/AppObjectComponents/Transform3D/index.d.ts +5 -0
- package/lib/AppObjectComponents/Transform3D/index.js +17 -0
- package/lib/AppObjectComponents/index.d.ts +6 -0
- package/lib/AppObjectComponents/index.js +18 -0
- package/lib/Entities/Babylon.d.ts +1 -0
- package/lib/Entities/ObserverList.d.ts +1 -0
- package/lib/Entities/ObserverList.js +3 -0
- package/lib/Entities/SceneModel.d.ts +1 -1
- package/lib/Entities/SceneModelMesh.d.ts +3 -44
- package/lib/Entities/SceneModelMesh.js +7 -114
- package/lib/Types/ChannelModelData.d.ts +68 -0
- package/lib/Types/ChannelModelData.js +21 -0
- package/lib/Types/EaseFn.d.ts +1 -0
- package/lib/Types/EaseFn.js +2 -0
- package/lib/Types/index.d.ts +2 -0
- package/lib/Types/index.js +14 -0
- package/lib/UseCases/SceneModel/index.d.ts +0 -3
- package/lib/UseCases/SceneModel/index.js +0 -3
- package/lib/UseCases/SceneModel/loadNewModel.d.ts +2 -2
- package/lib/UseCases/SceneModel/loadNewModel.js +15 -17
- package/lib/UseCases/index.d.ts +1 -1
- package/lib/UseCases/index.js +1 -1
- package/lib/UseCases/setupStandardAppObjects.d.ts +2 -0
- package/lib/UseCases/setupStandardAppObjects.js +10 -0
- package/lib/ValueObjects/Quaternion.d.ts +1 -0
- package/lib/ValueObjects/Quaternion.js +21 -1
- package/lib/index.d.ts +3 -0
- package/lib/index.js +4 -1
- package/package.json +1 -1
- package/lib/Entities/FocusCamera.d.ts +0 -70
- package/lib/Entities/FocusCamera.js +0 -272
- package/lib/Entities/MemoizedBoolean.d.ts +0 -8
- package/lib/Entities/MemoizedBoolean.js +0 -22
- package/lib/Entities/MemoizedNumber.d.ts +0 -8
- package/lib/Entities/MemoizedNumber.js +0 -22
- package/lib/Entities/MemoizedQuaternion.d.ts +0 -9
- package/lib/Entities/MemoizedQuaternion.js +0 -23
- package/lib/Entities/MemoizedString.d.ts +0 -8
- package/lib/Entities/MemoizedString.js +0 -22
- package/lib/Entities/MemoizedVector2.d.ts +0 -9
- package/lib/Entities/MemoizedVector2.js +0 -23
- package/lib/Entities/MemoizedVector3.d.ts +0 -9
- package/lib/Entities/MemoizedVector3.js +0 -23
- package/lib/Entities/MeshModel.d.ts +0 -68
- package/lib/Entities/MeshModel.js +0 -174
- package/lib/Entities/ModelObject.d.ts +0 -10
- package/lib/Entities/ModelObject.js +0 -42
- package/lib/PresentationManagers/FocusCameraPM.d.ts +0 -15
- package/lib/PresentationManagers/FocusCameraPM.js +0 -31
- package/lib/PresentationManagers/FocusCameraPosRotPM.d.ts +0 -13
- package/lib/PresentationManagers/FocusCameraPosRotPM.js +0 -28
- package/lib/PresentationManagers/SceneModel/SceneMeshOverlayPM.d.ts +0 -15
- package/lib/PresentationManagers/SceneModel/SceneMeshOverlayPM.js +0 -34
- package/lib/UseCases/FocusCamera/BumpDollyFocusCamera.d.ts +0 -17
- package/lib/UseCases/FocusCamera/BumpDollyFocusCamera.js +0 -64
- package/lib/UseCases/FocusCamera/LerpFocusCamera.d.ts +0 -36
- package/lib/UseCases/FocusCamera/LerpFocusCamera.js +0 -71
- package/lib/UseCases/FocusCamera/PinchDollyFocusCamera.d.ts +0 -11
- package/lib/UseCases/FocusCamera/PinchDollyFocusCamera.js +0 -36
- package/lib/UseCases/FocusCamera/PixelDollyFocusCamera.d.ts +0 -11
- package/lib/UseCases/FocusCamera/PixelDollyFocusCamera.js +0 -36
- package/lib/UseCases/FocusCamera/PixelOrbitFocusCamera.d.ts +0 -11
- package/lib/UseCases/FocusCamera/PixelOrbitFocusCamera.js +0 -26
- package/lib/UseCases/FocusCamera/PixelPlanePanFocusCamera.d.ts +0 -11
- package/lib/UseCases/FocusCamera/PixelPlanePanFocusCamera.js +0 -33
- package/lib/UseCases/FocusCamera/SerializeFocusCamera.d.ts +0 -22
- package/lib/UseCases/FocusCamera/SerializeFocusCamera.js +0 -81
- package/lib/UseCases/FocusCamera/index.d.ts +0 -7
- package/lib/UseCases/SceneModel/SerializeActiveModel.d.ts +0 -18
- package/lib/UseCases/SceneModel/SerializeActiveModel.js +0 -74
- package/lib/UseCases/SceneModel/SetMeshesEnabledHook.d.ts +0 -7
- package/lib/UseCases/SceneModel/SetMeshesEnabledHook.js +0 -22
- package/lib/UseCases/SceneModel/SetSceneModelMeshOverlayColor.d.ts +0 -2
- package/lib/UseCases/SceneModel/SetSceneModelMeshOverlayColor.js +0 -13
- package/lib/UseCases/SceneObjects/PeelSceneObject.d.ts +0 -18
- package/lib/UseCases/SceneObjects/PeelSceneObject.js +0 -61
- package/lib/UseCases/SceneObjects/index.d.ts +0 -1
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Transform3D = void 0;
|
|
4
|
+
const AppObject_1 = require("../../../AppObject");
|
|
5
|
+
const ValueObjects_1 = require("../../../ValueObjects");
|
|
6
|
+
class Transform3D extends AppObject_1.AppObjectEntity {
|
|
7
|
+
constructor(appObject) {
|
|
8
|
+
super(appObject, Transform3D.type);
|
|
9
|
+
this._transformationMatrix = ValueObjects_1.Matrix.Identity();
|
|
10
|
+
this.localPointToWorld = (point) => {
|
|
11
|
+
return ValueObjects_1.Vector3.Transform(point, this.worldMatrix);
|
|
12
|
+
};
|
|
13
|
+
this.worldPointToLocal = (point) => {
|
|
14
|
+
const worldInverse = ValueObjects_1.Matrix.Invert(this.worldMatrix);
|
|
15
|
+
return ValueObjects_1.Vector3.Transform(point, worldInverse);
|
|
16
|
+
};
|
|
17
|
+
this.localDirectionToWorld = (point) => {
|
|
18
|
+
const rotationMatrix = ValueObjects_1.Quaternion.ToRotationMatrix(this.worldRotation);
|
|
19
|
+
return ValueObjects_1.Vector3.Transform(point, rotationMatrix).unit;
|
|
20
|
+
};
|
|
21
|
+
this.worldDirectionToLocal = (point) => {
|
|
22
|
+
const worldInverse = ValueObjects_1.Matrix.Invert(this.worldMatrix);
|
|
23
|
+
const rotationMatrix = ValueObjects_1.Quaternion.ToRotationMatrix(worldInverse.rotation);
|
|
24
|
+
return ValueObjects_1.Vector3.Transform(point, rotationMatrix).unit;
|
|
25
|
+
};
|
|
26
|
+
this.chrono = 0;
|
|
27
|
+
this.lerpDuration = 1;
|
|
28
|
+
this.lerpEase = (p) => p;
|
|
29
|
+
this.tickInterval = 10;
|
|
30
|
+
this.lerp = (duration, ease, desiredPosition, desiredRotation, desiredScale, onCompletedCallback) => {
|
|
31
|
+
this.cancelLerp();
|
|
32
|
+
this.chrono = 0;
|
|
33
|
+
this.lerpDuration = duration;
|
|
34
|
+
this.lerpEase = ease;
|
|
35
|
+
if (duration <= 0) {
|
|
36
|
+
this.localMatrix = ValueObjects_1.Matrix.Compose(desiredScale !== null && desiredScale !== void 0 ? desiredScale : this.localScale, desiredRotation !== null && desiredRotation !== void 0 ? desiredRotation : this.localRotation, desiredPosition !== null && desiredPosition !== void 0 ? desiredPosition : this.localPosition);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (desiredPosition) {
|
|
40
|
+
this.lerpPos = [this.localPosition, desiredPosition];
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
this.lerpPos = undefined;
|
|
44
|
+
}
|
|
45
|
+
if (desiredRotation) {
|
|
46
|
+
this.lerpQuat = [this.localRotation, desiredRotation];
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
this.lerpQuat = undefined;
|
|
50
|
+
}
|
|
51
|
+
if (desiredScale) {
|
|
52
|
+
this.lerpScale = [this.localScale, desiredScale];
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
this.lerpScale = undefined;
|
|
56
|
+
}
|
|
57
|
+
this.onLerpCompletedCallback = onCompletedCallback;
|
|
58
|
+
this.interval = setInterval(() => {
|
|
59
|
+
this.tickLerp();
|
|
60
|
+
}, this.tickInterval);
|
|
61
|
+
};
|
|
62
|
+
this.tickLerp = () => {
|
|
63
|
+
this.chrono = this.chrono + this.tickInterval;
|
|
64
|
+
let nomralizedTime = this.chrono / this.lerpDuration;
|
|
65
|
+
if (nomralizedTime > 1) {
|
|
66
|
+
nomralizedTime = 1;
|
|
67
|
+
}
|
|
68
|
+
const percent = this.lerpEase(nomralizedTime);
|
|
69
|
+
let pos = this.localPosition;
|
|
70
|
+
if (this.lerpPos) {
|
|
71
|
+
pos = ValueObjects_1.Vector3.Lerp(this.lerpPos[0], this.lerpPos[1], percent);
|
|
72
|
+
}
|
|
73
|
+
let rotation = this.localRotation;
|
|
74
|
+
if (this.lerpQuat) {
|
|
75
|
+
rotation = ValueObjects_1.Quaternion.Slerp(this.lerpQuat[0], this.lerpQuat[1], percent);
|
|
76
|
+
}
|
|
77
|
+
let scale = this.localScale;
|
|
78
|
+
if (this.lerpScale) {
|
|
79
|
+
scale = ValueObjects_1.Vector3.Lerp(this.lerpScale[0], this.lerpScale[1], percent);
|
|
80
|
+
}
|
|
81
|
+
this._transformationMatrix = ValueObjects_1.Matrix.Compose(scale, rotation, pos);
|
|
82
|
+
this.notifyOnChange();
|
|
83
|
+
if (nomralizedTime >= 1 && this.interval) {
|
|
84
|
+
if (this.onLerpCompletedCallback) {
|
|
85
|
+
this.onLerpCompletedCallback();
|
|
86
|
+
}
|
|
87
|
+
clearInterval(this.interval);
|
|
88
|
+
this.interval = undefined;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
this.cancelLerp = () => {
|
|
92
|
+
if (this.interval) {
|
|
93
|
+
clearInterval(this.interval);
|
|
94
|
+
this.interval = undefined;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
static addIfMissing(appObj) {
|
|
99
|
+
const existing = appObj.getComponent(this.type);
|
|
100
|
+
if (existing) {
|
|
101
|
+
return existing;
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
return new Transform3D(appObj);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
static get(appObj) {
|
|
108
|
+
return appObj.getComponent(this.type);
|
|
109
|
+
}
|
|
110
|
+
get localMatrix() {
|
|
111
|
+
return this._transformationMatrix;
|
|
112
|
+
}
|
|
113
|
+
set localMatrix(val) {
|
|
114
|
+
if (ValueObjects_1.Matrix.Close(this._transformationMatrix, val))
|
|
115
|
+
return;
|
|
116
|
+
this.cancelLerp();
|
|
117
|
+
this._transformationMatrix = val;
|
|
118
|
+
this.notifyOnChange();
|
|
119
|
+
}
|
|
120
|
+
get worldMatrix() {
|
|
121
|
+
if (!this._parent) {
|
|
122
|
+
return this._transformationMatrix;
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
return ValueObjects_1.Matrix.Multiply(this._parent.worldMatrix, this._transformationMatrix);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
get localPosition() {
|
|
129
|
+
return this._transformationMatrix.translation;
|
|
130
|
+
}
|
|
131
|
+
set localPosition(val) {
|
|
132
|
+
const currentPos = this._transformationMatrix.translation;
|
|
133
|
+
if (ValueObjects_1.Vector3.Close(val, currentPos, 0.00001))
|
|
134
|
+
return;
|
|
135
|
+
this.cancelLerp();
|
|
136
|
+
this._transformationMatrix = ValueObjects_1.Matrix.SetMatrixTranslation(this._transformationMatrix, val);
|
|
137
|
+
this.notifyOnChange();
|
|
138
|
+
}
|
|
139
|
+
get worldPosition() {
|
|
140
|
+
return this.worldMatrix.translation;
|
|
141
|
+
}
|
|
142
|
+
set worldPosition(val) {
|
|
143
|
+
if (!this._parent) {
|
|
144
|
+
this.localPosition = val;
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
const local = this._parent.worldPointToLocal(val);
|
|
148
|
+
this.localPosition = local;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
get localRotation() {
|
|
152
|
+
return this._transformationMatrix.rotation;
|
|
153
|
+
}
|
|
154
|
+
set localRotation(val) {
|
|
155
|
+
const currentRot = this._transformationMatrix.rotation;
|
|
156
|
+
if (ValueObjects_1.Quaternion.Close(val, currentRot))
|
|
157
|
+
return;
|
|
158
|
+
this.cancelLerp();
|
|
159
|
+
this._transformationMatrix = ValueObjects_1.Matrix.SetMatrixRotation(this._transformationMatrix, val);
|
|
160
|
+
this.notifyOnChange();
|
|
161
|
+
}
|
|
162
|
+
get worldRotation() {
|
|
163
|
+
return this.worldMatrix.rotation;
|
|
164
|
+
}
|
|
165
|
+
set worldRotation(val) {
|
|
166
|
+
if (!this._parent) {
|
|
167
|
+
this.localRotation = val;
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
const parentRotation = this._parent.worldRotation;
|
|
171
|
+
const parentRotationInverse = ValueObjects_1.Quaternion.Inverse(parentRotation);
|
|
172
|
+
this.localRotation = ValueObjects_1.Quaternion.Multiply(parentRotationInverse, val);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
get localScale() {
|
|
176
|
+
return this._transformationMatrix.scale;
|
|
177
|
+
}
|
|
178
|
+
set localScale(val) {
|
|
179
|
+
const currentScale = this._transformationMatrix.scale;
|
|
180
|
+
if (ValueObjects_1.Vector3.Close(val, currentScale, 0.00001))
|
|
181
|
+
return;
|
|
182
|
+
this.cancelLerp();
|
|
183
|
+
this._transformationMatrix = ValueObjects_1.Matrix.SetMatrixScale(this._transformationMatrix, val);
|
|
184
|
+
this.notifyOnChange();
|
|
185
|
+
}
|
|
186
|
+
get worldScale() {
|
|
187
|
+
return this.worldMatrix.scale;
|
|
188
|
+
}
|
|
189
|
+
set worldScale(val) {
|
|
190
|
+
if (!this._parent) {
|
|
191
|
+
this.localScale = val;
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
const parentScale = this._parent.worldScale;
|
|
195
|
+
const x = val.x / parentScale.x;
|
|
196
|
+
const y = val.y / parentScale.y;
|
|
197
|
+
const z = val.z / parentScale.z;
|
|
198
|
+
this.localScale = new ValueObjects_1.Vector3(x, y, z);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
get parent() {
|
|
202
|
+
return this._parent;
|
|
203
|
+
}
|
|
204
|
+
set parent(val) {
|
|
205
|
+
if (this._parent === val)
|
|
206
|
+
return;
|
|
207
|
+
const wMatrix = this.worldMatrix;
|
|
208
|
+
this._parent = val;
|
|
209
|
+
if (this._parent) {
|
|
210
|
+
const parentMatrix = this._parent.worldMatrix;
|
|
211
|
+
const parentMatrixInverse = ValueObjects_1.Matrix.Invert(parentMatrix);
|
|
212
|
+
this.localMatrix = ValueObjects_1.Matrix.Multiply(parentMatrixInverse, wMatrix);
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
this.localMatrix = wMatrix;
|
|
216
|
+
}
|
|
217
|
+
this.notifyOnChange();
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
exports.Transform3D = Transform3D;
|
|
221
|
+
Transform3D.type = "TRANSFORM_3D";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AppObject } from "../../../AppObject/AppObject";
|
|
2
|
+
import { AppObjectPM } from "../../../AppObject/AppObjectPM";
|
|
3
|
+
import { AppObjectRepo } from "../../../AppObject/AppObjectRepo";
|
|
4
|
+
export declare class CanBeStuckPM extends AppObjectPM<boolean> {
|
|
5
|
+
static readonly type = "CanBeStuckPM";
|
|
6
|
+
private transform?;
|
|
7
|
+
onTransformChange: () => void;
|
|
8
|
+
dispose: () => void;
|
|
9
|
+
vmsAreEqual(a: boolean, b: boolean): boolean;
|
|
10
|
+
constructor(appObject: AppObject);
|
|
11
|
+
static getForID(appObjID: string, appObjects: AppObjectRepo): CanBeStuckPM | undefined;
|
|
12
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CanBeStuckPM = void 0;
|
|
4
|
+
const AppObjectPM_1 = require("../../../AppObject/AppObjectPM");
|
|
5
|
+
const ValueObjects_1 = require("../../../ValueObjects");
|
|
6
|
+
const Transform3D_1 = require("../Entities/Transform3D");
|
|
7
|
+
class CanBeStuckPM extends AppObjectPM_1.AppObjectPM {
|
|
8
|
+
constructor(appObject) {
|
|
9
|
+
super(appObject, CanBeStuckPM.type);
|
|
10
|
+
this.onTransformChange = () => {
|
|
11
|
+
if (!this.transform)
|
|
12
|
+
return;
|
|
13
|
+
const pos = this.transform.localPosition;
|
|
14
|
+
const canBeStuck = !ValueObjects_1.Vector3.Close(pos, ValueObjects_1.Vector3.Zero());
|
|
15
|
+
this.doUpdateView(canBeStuck);
|
|
16
|
+
};
|
|
17
|
+
this.dispose = () => {
|
|
18
|
+
var _a, _b;
|
|
19
|
+
(_a = this.transform) === null || _a === void 0 ? void 0 : _a.removeChangeObserver(this.onTransformChange);
|
|
20
|
+
(_b = this.transform) === null || _b === void 0 ? void 0 : _b.removeOnDisposeObserver(this.dispose);
|
|
21
|
+
};
|
|
22
|
+
this.transform = Transform3D_1.Transform3D.get(appObject);
|
|
23
|
+
if (!this.transform) {
|
|
24
|
+
console.warn("[CanBeStuckPM] Unable to find Transform3D Entity");
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
this.transform.addChangeObserver(this.onTransformChange);
|
|
29
|
+
this.transform.addOnDisposeObserver(() => this.dispose());
|
|
30
|
+
this.onTransformChange();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
vmsAreEqual(a, b) {
|
|
34
|
+
return a === b;
|
|
35
|
+
}
|
|
36
|
+
static getForID(appObjID, appObjects) {
|
|
37
|
+
const appObj = appObjects.get(appObjID);
|
|
38
|
+
if (appObj === undefined) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
return appObj.getComponent(CanBeStuckPM.type);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.CanBeStuckPM = CanBeStuckPM;
|
|
45
|
+
CanBeStuckPM.type = "CanBeStuckPM";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AppObject } from "../../../AppObject/AppObject";
|
|
2
|
+
import { AppObjectPM } from "../../../AppObject/AppObjectPM";
|
|
3
|
+
import { AppObjectRepo } from "../../../AppObject/AppObjectRepo";
|
|
4
|
+
import { Quaternion, Vector3 } from "../../../ValueObjects";
|
|
5
|
+
export interface Transform3DVM {
|
|
6
|
+
position: Vector3;
|
|
7
|
+
rotation: Quaternion;
|
|
8
|
+
scale: Vector3;
|
|
9
|
+
}
|
|
10
|
+
export declare class Transform3DPM extends AppObjectPM<Transform3DVM> {
|
|
11
|
+
static readonly type = "Transform3DPM";
|
|
12
|
+
private transform?;
|
|
13
|
+
onTransformChange: () => void;
|
|
14
|
+
vmsAreEqual(a: Transform3DVM, b: Transform3DVM): boolean;
|
|
15
|
+
dispose: () => void;
|
|
16
|
+
constructor(appObject: AppObject);
|
|
17
|
+
static defaultTransform3DVM: Transform3DVM;
|
|
18
|
+
static getForID(appObjID: string, appObjects: AppObjectRepo): Transform3DPM | undefined;
|
|
19
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Transform3DPM = void 0;
|
|
4
|
+
const AppObjectPM_1 = require("../../../AppObject/AppObjectPM");
|
|
5
|
+
const ValueObjects_1 = require("../../../ValueObjects");
|
|
6
|
+
const Transform3D_1 = require("../Entities/Transform3D");
|
|
7
|
+
class Transform3DPM extends AppObjectPM_1.AppObjectPM {
|
|
8
|
+
constructor(appObject) {
|
|
9
|
+
super(appObject, Transform3DPM.type);
|
|
10
|
+
this.onTransformChange = () => {
|
|
11
|
+
if (!this.transform)
|
|
12
|
+
return;
|
|
13
|
+
const vm = {
|
|
14
|
+
position: this.transform.localPosition,
|
|
15
|
+
rotation: this.transform.localRotation,
|
|
16
|
+
scale: this.transform.localScale
|
|
17
|
+
};
|
|
18
|
+
this.doUpdateView(vm);
|
|
19
|
+
};
|
|
20
|
+
this.dispose = () => {
|
|
21
|
+
var _a, _b;
|
|
22
|
+
(_a = this.transform) === null || _a === void 0 ? void 0 : _a.removeChangeObserver(this.onTransformChange);
|
|
23
|
+
(_b = this.transform) === null || _b === void 0 ? void 0 : _b.removeOnDisposeObserver(this.dispose);
|
|
24
|
+
};
|
|
25
|
+
this.transform = Transform3D_1.Transform3D.get(appObject);
|
|
26
|
+
if (!this.transform) {
|
|
27
|
+
console.warn("[CanBeStuckPM] Unable to find Transform3D Entity");
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
this.transform.addChangeObserver(this.onTransformChange);
|
|
32
|
+
this.transform.addOnDisposeObserver(() => this.dispose());
|
|
33
|
+
this.onTransformChange();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
vmsAreEqual(a, b) {
|
|
37
|
+
if (!ValueObjects_1.Vector3.Equal(a.position, b.position))
|
|
38
|
+
return false;
|
|
39
|
+
if (!ValueObjects_1.Vector3.Equal(a.scale, b.scale))
|
|
40
|
+
return false;
|
|
41
|
+
if (!ValueObjects_1.Quaternion.Equal(a.rotation, b.rotation))
|
|
42
|
+
return false;
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
static getForID(appObjID, appObjects) {
|
|
46
|
+
const appObj = appObjects.get(appObjID);
|
|
47
|
+
if (appObj === undefined) {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
return appObj.getComponent(Transform3DPM.type);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.Transform3DPM = Transform3DPM;
|
|
54
|
+
Transform3DPM.type = "Transform3DPM";
|
|
55
|
+
Transform3DPM.defaultTransform3DVM = {
|
|
56
|
+
position: ValueObjects_1.Vector3.Zero(),
|
|
57
|
+
rotation: ValueObjects_1.Quaternion.Identity(),
|
|
58
|
+
scale: ValueObjects_1.Vector3.One()
|
|
59
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AppObject } from "../../../AppObject";
|
|
2
|
+
import { AppObjectUC } from "../../../AppObject/AppObjectUC";
|
|
3
|
+
import { Vector3 } from "../../../ValueObjects";
|
|
4
|
+
export declare class PeelTransform3D extends AppObjectUC {
|
|
5
|
+
static readonly type = "PeelTransform3D";
|
|
6
|
+
private transform?;
|
|
7
|
+
get didPeel(): boolean;
|
|
8
|
+
private _startPeelPos;
|
|
9
|
+
get startPeelPosition(): Vector3;
|
|
10
|
+
private _endPeelPosition;
|
|
11
|
+
get endPeelPosition(): Vector3;
|
|
12
|
+
private isPeeling;
|
|
13
|
+
private pickOffset;
|
|
14
|
+
initializePeel: (initialPick: Vector3) => void;
|
|
15
|
+
updatePeel: (pick: Vector3) => void;
|
|
16
|
+
stopPeel: () => void;
|
|
17
|
+
dispose: () => void;
|
|
18
|
+
constructor(appObject: AppObject);
|
|
19
|
+
static get(appObj: AppObject): PeelTransform3D | undefined;
|
|
20
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PeelTransform3D = void 0;
|
|
4
|
+
const AppObjectUC_1 = require("../../../AppObject/AppObjectUC");
|
|
5
|
+
const ValueObjects_1 = require("../../../ValueObjects");
|
|
6
|
+
const Transform3D_1 = require("../Entities/Transform3D");
|
|
7
|
+
class PeelTransform3D extends AppObjectUC_1.AppObjectUC {
|
|
8
|
+
constructor(appObject) {
|
|
9
|
+
super(appObject, PeelTransform3D.type);
|
|
10
|
+
this._startPeelPos = ValueObjects_1.Vector3.Zero();
|
|
11
|
+
this._endPeelPosition = ValueObjects_1.Vector3.Zero();
|
|
12
|
+
this.isPeeling = false;
|
|
13
|
+
this.pickOffset = ValueObjects_1.Vector3.Zero();
|
|
14
|
+
this.initializePeel = (initialPick) => {
|
|
15
|
+
this.isPeeling = false;
|
|
16
|
+
this._startPeelPos = ValueObjects_1.Vector3.Zero();
|
|
17
|
+
this._endPeelPosition = ValueObjects_1.Vector3.Zero();
|
|
18
|
+
if (!this.transform) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const worldPos = this.transform.worldPosition;
|
|
22
|
+
this.pickOffset = ValueObjects_1.Vector3.Subtract(worldPos, initialPick);
|
|
23
|
+
this._startPeelPos = this.transform.localPosition;
|
|
24
|
+
this.isPeeling = true;
|
|
25
|
+
};
|
|
26
|
+
this.updatePeel = (pick) => {
|
|
27
|
+
if (!this.isPeeling)
|
|
28
|
+
return;
|
|
29
|
+
if (!this.transform)
|
|
30
|
+
return;
|
|
31
|
+
this.transform.worldPosition = ValueObjects_1.Vector3.Add(pick, this.pickOffset);
|
|
32
|
+
};
|
|
33
|
+
this.stopPeel = () => {
|
|
34
|
+
if (!this.transform)
|
|
35
|
+
return;
|
|
36
|
+
this._endPeelPosition = this.transform.localPosition;
|
|
37
|
+
this.isPeeling = false;
|
|
38
|
+
this.pickOffset = ValueObjects_1.Vector3.Zero();
|
|
39
|
+
};
|
|
40
|
+
this.dispose = () => {
|
|
41
|
+
var _a;
|
|
42
|
+
super.dispose();
|
|
43
|
+
(_a = this.transform) === null || _a === void 0 ? void 0 : _a.removeOnDisposeObserver(this.dispose);
|
|
44
|
+
};
|
|
45
|
+
this.transform = appObject.getComponent(Transform3D_1.Transform3D.type);
|
|
46
|
+
if (!this.transform) {
|
|
47
|
+
console.warn("Peel Transform UC has been added to an App Object that does not have a Transform3D. Add a transform 3D before adding the UC");
|
|
48
|
+
this.dispose();
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
this.transform.addOnDisposeObserver(this.dispose);
|
|
52
|
+
}
|
|
53
|
+
get didPeel() {
|
|
54
|
+
return !ValueObjects_1.Vector3.Equal(this._startPeelPos, this._endPeelPosition);
|
|
55
|
+
}
|
|
56
|
+
get startPeelPosition() {
|
|
57
|
+
return this._startPeelPos;
|
|
58
|
+
}
|
|
59
|
+
get endPeelPosition() {
|
|
60
|
+
return this._endPeelPosition;
|
|
61
|
+
}
|
|
62
|
+
static get(appObj) {
|
|
63
|
+
return appObj.getComponent(this.type);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.PeelTransform3D = PeelTransform3D;
|
|
67
|
+
PeelTransform3D.type = "PeelTransform3D";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AppObject } from "../../../AppObject";
|
|
2
|
+
import { AppObjectUC } from "../../../AppObject/AppObjectUC";
|
|
3
|
+
import { EaseFn } from "../../../Types";
|
|
4
|
+
export declare class StickTransform3D extends AppObjectUC {
|
|
5
|
+
static readonly type = "StickTransform3D";
|
|
6
|
+
stickDurationMS: number;
|
|
7
|
+
easeFn: EaseFn;
|
|
8
|
+
private transform?;
|
|
9
|
+
get canBeStuck(): boolean;
|
|
10
|
+
stick(onCompleteCallback?: () => void): void;
|
|
11
|
+
dispose: () => void;
|
|
12
|
+
constructor(appObject: AppObject);
|
|
13
|
+
static get(appObj: AppObject): StickTransform3D | undefined;
|
|
14
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StickTransform3D = void 0;
|
|
4
|
+
const AppObjectUC_1 = require("../../../AppObject/AppObjectUC");
|
|
5
|
+
const ValueObjects_1 = require("../../../ValueObjects");
|
|
6
|
+
const Transform3D_1 = require("../Entities/Transform3D");
|
|
7
|
+
class StickTransform3D extends AppObjectUC_1.AppObjectUC {
|
|
8
|
+
constructor(appObject) {
|
|
9
|
+
super(appObject, StickTransform3D.type);
|
|
10
|
+
this.stickDurationMS = 500;
|
|
11
|
+
this.easeFn = (v) => v;
|
|
12
|
+
this.dispose = () => {
|
|
13
|
+
var _a;
|
|
14
|
+
super.dispose();
|
|
15
|
+
(_a = this.transform) === null || _a === void 0 ? void 0 : _a.removeOnDisposeObserver(this.dispose);
|
|
16
|
+
};
|
|
17
|
+
this.transform = appObject.getComponent(Transform3D_1.Transform3D.type);
|
|
18
|
+
if (!this.transform) {
|
|
19
|
+
console.warn("Peel Transform UC has been added to an App Object that does not have a Transform3D. Add a transform 3D before adding the UC");
|
|
20
|
+
this.dispose();
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
this.transform.addOnDisposeObserver(this.dispose);
|
|
24
|
+
}
|
|
25
|
+
get canBeStuck() {
|
|
26
|
+
if (!this.transform)
|
|
27
|
+
return false;
|
|
28
|
+
return !ValueObjects_1.Vector3.Equal(this.transform.localPosition, ValueObjects_1.Vector3.Zero());
|
|
29
|
+
}
|
|
30
|
+
stick(onCompleteCallback) {
|
|
31
|
+
var _a;
|
|
32
|
+
if (!this.canBeStuck) {
|
|
33
|
+
if (onCompleteCallback) {
|
|
34
|
+
onCompleteCallback();
|
|
35
|
+
}
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
(_a = this.transform) === null || _a === void 0 ? void 0 : _a.lerp(this.stickDurationMS, this.easeFn, ValueObjects_1.Vector3.Zero(), undefined, undefined, onCompleteCallback);
|
|
39
|
+
}
|
|
40
|
+
static get(appObj) {
|
|
41
|
+
return appObj.getComponent(this.type);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.StickTransform3D = StickTransform3D;
|
|
45
|
+
StickTransform3D.type = "StickTransform3D";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getStickUC = void 0;
|
|
4
|
+
const StickTransform3D_1 = require("./StickTransform3D");
|
|
5
|
+
function getStickUC(appObject) {
|
|
6
|
+
return appObject.getUC(StickTransform3D_1.STICK_TRANFORM3D_UC_TYPE);
|
|
7
|
+
}
|
|
8
|
+
exports.getStickUC = getStickUC;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./Entities/Transform3D"), exports);
|
|
14
|
+
__exportStar(require("./UseCases/PeelTransform3D"), exports);
|
|
15
|
+
__exportStar(require("./UseCases/StickTransform3D"), exports);
|
|
16
|
+
__exportStar(require("./PresentationManagers/Transform3DPM"), exports);
|
|
17
|
+
__exportStar(require("./PresentationManagers/CanBeStuckPM"), exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./ChannelModel"), exports);
|
|
14
|
+
__exportStar(require("./Hideable"), exports);
|
|
15
|
+
__exportStar(require("./Label"), exports);
|
|
16
|
+
__exportStar(require("./Mesh"), exports);
|
|
17
|
+
__exportStar(require("./OverlayColor"), exports);
|
|
18
|
+
__exportStar(require("./Transform3D"), exports);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Quaternion, Vector3 } from "../ValueObjects";
|
|
2
2
|
import { ObservableEntity } from "./ObservableEntity";
|
|
3
|
-
import { SceneModelObjectDTOv1, SceneModelObjectDTOv0
|
|
3
|
+
import { SceneModelMesh, SceneModelObjectDTOv1, SceneModelObjectDTOv0 } from "./SceneModelMesh";
|
|
4
4
|
export declare enum SceneModelState {
|
|
5
5
|
INIT = "Initialized",
|
|
6
6
|
LOADING = "Loading",
|