@vived/app 2.20.1 → 2.21.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/Core/BaseApp/Boundary.d.ts +49 -0
- package/lib/Core/BaseApp/Boundary.js +2 -0
- package/lib/Core/BaseApp/Entity.d.ts +11 -0
- package/lib/Core/BaseApp/Entity.js +2 -0
- package/lib/Core/BaseApp/Errors/ErrorDuplicateSystemName.d.ts +3 -0
- package/lib/Core/BaseApp/Errors/ErrorDuplicateSystemName.js +12 -0
- package/lib/Core/BaseApp/Errors/ErrorNoHostHandler.d.ts +3 -0
- package/lib/Core/BaseApp/Errors/ErrorNoHostHandler.js +10 -0
- package/lib/Core/BaseApp/Errors/ErrorUnsupportedVersionNumber.d.ts +3 -0
- package/lib/Core/BaseApp/Errors/ErrorUnsupportedVersionNumber.js +10 -0
- package/lib/Core/BaseApp/Errors/index.d.ts +3 -0
- package/lib/Core/BaseApp/Errors/index.js +15 -0
- package/lib/Core/BaseApp/UseCase.d.ts +43 -0
- package/lib/Core/BaseApp/UseCase.js +250 -0
- package/lib/Core/BaseAppState/Boundary.d.ts +14 -0
- package/lib/Core/BaseAppState/Boundary.js +2 -0
- package/lib/Core/BaseAppState/Entity.d.ts +5 -0
- package/lib/Core/BaseAppState/Entity.js +2 -0
- package/lib/Core/BaseAppState/UseCase.d.ts +16 -0
- package/lib/Core/BaseAppState/UseCase.js +54 -0
- package/lib/Core/BaseAppState/UseCase_Imp.d.ts +16 -0
- package/lib/Core/BaseAppState/UseCase_Imp.js +54 -0
- package/lib/Core/DevicePreview/DevicePreviewUC_Imp.d.ts +16 -0
- package/lib/Core/DevicePreview/DevicePreviewUC_Imp.js +56 -0
- package/lib/Core/DevicePreview/boundary.d.ts +14 -0
- package/lib/Core/DevicePreview/boundary.js +2 -0
- package/lib/Core/DevicePreview/entity.d.ts +5 -0
- package/lib/Core/DevicePreview/entity.js +2 -0
- package/lib/Core/DispatchToHost/Entity.d.ts +4 -0
- package/lib/Core/DispatchToHost/Entity.js +2 -0
- package/lib/Core/DispatchToHost/UseCase.d.ts +12 -0
- package/lib/Core/DispatchToHost/UseCase.js +70 -0
- package/lib/Core/DispatchToHost/boundary.d.ts +9 -0
- package/lib/Core/DispatchToHost/boundary.js +2 -0
- package/lib/Core/Serilization/Boundary.d.ts +20 -0
- package/lib/Core/Serilization/Boundary.js +2 -0
- package/lib/Core/Serilization/Entity.d.ts +3 -0
- package/lib/Core/Serilization/Entity.js +2 -0
- package/lib/Core/Serilization/ErrorDuplicateSystemName.d.ts +3 -0
- package/lib/Core/Serilization/ErrorDuplicateSystemName.js +12 -0
- package/lib/Core/Serilization/ErrorUnsupportedVersionNumber.d.ts +3 -0
- package/lib/Core/Serilization/ErrorUnsupportedVersionNumber.js +10 -0
- package/lib/Core/Serilization/Errors.d.ts +6 -0
- package/lib/Core/Serilization/Errors.js +19 -0
- package/lib/Core/Serilization/UseCase.d.ts +10 -0
- package/lib/Core/Serilization/UseCase.js +52 -0
- package/lib/Core/Serilization/UseCase_Imp.d.ts +10 -0
- package/lib/Core/Serilization/UseCase_Imp.js +51 -0
- package/lib/Core/index.d.ts +3 -0
- package/lib/Core/index.js +19 -0
- package/lib/Entities/Color.d.ts +20 -0
- package/lib/Entities/Color.js +59 -0
- package/lib/Entities/LineSegment2D.d.ts +11 -0
- package/lib/Entities/LineSegment2D.js +70 -0
- package/lib/Entities/MouseSceneInput.d.ts +15 -0
- package/lib/Entities/MouseSceneInput.js +109 -0
- package/lib/Entities/OrbitCamera.d.ts +76 -0
- package/lib/Entities/OrbitCamera.js +243 -0
- package/lib/Entities/ParametricLine.d.ts +29 -0
- package/lib/Entities/ParametricLine.js +79 -0
- package/lib/Entities/ParametricPlane.d.ts +20 -0
- package/lib/Entities/ParametricPlane.js +63 -0
- package/lib/Entities/SceneRoot.d.ts +69 -0
- package/lib/Entities/SceneRoot.js +77 -0
- package/lib/Entities/TransformNode.d.ts +78 -0
- package/lib/Entities/TransformNode.js +217 -0
- package/lib/Entities/Vector2.d.ts +21 -0
- package/lib/Entities/Vector2.js +83 -0
- package/lib/Entities/Vector3.d.ts +19 -0
- package/lib/Entities/Vector3.js +75 -0
- package/lib/Entities/WorkPlane.d.ts +49 -0
- package/lib/Entities/WorkPlane.js +122 -0
- package/lib/Entities/index.d.ts +3 -0
- package/lib/Entities/index.js +3 -0
- package/lib/Interface/Controllers/appHandler.d.ts +12 -0
- package/lib/Interface/Controllers/appHandler.js +94 -0
- package/lib/Interface/Controllers/defaultAppHanlderFunctions.d.ts +3 -0
- package/lib/Interface/Controllers/defaultAppHanlderFunctions.js +31 -0
- package/lib/Interface/Controllers/dispatchStateChange.d.ts +2 -0
- package/lib/Interface/Controllers/dispatchStateChange.js +10 -0
- package/lib/Interface/Controllers/index.d.ts +9 -0
- package/lib/Interface/Controllers/index.js +21 -0
- package/lib/Interface/Controllers/makeAppHandler.d.ts +12 -0
- package/lib/Interface/Controllers/makeAppHandler.js +96 -0
- package/lib/Interface/Controllers/setDevicePreview.d.ts +2 -0
- package/lib/Interface/Controllers/setDevicePreview.js +14 -0
- package/lib/Interface/Controllers/setIsAuthoring.d.ts +2 -0
- package/lib/Interface/Controllers/setIsAuthoring.js +14 -0
- package/lib/Interface/Controllers/setState.d.ts +2 -0
- package/lib/Interface/Controllers/setState.js +21 -0
- package/lib/Interface/Controllers/showBabylonInspector.d.ts +2 -0
- package/lib/Interface/Controllers/showBabylonInspector.js +9 -0
- package/lib/Interface/Controllers/startApp.d.ts +1 -0
- package/lib/Interface/Controllers/startApp.js +9 -0
- package/lib/Interface/Controllers/stopApp.d.ts +2 -0
- package/lib/Interface/Controllers/stopApp.js +10 -0
- package/lib/Interface/PresentationManagers/DevicePreviewPM.d.ts +13 -0
- package/lib/Interface/PresentationManagers/DevicePreviewPM.js +25 -0
- package/lib/Interface/PresentationManagers/IsAuthoringPM.d.ts +10 -0
- package/lib/Interface/PresentationManagers/IsAuthoringPM.js +23 -0
- package/lib/Interface/PresentationManagers/ShowBabylonInspectorPM.d.ts +10 -0
- package/lib/Interface/PresentationManagers/ShowBabylonInspectorPM.js +23 -0
- package/lib/Interface/PresentationManagers/index.d.ts +3 -0
- package/lib/Interface/PresentationManagers/index.js +15 -0
- package/lib/Interface/appHandler.d.ts +12 -0
- package/lib/Interface/appHandler.js +94 -0
- package/lib/Interface/index.d.ts +2 -0
- package/lib/Interface/index.js +14 -0
- package/lib/PresentationManagers/OrbitCameraPM.d.ts +14 -0
- package/lib/PresentationManagers/OrbitCameraPM.js +31 -0
- package/lib/PresentationManagers/TransformNodePM.d.ts +14 -0
- package/lib/PresentationManagers/TransformNodePM.js +23 -0
- package/lib/PresentationManagers/index.d.ts +1 -0
- package/lib/PresentationManagers/index.js +1 -0
- package/lib/UseCases/LerpOrbitCamera.d.ts +36 -0
- package/lib/UseCases/LerpOrbitCamera.js +71 -0
- package/lib/UseCases/OrbitCamera/LerpOrbitCamera.d.ts +36 -0
- package/lib/UseCases/OrbitCamera/LerpOrbitCamera.js +71 -0
- package/lib/UseCases/OrbitCamera/PixelDolly_OrbitCamera.d.ts +9 -0
- package/lib/UseCases/OrbitCamera/PixelDolly_OrbitCamera.js +31 -0
- package/lib/UseCases/OrbitCamera/PixelPlanePan_OrbitCamera.d.ts +10 -0
- package/lib/UseCases/OrbitCamera/PixelPlanePan_OrbitCamera.js +31 -0
- package/lib/UseCases/OrbitCamera/SerializeOrbitCamera.d.ts +22 -0
- package/lib/UseCases/OrbitCamera/SerializeOrbitCamera.js +81 -0
- package/lib/UseCases/OrbitCamera/index.d.ts +4 -0
- package/lib/UseCases/OrbitCamera/index.js +16 -0
- package/lib/UseCases/SceneRoot/SerializeSceneRoot.d.ts +18 -0
- package/lib/UseCases/SceneRoot/SerializeSceneRoot.js +48 -0
- package/lib/UseCases/SceneRoot/index.d.ts +1 -0
- package/lib/UseCases/SceneRoot/index.js +13 -0
- package/lib/UseCases/SerializeCamera.d.ts +21 -0
- package/lib/UseCases/SerializeCamera.js +59 -0
- package/lib/UseCases/SerializeOrbitCamera.d.ts +21 -0
- package/lib/UseCases/SerializeOrbitCamera.js +59 -0
- package/lib/UseCases/SerializedCamDemo.d.ts +0 -0
- package/lib/UseCases/SerializedCamDemo.js +1 -0
- package/lib/UseCases/index.d.ts +1 -0
- package/lib/UseCases/index.js +1 -0
- package/lib/ValueObjects/Angle.d.ts +18 -0
- package/lib/ValueObjects/Angle.js +26 -2
- package/lib/ValueObjects/Color.d.ts +46 -0
- package/lib/ValueObjects/Color.js +46 -0
- package/lib/ValueObjects/Matrix.d.ts +120 -0
- package/lib/ValueObjects/Matrix.js +423 -0
- package/lib/ValueObjects/Quaternion.d.ts +94 -0
- package/lib/ValueObjects/Quaternion.js +243 -0
- package/lib/ValueObjects/Vector2.d.ts +82 -0
- package/lib/ValueObjects/Vector2.js +82 -0
- package/lib/ValueObjects/Vector3.d.ts +107 -0
- package/lib/ValueObjects/Vector3.js +116 -0
- package/lib/ValueObjects/index.d.ts +2 -0
- package/lib/ValueObjects/index.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ShowBabylonInspectorPM = void 0;
|
|
4
|
+
class ShowBabylonInspectorPM {
|
|
5
|
+
constructor(baseAppStateUC, updateView) {
|
|
6
|
+
this.onBaseAppChange = this.doUpdateView;
|
|
7
|
+
this.appStateUC = baseAppStateUC;
|
|
8
|
+
this.updateView = updateView;
|
|
9
|
+
this.doUpdateView();
|
|
10
|
+
this.appStateUC.addObserver(this);
|
|
11
|
+
}
|
|
12
|
+
dispose() {
|
|
13
|
+
this.appStateUC.removeObserver(this);
|
|
14
|
+
}
|
|
15
|
+
doUpdateView() {
|
|
16
|
+
const showInspector = this.appStateUC.getShowBabylonInspector();
|
|
17
|
+
if (showInspector === this.lastSetState)
|
|
18
|
+
return;
|
|
19
|
+
this.updateView(showInspector);
|
|
20
|
+
this.lastSetState = showInspector;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.ShowBabylonInspectorPM = ShowBabylonInspectorPM;
|
|
@@ -0,0 +1,15 @@
|
|
|
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("./DevicePreviewPM"), exports);
|
|
14
|
+
__exportStar(require("./IsAuthoringPM"), exports);
|
|
15
|
+
__exportStar(require("./ShowBabylonInspectorPM"), exports);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AppPayloadVersions, Handler } from "@vived/app-host-boundary";
|
|
2
|
+
export declare const appPayloadVersions: AppPayloadVersions;
|
|
3
|
+
export interface AppHandlerFunctions {
|
|
4
|
+
showBabylonInspector: (show: boolean) => void;
|
|
5
|
+
setIsAuthoring: (isAuthoring: boolean) => void;
|
|
6
|
+
disposeApp: () => void;
|
|
7
|
+
stopApp: () => void;
|
|
8
|
+
startApp: (container: HTMLElement) => void;
|
|
9
|
+
setState: (finalState: string, duration?: number) => void;
|
|
10
|
+
setDevicePreview: (x: number, y: number) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare function makeAppHandler(functions: AppHandlerFunctions): Handler;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeAppHandler = exports.appPayloadVersions = void 0;
|
|
4
|
+
const app_host_boundary_1 = require("@vived/app-host-boundary");
|
|
5
|
+
const verbose = false;
|
|
6
|
+
exports.appPayloadVersions = {
|
|
7
|
+
disposeApp: 1,
|
|
8
|
+
setDevicePreview: 1,
|
|
9
|
+
setIsAuthoring: 1,
|
|
10
|
+
showBabylonInspector: 1,
|
|
11
|
+
startApp: 2,
|
|
12
|
+
stopApp: 1,
|
|
13
|
+
setState: 2,
|
|
14
|
+
};
|
|
15
|
+
function makeAppHandler(functions) {
|
|
16
|
+
const handler = (request) => {
|
|
17
|
+
switch (request.type) {
|
|
18
|
+
case app_host_boundary_1.SHOW_BABYLON_INSPECTOR:
|
|
19
|
+
if (request.version === exports.appPayloadVersions.showBabylonInspector) {
|
|
20
|
+
const payload = request.payload;
|
|
21
|
+
functions.showBabylonInspector(payload.showBabylonInspector);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
throw new app_host_boundary_1.UnsupportedRequestVerion(request.type, request.version);
|
|
25
|
+
}
|
|
26
|
+
break;
|
|
27
|
+
case app_host_boundary_1.SET_IS_AUTHORING:
|
|
28
|
+
if (request.version === exports.appPayloadVersions.setIsAuthoring) {
|
|
29
|
+
const payload = request.payload;
|
|
30
|
+
functions.setIsAuthoring(payload.isAuthoring);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
throw new app_host_boundary_1.UnsupportedRequestVerion(request.type, request.version);
|
|
34
|
+
}
|
|
35
|
+
break;
|
|
36
|
+
case app_host_boundary_1.DISPOSE_APP:
|
|
37
|
+
if (request.version === exports.appPayloadVersions.disposeApp) {
|
|
38
|
+
functions.disposeApp();
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
throw new app_host_boundary_1.UnsupportedRequestVerion(request.type, request.version);
|
|
42
|
+
}
|
|
43
|
+
break;
|
|
44
|
+
case app_host_boundary_1.STOP_APP:
|
|
45
|
+
if (request.version === exports.appPayloadVersions.stopApp) {
|
|
46
|
+
functions.stopApp();
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
throw new app_host_boundary_1.UnsupportedRequestVerion(request.type, request.version);
|
|
50
|
+
}
|
|
51
|
+
break;
|
|
52
|
+
case app_host_boundary_1.SET_DEVICE_PREVIEW:
|
|
53
|
+
if (request.version === exports.appPayloadVersions.setDevicePreview) {
|
|
54
|
+
const payload = request.payload;
|
|
55
|
+
functions.setDevicePreview(payload.x, payload.y);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
throw new app_host_boundary_1.UnsupportedRequestVerion(request.type, request.version);
|
|
59
|
+
}
|
|
60
|
+
break;
|
|
61
|
+
case app_host_boundary_1.START_APP:
|
|
62
|
+
if (request.version === exports.appPayloadVersions.startApp) {
|
|
63
|
+
const payload = request.payload;
|
|
64
|
+
functions.startApp(payload.container);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
throw new app_host_boundary_1.UnsupportedRequestVerion(request.type, request.version);
|
|
68
|
+
}
|
|
69
|
+
break;
|
|
70
|
+
case app_host_boundary_1.SET_APP_STATE:
|
|
71
|
+
if (request.version === exports.appPayloadVersions.setState) {
|
|
72
|
+
const payload = request.payload;
|
|
73
|
+
functions.setState(payload.finalState, payload.duration);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
throw new app_host_boundary_1.UnsupportedRequestVerion(request.type, request.version);
|
|
77
|
+
}
|
|
78
|
+
break;
|
|
79
|
+
case app_host_boundary_1.GET_APP_PAYLOAD_VERSIONS:
|
|
80
|
+
if (request.version === 1) {
|
|
81
|
+
const payload = request.payload;
|
|
82
|
+
payload.callback(exports.appPayloadVersions);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
throw new app_host_boundary_1.UnsupportedRequestVerion(request.type, request.version);
|
|
86
|
+
}
|
|
87
|
+
break;
|
|
88
|
+
default:
|
|
89
|
+
throw new app_host_boundary_1.UnsupportedRequestTypeError(request.type);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
return handler;
|
|
93
|
+
}
|
|
94
|
+
exports.makeAppHandler = makeAppHandler;
|
|
@@ -0,0 +1,14 @@
|
|
|
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("./Controllers"), exports);
|
|
14
|
+
__exportStar(require("./PresentationManagers"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { OrbitCamera, Vector3 } from "../Entities";
|
|
2
|
+
export interface OrbitCameraVM {
|
|
3
|
+
alphaEuler: Vector3;
|
|
4
|
+
betaEuler: Vector3;
|
|
5
|
+
cameraLocalPosition: Vector3;
|
|
6
|
+
target: Vector3;
|
|
7
|
+
}
|
|
8
|
+
export declare class OrbitCameraPM {
|
|
9
|
+
private orbitCam;
|
|
10
|
+
private view;
|
|
11
|
+
dispose(): void;
|
|
12
|
+
private doUpdateView;
|
|
13
|
+
constructor(orbitCamera: OrbitCamera, view: (vm: OrbitCameraVM) => void);
|
|
14
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OrbitCameraPM = void 0;
|
|
4
|
+
const Entities_1 = require("../Entities");
|
|
5
|
+
const Utilities_1 = require("../Utilities");
|
|
6
|
+
class OrbitCameraPM {
|
|
7
|
+
constructor(orbitCamera, view) {
|
|
8
|
+
this.doUpdateView = () => {
|
|
9
|
+
const { alpha, beta, radius, target } = this.orbitCam;
|
|
10
|
+
const alphaRadians = Utilities_1.degreesToRadians(alpha);
|
|
11
|
+
const alphaEuler = new Entities_1.Vector3(0, alphaRadians, 0);
|
|
12
|
+
const betaRadians = Utilities_1.degreesToRadians(beta);
|
|
13
|
+
const betaEuler = new Entities_1.Vector3(betaRadians, 0, 0);
|
|
14
|
+
const cameraLocalPosition = new Entities_1.Vector3(0, 0, -radius);
|
|
15
|
+
this.view({
|
|
16
|
+
alphaEuler,
|
|
17
|
+
betaEuler,
|
|
18
|
+
cameraLocalPosition,
|
|
19
|
+
target,
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
this.orbitCam = orbitCamera;
|
|
23
|
+
this.view = view;
|
|
24
|
+
this.doUpdateView();
|
|
25
|
+
this.orbitCam.addObserver(this.doUpdateView);
|
|
26
|
+
}
|
|
27
|
+
dispose() {
|
|
28
|
+
this.orbitCam.removeObserver(this.doUpdateView);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.OrbitCameraPM = OrbitCameraPM;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TransformNode } from "../Entities";
|
|
2
|
+
import { Quaternion, Vector3 } from "../ValueObjects";
|
|
3
|
+
export interface TransformNodeVM {
|
|
4
|
+
position: Vector3;
|
|
5
|
+
rotation: Quaternion;
|
|
6
|
+
scale: Vector3;
|
|
7
|
+
}
|
|
8
|
+
export declare class TransformNodePM {
|
|
9
|
+
private transformNode;
|
|
10
|
+
private updateView;
|
|
11
|
+
dispose: () => void;
|
|
12
|
+
doUpdateView: () => void;
|
|
13
|
+
constructor(transformNode: TransformNode, updateView: (vm: TransformNodeVM) => void);
|
|
14
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransformNodePM = void 0;
|
|
4
|
+
class TransformNodePM {
|
|
5
|
+
constructor(transformNode, updateView) {
|
|
6
|
+
this.transformNode = transformNode;
|
|
7
|
+
this.updateView = updateView;
|
|
8
|
+
this.dispose = () => {
|
|
9
|
+
this.transformNode.removeObserver(this.doUpdateView);
|
|
10
|
+
};
|
|
11
|
+
this.doUpdateView = () => {
|
|
12
|
+
const vm = {
|
|
13
|
+
position: this.transformNode.localPosition,
|
|
14
|
+
rotation: this.transformNode.localRotation,
|
|
15
|
+
scale: this.transformNode.localScale,
|
|
16
|
+
};
|
|
17
|
+
this.updateView(vm);
|
|
18
|
+
};
|
|
19
|
+
transformNode.addObserver(this.doUpdateView);
|
|
20
|
+
this.doUpdateView();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.TransformNodePM = TransformNodePM;
|
|
@@ -18,3 +18,4 @@ __exportStar(require("./HasUndoPM"), exports);
|
|
|
18
18
|
__exportStar(require("./FocusCameraPM"), exports);
|
|
19
19
|
__exportStar(require("./QuestionChallenge"), exports);
|
|
20
20
|
__exportStar(require("./FocusCameraPosRotPM"), exports);
|
|
21
|
+
__exportStar(require("./TransformNodePM"), exports);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { OrbitCamera } from "../Entities";
|
|
2
|
+
export interface LerpOrbitCameraParameters {
|
|
3
|
+
duration: number;
|
|
4
|
+
finalRadius?: number;
|
|
5
|
+
finalBeta?: number;
|
|
6
|
+
finalAlpha?: number;
|
|
7
|
+
finalTarget?: {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
z: number;
|
|
11
|
+
};
|
|
12
|
+
onComplete?: () => void;
|
|
13
|
+
onAbort?: () => void;
|
|
14
|
+
}
|
|
15
|
+
export declare class LerpOrbitCamera {
|
|
16
|
+
get isLerping(): boolean;
|
|
17
|
+
private _isLerping;
|
|
18
|
+
private orbitCamera;
|
|
19
|
+
private easeFn;
|
|
20
|
+
private lerpDuration;
|
|
21
|
+
private lerpRadius;
|
|
22
|
+
private lerpBeta;
|
|
23
|
+
private lerpAlpha;
|
|
24
|
+
private lerpX;
|
|
25
|
+
private lerpY;
|
|
26
|
+
private lerpZ;
|
|
27
|
+
private onComplete?;
|
|
28
|
+
private onAbort?;
|
|
29
|
+
private interval;
|
|
30
|
+
private chrono;
|
|
31
|
+
private delta;
|
|
32
|
+
cancelLerp: () => void;
|
|
33
|
+
private onTick;
|
|
34
|
+
constructor(orbitCamera: OrbitCamera, easeFn: (normalizedTime: number) => number, parameters: LerpOrbitCameraParameters);
|
|
35
|
+
private makeLerpNumber;
|
|
36
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LerpOrbitCamera = void 0;
|
|
4
|
+
const Entities_1 = require("../Entities");
|
|
5
|
+
class LerpOrbitCamera {
|
|
6
|
+
constructor(orbitCamera, easeFn, parameters) {
|
|
7
|
+
var _a, _b, _c;
|
|
8
|
+
this._isLerping = false;
|
|
9
|
+
this.chrono = 0;
|
|
10
|
+
this.delta = 10;
|
|
11
|
+
this.cancelLerp = () => {
|
|
12
|
+
if (!this._isLerping)
|
|
13
|
+
return;
|
|
14
|
+
clearInterval(this.interval);
|
|
15
|
+
if (this.onAbort) {
|
|
16
|
+
this.onAbort();
|
|
17
|
+
}
|
|
18
|
+
this._isLerping = false;
|
|
19
|
+
};
|
|
20
|
+
this.onTick = () => {
|
|
21
|
+
this.chrono = this.chrono + this.delta / 1000;
|
|
22
|
+
let nomralizedTime = this.chrono / this.lerpDuration;
|
|
23
|
+
if (nomralizedTime > 1) {
|
|
24
|
+
nomralizedTime = 1;
|
|
25
|
+
}
|
|
26
|
+
const percent = this.easeFn(nomralizedTime);
|
|
27
|
+
this.orbitCamera.radius = this.lerpRadius(percent);
|
|
28
|
+
this.orbitCamera.beta = this.lerpBeta(percent);
|
|
29
|
+
this.orbitCamera.alpha = this.lerpAlpha(percent);
|
|
30
|
+
const x = this.lerpX(percent);
|
|
31
|
+
const y = this.lerpY(percent);
|
|
32
|
+
const z = this.lerpZ(percent);
|
|
33
|
+
this.orbitCamera.target = new Entities_1.Vector3(x, y, z);
|
|
34
|
+
if (nomralizedTime >= 1) {
|
|
35
|
+
clearInterval(this.interval);
|
|
36
|
+
if (this.onComplete) {
|
|
37
|
+
this.onComplete();
|
|
38
|
+
}
|
|
39
|
+
this._isLerping = false;
|
|
40
|
+
this.orbitCamera.lerpCompleted();
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
this.orbitCamera = orbitCamera;
|
|
44
|
+
this.easeFn = easeFn;
|
|
45
|
+
this.lerpDuration = parameters.duration;
|
|
46
|
+
this.onComplete = parameters.onComplete;
|
|
47
|
+
this.onAbort = parameters.onAbort;
|
|
48
|
+
this.lerpRadius = this.makeLerpNumber(this.orbitCamera.radius, parameters.finalRadius);
|
|
49
|
+
this.lerpBeta = this.makeLerpNumber(this.orbitCamera.beta, parameters.finalBeta);
|
|
50
|
+
this.lerpAlpha = this.makeLerpNumber(this.orbitCamera.alpha, parameters.finalAlpha);
|
|
51
|
+
this.lerpX = this.makeLerpNumber(this.orbitCamera.target.x, (_a = parameters.finalTarget) === null || _a === void 0 ? void 0 : _a.x);
|
|
52
|
+
this.lerpY = this.makeLerpNumber(this.orbitCamera.target.y, (_b = parameters.finalTarget) === null || _b === void 0 ? void 0 : _b.y);
|
|
53
|
+
this.lerpZ = this.makeLerpNumber(this.orbitCamera.target.z, (_c = parameters.finalTarget) === null || _c === void 0 ? void 0 : _c.z);
|
|
54
|
+
this.interval = setInterval(() => {
|
|
55
|
+
this.onTick();
|
|
56
|
+
}, this.delta);
|
|
57
|
+
this.orbitCamera.registerLerp(this);
|
|
58
|
+
this._isLerping = true;
|
|
59
|
+
}
|
|
60
|
+
get isLerping() {
|
|
61
|
+
return this._isLerping;
|
|
62
|
+
}
|
|
63
|
+
makeLerpNumber(initial, final) {
|
|
64
|
+
const actualFinal = final !== null && final !== void 0 ? final : initial;
|
|
65
|
+
return function Lerp(percent) {
|
|
66
|
+
const range = actualFinal - initial;
|
|
67
|
+
return initial + range * percent;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.LerpOrbitCamera = LerpOrbitCamera;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { OrbitCamera } from "../../Entities";
|
|
2
|
+
export interface LerpOrbitCameraParameters {
|
|
3
|
+
duration: number;
|
|
4
|
+
finalRadius?: number;
|
|
5
|
+
finalBeta?: number;
|
|
6
|
+
finalAlpha?: number;
|
|
7
|
+
finalTarget?: {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
z: number;
|
|
11
|
+
};
|
|
12
|
+
onComplete?: () => void;
|
|
13
|
+
onAbort?: () => void;
|
|
14
|
+
}
|
|
15
|
+
export declare class LerpOrbitCamera {
|
|
16
|
+
get isLerping(): boolean;
|
|
17
|
+
private _isLerping;
|
|
18
|
+
private orbitCamera;
|
|
19
|
+
private easeFn;
|
|
20
|
+
private lerpDuration;
|
|
21
|
+
private lerpRadius;
|
|
22
|
+
private lerpBeta;
|
|
23
|
+
private lerpAlpha;
|
|
24
|
+
private lerpX;
|
|
25
|
+
private lerpY;
|
|
26
|
+
private lerpZ;
|
|
27
|
+
private onComplete?;
|
|
28
|
+
private onAbort?;
|
|
29
|
+
private interval;
|
|
30
|
+
private chrono;
|
|
31
|
+
private delta;
|
|
32
|
+
cancelLerp: () => void;
|
|
33
|
+
private onTick;
|
|
34
|
+
constructor(orbitCamera: OrbitCamera, easeFn: (normalizedTime: number) => number, parameters: LerpOrbitCameraParameters);
|
|
35
|
+
private makeLerpNumber;
|
|
36
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LerpOrbitCamera = void 0;
|
|
4
|
+
const Entities_1 = require("../../Entities");
|
|
5
|
+
class LerpOrbitCamera {
|
|
6
|
+
constructor(orbitCamera, easeFn, parameters) {
|
|
7
|
+
var _a, _b, _c;
|
|
8
|
+
this._isLerping = false;
|
|
9
|
+
this.chrono = 0;
|
|
10
|
+
this.delta = 10;
|
|
11
|
+
this.cancelLerp = () => {
|
|
12
|
+
if (!this._isLerping)
|
|
13
|
+
return;
|
|
14
|
+
clearInterval(this.interval);
|
|
15
|
+
if (this.onAbort) {
|
|
16
|
+
this.onAbort();
|
|
17
|
+
}
|
|
18
|
+
this._isLerping = false;
|
|
19
|
+
};
|
|
20
|
+
this.onTick = () => {
|
|
21
|
+
this.chrono = this.chrono + this.delta / 1000;
|
|
22
|
+
let nomralizedTime = this.chrono / this.lerpDuration;
|
|
23
|
+
if (nomralizedTime > 1) {
|
|
24
|
+
nomralizedTime = 1;
|
|
25
|
+
}
|
|
26
|
+
const percent = this.easeFn(nomralizedTime);
|
|
27
|
+
this.orbitCamera.radius = this.lerpRadius(percent);
|
|
28
|
+
this.orbitCamera.beta = this.lerpBeta(percent);
|
|
29
|
+
this.orbitCamera.alpha = this.lerpAlpha(percent);
|
|
30
|
+
const x = this.lerpX(percent);
|
|
31
|
+
const y = this.lerpY(percent);
|
|
32
|
+
const z = this.lerpZ(percent);
|
|
33
|
+
this.orbitCamera.target = new Entities_1.Vector3(x, y, z);
|
|
34
|
+
if (nomralizedTime >= 1) {
|
|
35
|
+
clearInterval(this.interval);
|
|
36
|
+
if (this.onComplete) {
|
|
37
|
+
this.onComplete();
|
|
38
|
+
}
|
|
39
|
+
this._isLerping = false;
|
|
40
|
+
this.orbitCamera.lerpCompleted();
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
this.orbitCamera = orbitCamera;
|
|
44
|
+
this.easeFn = easeFn;
|
|
45
|
+
this.lerpDuration = parameters.duration;
|
|
46
|
+
this.onComplete = parameters.onComplete;
|
|
47
|
+
this.onAbort = parameters.onAbort;
|
|
48
|
+
this.lerpRadius = this.makeLerpNumber(this.orbitCamera.radius, parameters.finalRadius);
|
|
49
|
+
this.lerpBeta = this.makeLerpNumber(this.orbitCamera.beta, parameters.finalBeta);
|
|
50
|
+
this.lerpAlpha = this.makeLerpNumber(this.orbitCamera.alpha, parameters.finalAlpha);
|
|
51
|
+
this.lerpX = this.makeLerpNumber(this.orbitCamera.target.x, (_a = parameters.finalTarget) === null || _a === void 0 ? void 0 : _a.x);
|
|
52
|
+
this.lerpY = this.makeLerpNumber(this.orbitCamera.target.y, (_b = parameters.finalTarget) === null || _b === void 0 ? void 0 : _b.y);
|
|
53
|
+
this.lerpZ = this.makeLerpNumber(this.orbitCamera.target.z, (_c = parameters.finalTarget) === null || _c === void 0 ? void 0 : _c.z);
|
|
54
|
+
this.interval = setInterval(() => {
|
|
55
|
+
this.onTick();
|
|
56
|
+
}, this.delta);
|
|
57
|
+
this.orbitCamera.registerLerp(this);
|
|
58
|
+
this._isLerping = true;
|
|
59
|
+
}
|
|
60
|
+
get isLerping() {
|
|
61
|
+
return this._isLerping;
|
|
62
|
+
}
|
|
63
|
+
makeLerpNumber(initial, final) {
|
|
64
|
+
const actualFinal = final !== null && final !== void 0 ? final : initial;
|
|
65
|
+
return function Lerp(percent) {
|
|
66
|
+
const range = actualFinal - initial;
|
|
67
|
+
return initial + range * percent;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.LerpOrbitCamera = LerpOrbitCamera;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { OrbitCamera, Vector2, Vector3 } from "../../Entities";
|
|
2
|
+
export declare class PixelDolly_OrbitCamera {
|
|
3
|
+
private orbitCamera;
|
|
4
|
+
private previousPixelPosition;
|
|
5
|
+
private pickPoint?;
|
|
6
|
+
doDolly(pixelPosition: Vector2): void;
|
|
7
|
+
initializeDolly(pixelPosition: Vector2, pickPoint?: Vector3): void;
|
|
8
|
+
constructor(orbitCamera: OrbitCamera);
|
|
9
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PixelDolly_OrbitCamera = void 0;
|
|
4
|
+
const Entities_1 = require("../../Entities");
|
|
5
|
+
class PixelDolly_OrbitCamera {
|
|
6
|
+
constructor(orbitCamera) {
|
|
7
|
+
this.orbitCamera = orbitCamera;
|
|
8
|
+
this.previousPixelPosition = Entities_1.Vector2.Zero();
|
|
9
|
+
}
|
|
10
|
+
doDolly(pixelPosition) {
|
|
11
|
+
const pixelDeltaY = pixelPosition.y - this.previousPixelPosition.y;
|
|
12
|
+
const deltaRadius = pixelDeltaY * this.orbitCamera.dollyPixelSensitivity;
|
|
13
|
+
const currentRadius = this.orbitCamera.radius;
|
|
14
|
+
const newRadius = currentRadius + deltaRadius;
|
|
15
|
+
this.orbitCamera.radius = newRadius;
|
|
16
|
+
if (this.pickPoint !== undefined) {
|
|
17
|
+
const percentChange = newRadius / currentRadius;
|
|
18
|
+
const pickToTarget = this.orbitCamera.target.subtract(this.pickPoint);
|
|
19
|
+
const newLength = pickToTarget.magnitued * percentChange;
|
|
20
|
+
pickToTarget.setLength(newLength);
|
|
21
|
+
const newTargetPos = this.pickPoint.add(pickToTarget);
|
|
22
|
+
this.orbitCamera.target = newTargetPos;
|
|
23
|
+
}
|
|
24
|
+
this.previousPixelPosition = pixelPosition;
|
|
25
|
+
}
|
|
26
|
+
initializeDolly(pixelPosition, pickPoint) {
|
|
27
|
+
this.previousPixelPosition = pixelPosition;
|
|
28
|
+
this.pickPoint = pickPoint;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.PixelDolly_OrbitCamera = PixelDolly_OrbitCamera;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Babylon, OrbitCamera, ParametricPlane, Vector2 } from "../../Entities";
|
|
2
|
+
export declare class PixelPlanePan_OrbitCamera {
|
|
3
|
+
private orbitCamera;
|
|
4
|
+
private babylon;
|
|
5
|
+
private plane?;
|
|
6
|
+
private previousPixelPos?;
|
|
7
|
+
doPan: (pixelPosition: Vector2) => void;
|
|
8
|
+
initializePan: (initialPixelPos: Vector2, panPlane: ParametricPlane) => void;
|
|
9
|
+
constructor(orbitCamera: OrbitCamera, babylon: Babylon);
|
|
10
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PixelPlanePan_OrbitCamera = void 0;
|
|
4
|
+
const Entities_1 = require("../../Entities");
|
|
5
|
+
class PixelPlanePan_OrbitCamera {
|
|
6
|
+
constructor(orbitCamera, babylon) {
|
|
7
|
+
this.orbitCamera = orbitCamera;
|
|
8
|
+
this.babylon = babylon;
|
|
9
|
+
this.doPan = (pixelPosition) => {
|
|
10
|
+
if (!this.plane || !this.previousPixelPos) {
|
|
11
|
+
throw new Error("[PixelPlanePan_OrbitCamera] You must initialize first!");
|
|
12
|
+
}
|
|
13
|
+
const initialRay = this.babylon.sceneRay(this.previousPixelPos);
|
|
14
|
+
const finalRay = this.babylon.sceneRay(pixelPosition);
|
|
15
|
+
const p1 = this.plane.intersectLine(initialRay);
|
|
16
|
+
const p2 = this.plane.intersectLine(finalRay);
|
|
17
|
+
if (!p1 || !p2)
|
|
18
|
+
return;
|
|
19
|
+
const delta = p2.subtract(p1);
|
|
20
|
+
const currentTarget = this.orbitCamera.target;
|
|
21
|
+
const newTarget = new Entities_1.Vector3(currentTarget.x - delta.x, currentTarget.y - delta.y, currentTarget.z - delta.z);
|
|
22
|
+
this.orbitCamera.target = new Entities_1.Vector3(newTarget.x, newTarget.y, newTarget.z);
|
|
23
|
+
this.previousPixelPos = pixelPosition;
|
|
24
|
+
};
|
|
25
|
+
this.initializePan = (initialPixelPos, panPlane) => {
|
|
26
|
+
this.plane = panPlane;
|
|
27
|
+
this.previousPixelPos = initialPixelPos;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.PixelPlanePan_OrbitCamera = PixelPlanePan_OrbitCamera;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { OrbitCamera, SerializedSystem, StateMachine } from "../../Entities";
|
|
2
|
+
export declare class SerializedOrbitCamera implements SerializedSystem {
|
|
3
|
+
name: string;
|
|
4
|
+
seriliziationVersion: number;
|
|
5
|
+
private orbitCamera;
|
|
6
|
+
private stateMachine;
|
|
7
|
+
getSystemState(): object;
|
|
8
|
+
applySystemState(serializedState: object, version: number, transitionTime: number): void;
|
|
9
|
+
applyDefaultState(transitionDuration: number): void;
|
|
10
|
+
private applyV1Data;
|
|
11
|
+
private applyImmediate;
|
|
12
|
+
private applyLerp;
|
|
13
|
+
constructor(orbitCamera: OrbitCamera, stateMachine: StateMachine);
|
|
14
|
+
}
|
|
15
|
+
export interface CameraDataV1 {
|
|
16
|
+
alpha: number;
|
|
17
|
+
beta: number;
|
|
18
|
+
radius: number;
|
|
19
|
+
target_x: number;
|
|
20
|
+
target_y: number;
|
|
21
|
+
target_z: number;
|
|
22
|
+
}
|