@configura/babylon-view 1.2.1 → 1.3.0-alpha.3
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/LICENSE +201 -201
- package/README.md +1 -1
- package/dist/animation/AnimatableObject.d.ts +8 -8
- package/dist/animation/AnimatableObject.js +3 -3
- package/dist/animation/animator/Animator.d.ts +33 -33
- package/dist/animation/animator/Animator.js +58 -58
- package/dist/animation/animator/AnimatorEasing.d.ts +16 -16
- package/dist/animation/animator/AnimatorEasing.js +31 -31
- package/dist/animation/animator/AnimatorEasingMatrix.d.ts +14 -14
- package/dist/animation/animator/AnimatorEasingMatrix.js +16 -16
- package/dist/animation/animator/AnimatorHighlight.d.ts +16 -16
- package/dist/animation/animator/AnimatorHighlight.js +32 -32
- package/dist/animation/animator/AnimatorPointToPoint.d.ts +8 -8
- package/dist/animation/animator/AnimatorPointToPoint.js +14 -14
- package/dist/animation/animator/AnimatorQueue.d.ts +13 -13
- package/dist/animation/animator/AnimatorQueue.js +57 -57
- package/dist/animation/animator/AnimatorScale.d.ts +8 -8
- package/dist/animation/animator/AnimatorScale.js +13 -13
- package/dist/animation/animator/AnimatorSpin.d.ts +10 -10
- package/dist/animation/animator/AnimatorSpin.js +13 -13
- package/dist/animation/animator/EasingFunctions.d.ts +35 -35
- package/dist/animation/animator/EasingFunctions.js +137 -137
- package/dist/animation/coordinator/Coordinator.d.ts +28 -28
- package/dist/animation/coordinator/Coordinator.js +47 -47
- package/dist/animation/coordinator/CoordinatorDropAndSpin.d.ts +22 -22
- package/dist/animation/coordinator/CoordinatorDropAndSpin.js +133 -133
- package/dist/animation/coordinator/CoordinatorIdentity.d.ts +11 -11
- package/dist/animation/coordinator/CoordinatorIdentity.js +12 -12
- package/dist/animation/coordinator/CoordinatorNodeQueues.d.ts +18 -18
- package/dist/animation/coordinator/CoordinatorNodeQueues.js +50 -50
- package/dist/animation/coordinator/CoordinatorPulse.d.ts +21 -21
- package/dist/animation/coordinator/CoordinatorPulse.js +47 -47
- package/dist/animation/coordinator/CoordinatorPulseBounce.d.ts +14 -14
- package/dist/animation/coordinator/CoordinatorPulseBounce.js +40 -40
- package/dist/animation/coordinator/CoordinatorPulseHighlight.d.ts +13 -13
- package/dist/animation/coordinator/CoordinatorPulseHighlight.js +34 -34
- package/dist/animation/coordinator/CoordinatorPulseInflate.d.ts +14 -14
- package/dist/animation/coordinator/CoordinatorPulseInflate.js +30 -30
- package/dist/camera/CameraCreator.d.ts +5 -5
- package/dist/camera/CameraCreator.js +4 -4
- package/dist/camera/CfgArcRotateCameraPointersInput.d.ts +10 -10
- package/dist/camera/CfgArcRotateCameraPointersInput.js +262 -262
- package/dist/camera/CfgOrbitalCamera.d.ts +68 -64
- package/dist/camera/CfgOrbitalCamera.js +250 -233
- package/dist/camera/CfgOrbitalCameraControlProps.d.ts +6 -6
- package/dist/camera/CfgOrbitalCameraControlProps.js +3 -3
- package/dist/camera/GradingApplier.d.ts +3 -3
- package/dist/camera/GradingApplier.js +48 -48
- package/dist/engine/EngineCreator.d.ts +3 -3
- package/dist/engine/EngineCreator.js +10 -10
- package/dist/geometry/CfgGeometry.d.ts +12 -12
- package/dist/geometry/CfgGeometry.js +117 -117
- package/dist/geometry/CfgMesh.d.ts +7 -7
- package/dist/geometry/CfgMesh.js +8 -8
- package/dist/geometry/geoSplitter.d.ts +8 -8
- package/dist/geometry/geoSplitter.js +192 -192
- package/dist/index.d.ts +13 -13
- package/dist/index.js +13 -13
- package/dist/light/CfgDirectionalLight.d.ts +8 -8
- package/dist/light/CfgDirectionalLight.js +18 -18
- package/dist/light/CfgHemisphericLight.d.ts +7 -7
- package/dist/light/CfgHemisphericLight.js +17 -17
- package/dist/light/CfgPointLight.d.ts +8 -8
- package/dist/light/CfgPointLight.js +18 -18
- package/dist/light/DefaultLightRig.d.ts +19 -19
- package/dist/light/DefaultLightRig.js +77 -77
- package/dist/light/LightRigCreator.d.ts +9 -9
- package/dist/light/LightRigCreator.js +3 -3
- package/dist/material/CfgMaterial.d.ts +53 -53
- package/dist/material/CfgMaterial.js +454 -454
- package/dist/material/DummyMaterialCreator.d.ts +4 -4
- package/dist/material/DummyMaterialCreator.js +15 -15
- package/dist/material/material.d.ts +18 -18
- package/dist/material/material.js +128 -128
- package/dist/material/texture.d.ts +14 -14
- package/dist/material/texture.js +304 -304
- package/dist/nodes/CfgContentRootNode.d.ts +19 -19
- package/dist/nodes/CfgContentRootNode.js +75 -75
- package/dist/nodes/CfgDeferredMeshNode.d.ts +48 -48
- package/dist/nodes/CfgDeferredMeshNode.js +347 -347
- package/dist/nodes/CfgProductNode.d.ts +61 -61
- package/dist/nodes/CfgProductNode.js +486 -486
- package/dist/nodes/CfgSymNode.d.ts +42 -42
- package/dist/nodes/CfgSymNode.js +216 -216
- package/dist/nodes/CfgSymRootNode.d.ts +33 -33
- package/dist/nodes/CfgSymRootNode.js +175 -175
- package/dist/nodes/CfgTransformNode.d.ts +29 -29
- package/dist/nodes/CfgTransformNode.js +81 -81
- package/dist/scene/SceneCreator.d.ts +6 -6
- package/dist/scene/SceneCreator.js +22 -22
- package/dist/utilities/CfgBoundingBox.d.ts +16 -16
- package/dist/utilities/CfgBoundingBox.js +64 -64
- package/dist/utilities/utilities3D.d.ts +26 -26
- package/dist/utilities/utilities3D.js +187 -187
- package/dist/utilities/utilitiesColor.d.ts +18 -18
- package/dist/utilities/utilitiesColor.js +48 -48
- package/dist/utilities/utilitiesImage.d.ts +6 -6
- package/dist/utilities/utilitiesImage.js +107 -107
- package/dist/utilities/utilitiesSymRootIdentifier.d.ts +5 -5
- package/dist/utilities/utilitiesSymRootIdentifier.js +20 -20
- package/dist/view/BaseView.d.ts +70 -70
- package/dist/view/BaseView.js +291 -291
- package/dist/view/BaseViewConfiguration.d.ts +32 -32
- package/dist/view/BaseViewConfiguration.js +8 -8
- package/dist/view/RenderEnv.d.ts +38 -38
- package/dist/view/RenderEnv.js +7 -7
- package/dist/view/SingleProductDefaultCameraView.d.ts +33 -33
- package/dist/view/SingleProductDefaultCameraView.js +141 -140
- package/dist/view/SingleProductDefaultCameraViewConfiguration.d.ts +46 -44
- package/dist/view/SingleProductDefaultCameraViewConfiguration.js +11 -11
- package/dist/view/SingleProductView.d.ts +42 -42
- package/dist/view/SingleProductView.js +205 -205
- package/dist/view/SingleProductViewConfiguration.d.ts +32 -32
- package/dist/view/SingleProductViewConfiguration.js +19 -19
- package/package.json +5 -5
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import { Matrix } from "@babylonjs/core/Maths/math.vector.js";
|
|
2
|
-
import { CfgMaterialMapping, CfgMtrlSourceWithMetaData } from "@configura/web-api";
|
|
3
|
-
import { SymNode } from "@configura/web-core/dist/cm/format/cmsym/SymNode.js";
|
|
4
|
-
import { DetailLevel } from "@configura/web-core/dist/cm/geometry/DetailMask.js";
|
|
5
|
-
import { LogObservable, LogProducer } from "@configura/web-utilities";
|
|
6
|
-
import { AnimatableObject } from "../animation/AnimatableObject.js";
|
|
7
|
-
import { CoordinatorWithMeta } from "../animation/coordinator/Coordinator.js";
|
|
8
|
-
import { CfgBoundingBox } from "../utilities/CfgBoundingBox.js";
|
|
9
|
-
import { RenderEnv } from "../view/RenderEnv.js";
|
|
10
|
-
import { CfgTransformNode } from "./CfgTransformNode.js";
|
|
11
|
-
export declare class CfgSymNode extends CfgTransformNode implements LogProducer, AnimatableObject {
|
|
12
|
-
_detailLevel: DetailLevel;
|
|
13
|
-
_symNode: SymNode;
|
|
14
|
-
private _symNodeParent?;
|
|
15
|
-
static makeCfgSymNode(renderEnvironment: RenderEnv, detailLevel: DetailLevel, symNode: SymNode, symNodeParent?: CfgSymNode): Promise<CfgSymNode | undefined>;
|
|
16
|
-
get cfgClassName(): string;
|
|
17
|
-
static initCfgSymNode(node: CfgSymNode): Promise<void>;
|
|
18
|
-
logger: LogObservable;
|
|
19
|
-
_tag: string | undefined;
|
|
20
|
-
private _gMaterial;
|
|
21
|
-
private _symNodeChildren;
|
|
22
|
-
private _deferredMesh;
|
|
23
|
-
private _originalMatrix;
|
|
24
|
-
protected constructor(renderEnvironment: RenderEnv, _detailLevel: DetailLevel, _symNode: SymNode, _symNodeParent?: CfgSymNode | undefined);
|
|
25
|
-
getChildrenForAnimation(): CfgTransformNode[];
|
|
26
|
-
private initTag;
|
|
27
|
-
private initGMaterial;
|
|
28
|
-
get originalMatrix(): Matrix;
|
|
29
|
-
protected initTransform(): void;
|
|
30
|
-
private initChildren;
|
|
31
|
-
get isEmpty(): boolean;
|
|
32
|
-
findMaterial(areasToMaterials: CfgMaterialMapping): CfgMtrlSourceWithMetaData | undefined;
|
|
33
|
-
private loadGeo;
|
|
34
|
-
applyGeo(): void;
|
|
35
|
-
isAllMeshMaterialsReady(): boolean;
|
|
36
|
-
setMaterialsAndLoad(areasToMaterials: CfgMaterialMapping, animatorCoordinator?: CoordinatorWithMeta): Promise<void>;
|
|
37
|
-
applyMaterial(): void;
|
|
38
|
-
get boundingBox(): CfgBoundingBox;
|
|
39
|
-
protected addInspectorProperties(): void;
|
|
40
|
-
private get _inspectorLogSymNode();
|
|
41
|
-
private set _inspectorLogSymNode(value);
|
|
42
|
-
}
|
|
1
|
+
import { Matrix } from "@babylonjs/core/Maths/math.vector.js";
|
|
2
|
+
import { CfgMaterialMapping, CfgMtrlSourceWithMetaData } from "@configura/web-api";
|
|
3
|
+
import { SymNode } from "@configura/web-core/dist/cm/format/cmsym/SymNode.js";
|
|
4
|
+
import { DetailLevel } from "@configura/web-core/dist/cm/geometry/DetailMask.js";
|
|
5
|
+
import { LogObservable, LogProducer } from "@configura/web-utilities";
|
|
6
|
+
import { AnimatableObject } from "../animation/AnimatableObject.js";
|
|
7
|
+
import { CoordinatorWithMeta } from "../animation/coordinator/Coordinator.js";
|
|
8
|
+
import { CfgBoundingBox } from "../utilities/CfgBoundingBox.js";
|
|
9
|
+
import { RenderEnv } from "../view/RenderEnv.js";
|
|
10
|
+
import { CfgTransformNode } from "./CfgTransformNode.js";
|
|
11
|
+
export declare class CfgSymNode extends CfgTransformNode implements LogProducer, AnimatableObject {
|
|
12
|
+
_detailLevel: DetailLevel;
|
|
13
|
+
_symNode: SymNode;
|
|
14
|
+
private _symNodeParent?;
|
|
15
|
+
static makeCfgSymNode(renderEnvironment: RenderEnv, detailLevel: DetailLevel, symNode: SymNode, symNodeParent?: CfgSymNode): Promise<CfgSymNode | undefined>;
|
|
16
|
+
get cfgClassName(): string;
|
|
17
|
+
static initCfgSymNode(node: CfgSymNode): Promise<void>;
|
|
18
|
+
logger: LogObservable;
|
|
19
|
+
_tag: string | undefined;
|
|
20
|
+
private _gMaterial;
|
|
21
|
+
private _symNodeChildren;
|
|
22
|
+
private _deferredMesh;
|
|
23
|
+
private _originalMatrix;
|
|
24
|
+
protected constructor(renderEnvironment: RenderEnv, _detailLevel: DetailLevel, _symNode: SymNode, _symNodeParent?: CfgSymNode | undefined);
|
|
25
|
+
getChildrenForAnimation(): CfgTransformNode[];
|
|
26
|
+
private initTag;
|
|
27
|
+
private initGMaterial;
|
|
28
|
+
get originalMatrix(): Matrix;
|
|
29
|
+
protected initTransform(): void;
|
|
30
|
+
private initChildren;
|
|
31
|
+
get isEmpty(): boolean;
|
|
32
|
+
findMaterial(areasToMaterials: CfgMaterialMapping): CfgMtrlSourceWithMetaData | undefined;
|
|
33
|
+
private loadGeo;
|
|
34
|
+
applyGeo(): void;
|
|
35
|
+
isAllMeshMaterialsReady(): boolean;
|
|
36
|
+
setMaterialsAndLoad(areasToMaterials: CfgMaterialMapping, animatorCoordinator?: CoordinatorWithMeta): Promise<void>;
|
|
37
|
+
applyMaterial(): void;
|
|
38
|
+
get boundingBox(): CfgBoundingBox;
|
|
39
|
+
protected addInspectorProperties(): void;
|
|
40
|
+
private get _inspectorLogSymNode();
|
|
41
|
+
private set _inspectorLogSymNode(value);
|
|
42
|
+
}
|
|
43
43
|
//# sourceMappingURL=CfgSymNode.d.ts.map
|
package/dist/nodes/CfgSymNode.js
CHANGED
|
@@ -1,216 +1,216 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { Matrix } from "@babylonjs/core/Maths/math.vector.js";
|
|
11
|
-
import { InspectableType } from "@babylonjs/core/Misc/iInspectable.js";
|
|
12
|
-
import { SymTags } from "@configura/web-core/dist/cm/format/cmsym/components/SymTags.js";
|
|
13
|
-
import { LogObservable } from "@configura/web-utilities";
|
|
14
|
-
import { CfgBoundingBox } from "../utilities/CfgBoundingBox.js";
|
|
15
|
-
import { symTransformToMatrix } from "../utilities/utilities3D.js";
|
|
16
|
-
import { CfgDeferredMeshNode } from "./CfgDeferredMeshNode.js";
|
|
17
|
-
import { CfgTransformNode } from "./CfgTransformNode.js";
|
|
18
|
-
function isNoRender(symNode) {
|
|
19
|
-
var _a;
|
|
20
|
-
const symTags = symNode.symTags();
|
|
21
|
-
return symTags instanceof SymTags && !!((_a = symTags.node) === null || _a === void 0 ? void 0 : _a.components.has("symConnector"));
|
|
22
|
-
}
|
|
23
|
-
export class CfgSymNode extends CfgTransformNode {
|
|
24
|
-
constructor(renderEnvironment, _detailLevel, _symNode, _symNodeParent) {
|
|
25
|
-
super(renderEnvironment, "(SymNode) " + _symNode.id);
|
|
26
|
-
this._detailLevel = _detailLevel;
|
|
27
|
-
this._symNode = _symNode;
|
|
28
|
-
this._symNodeParent = _symNodeParent;
|
|
29
|
-
this.logger = new LogObservable();
|
|
30
|
-
this._symNodeChildren = [];
|
|
31
|
-
this.initTransform();
|
|
32
|
-
}
|
|
33
|
-
static makeCfgSymNode(renderEnvironment, detailLevel, symNode, symNodeParent) {
|
|
34
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
if (isNoRender(symNode)) {
|
|
36
|
-
return undefined;
|
|
37
|
-
}
|
|
38
|
-
const node = new CfgSymNode(renderEnvironment, detailLevel, symNode, symNodeParent);
|
|
39
|
-
yield CfgSymNode.initCfgSymNode(node);
|
|
40
|
-
if (node.isEmpty) {
|
|
41
|
-
if (renderEnvironment.cullEmptyNodes) {
|
|
42
|
-
node.dispose();
|
|
43
|
-
return undefined;
|
|
44
|
-
}
|
|
45
|
-
node.logger.info("Empty node");
|
|
46
|
-
}
|
|
47
|
-
if (node._tag && node._tag.length > 0) {
|
|
48
|
-
node.name += " | " + node._tag;
|
|
49
|
-
}
|
|
50
|
-
return node;
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
get cfgClassName() {
|
|
54
|
-
return "CfgSymNode";
|
|
55
|
-
}
|
|
56
|
-
static initCfgSymNode(node) {
|
|
57
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
node.initTag();
|
|
59
|
-
node.initGMaterial();
|
|
60
|
-
yield node.initChildren();
|
|
61
|
-
yield node.loadGeo();
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
getChildrenForAnimation() {
|
|
65
|
-
const target = super.getChildrenForAnimation();
|
|
66
|
-
if (this._deferredMesh !== undefined) {
|
|
67
|
-
target.push(this._deferredMesh);
|
|
68
|
-
}
|
|
69
|
-
return target;
|
|
70
|
-
}
|
|
71
|
-
initTag() {
|
|
72
|
-
const symTags = this._symNode.symTags();
|
|
73
|
-
if (symTags instanceof SymTags && symTags.main !== undefined) {
|
|
74
|
-
this._tag = symTags.main;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
initGMaterial() {
|
|
78
|
-
var _a, _b;
|
|
79
|
-
let material = this._symNode.symGMaterial();
|
|
80
|
-
if ((material === null || material === void 0 ? void 0 : material.gm) === undefined) {
|
|
81
|
-
const selectMaterial = (_a = this._symNode.symGMaterialSelector()) === null || _a === void 0 ? void 0 : _a.symGMaterial;
|
|
82
|
-
if ((selectMaterial === null || selectMaterial === void 0 ? void 0 : selectMaterial.gm) !== undefined) {
|
|
83
|
-
material = selectMaterial;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
if ((material === null || material === void 0 ? void 0 : material.gm) === undefined) {
|
|
87
|
-
const parentMaterial = (_b = this._symNodeParent) === null || _b === void 0 ? void 0 : _b._gMaterial;
|
|
88
|
-
if ((parentMaterial === null || parentMaterial === void 0 ? void 0 : parentMaterial.gm) !== undefined) {
|
|
89
|
-
material = parentMaterial;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
this._gMaterial = material;
|
|
93
|
-
}
|
|
94
|
-
get originalMatrix() {
|
|
95
|
-
if (this._originalMatrix === undefined) {
|
|
96
|
-
const symTransform = this._symNode.symTransform();
|
|
97
|
-
if (symTransform === undefined) {
|
|
98
|
-
this._originalMatrix = Matrix.Identity();
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
const transform = symTransform.transform();
|
|
102
|
-
this._originalMatrix = symTransformToMatrix(transform);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
return this._originalMatrix;
|
|
106
|
-
}
|
|
107
|
-
initTransform() {
|
|
108
|
-
this.setPreTransformMatrix(this.originalMatrix);
|
|
109
|
-
}
|
|
110
|
-
initChildren() {
|
|
111
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
-
const promises = [];
|
|
113
|
-
for (const childNode of (this._symNode.children(this.logger, false, true) || []).values()) {
|
|
114
|
-
promises.push((() => __awaiter(this, void 0, void 0, function* () {
|
|
115
|
-
const childSymNode = yield CfgSymNode.makeCfgSymNode(this._renderEnvironment, this._detailLevel, childNode, this);
|
|
116
|
-
if (childSymNode === undefined) {
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
this._symNodeChildren.push(childSymNode);
|
|
120
|
-
this.add(childSymNode);
|
|
121
|
-
}))());
|
|
122
|
-
}
|
|
123
|
-
yield Promise.all(promises);
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
get isEmpty() {
|
|
127
|
-
return this._deferredMesh === undefined && this._symNodeChildren.length === 0;
|
|
128
|
-
}
|
|
129
|
-
findMaterial(areasToMaterials) {
|
|
130
|
-
if (this._tag !== undefined && areasToMaterials.has(this._tag)) {
|
|
131
|
-
return areasToMaterials.get(this._tag);
|
|
132
|
-
}
|
|
133
|
-
if (this._symNodeParent !== undefined) {
|
|
134
|
-
return this._symNodeParent.findMaterial(areasToMaterials);
|
|
135
|
-
}
|
|
136
|
-
return undefined;
|
|
137
|
-
}
|
|
138
|
-
loadGeo() {
|
|
139
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
140
|
-
this._deferredMesh = yield CfgDeferredMeshNode.makeCfgDeferredMesh(this.logger, this._renderEnvironment, this._detailLevel, this._symNode, this._gMaterial);
|
|
141
|
-
if (this._deferredMesh === undefined) {
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
this._deferredMesh.setEnabled(false);
|
|
145
|
-
this.add(this._deferredMesh);
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
applyGeo() {
|
|
149
|
-
if (this._deferredMesh !== undefined) {
|
|
150
|
-
this._deferredMesh.setEnabled(true);
|
|
151
|
-
}
|
|
152
|
-
for (const symNodeChild of this._symNodeChildren) {
|
|
153
|
-
symNodeChild.applyGeo();
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
isAllMeshMaterialsReady() {
|
|
157
|
-
return ((this._deferredMesh === undefined || this._deferredMesh.isAllMeshMaterialsReady()) &&
|
|
158
|
-
this._symNodeChildren.reduce((a, c) => a && c.isAllMeshMaterialsReady(), true));
|
|
159
|
-
}
|
|
160
|
-
setMaterialsAndLoad(areasToMaterials, animatorCoordinator) {
|
|
161
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
162
|
-
const promises = [];
|
|
163
|
-
if (this._deferredMesh !== undefined) {
|
|
164
|
-
let mtrlWithMetaData = this.findMaterial(areasToMaterials);
|
|
165
|
-
promises.push(this._deferredMesh.setMaterialAndLoad(mtrlWithMetaData, animatorCoordinator));
|
|
166
|
-
}
|
|
167
|
-
for (const symNodeChild of this._symNodeChildren) {
|
|
168
|
-
promises.push(symNodeChild.setMaterialsAndLoad(areasToMaterials, animatorCoordinator));
|
|
169
|
-
}
|
|
170
|
-
yield Promise.all(promises);
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
applyMaterial() {
|
|
174
|
-
if (this._deferredMesh !== undefined) {
|
|
175
|
-
this._deferredMesh.applyMaterial();
|
|
176
|
-
}
|
|
177
|
-
this._symNodeChildren.forEach((child) => {
|
|
178
|
-
child.applyMaterial();
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
get boundingBox() {
|
|
182
|
-
const bb = this._symNodeChildren.reduce((a, m) => {
|
|
183
|
-
a.expand(m.boundingBox);
|
|
184
|
-
return a;
|
|
185
|
-
}, new CfgBoundingBox());
|
|
186
|
-
if (this._deferredMesh !== undefined) {
|
|
187
|
-
bb.expand(this._deferredMesh.boundingBox);
|
|
188
|
-
}
|
|
189
|
-
bb.applyMatrix(this.originalMatrix);
|
|
190
|
-
return bb;
|
|
191
|
-
}
|
|
192
|
-
addInspectorProperties() {
|
|
193
|
-
super.addInspectorProperties();
|
|
194
|
-
this.addInspectableCustomProperty({
|
|
195
|
-
label: "Detail level",
|
|
196
|
-
propertyName: "_detailLevel",
|
|
197
|
-
type: InspectableType.String,
|
|
198
|
-
});
|
|
199
|
-
this.addInspectableCustomProperty({
|
|
200
|
-
label: "Tag",
|
|
201
|
-
propertyName: "_tag",
|
|
202
|
-
type: InspectableType.String,
|
|
203
|
-
});
|
|
204
|
-
this.addInspectableCustomProperty({
|
|
205
|
-
label: "log symNode",
|
|
206
|
-
propertyName: "_inspectorLogSymNode",
|
|
207
|
-
type: InspectableType.Checkbox,
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
get _inspectorLogSymNode() {
|
|
211
|
-
return this._symNode === undefined;
|
|
212
|
-
}
|
|
213
|
-
set _inspectorLogSymNode(x) {
|
|
214
|
-
console.log(this._symNode);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { Matrix } from "@babylonjs/core/Maths/math.vector.js";
|
|
11
|
+
import { InspectableType } from "@babylonjs/core/Misc/iInspectable.js";
|
|
12
|
+
import { SymTags } from "@configura/web-core/dist/cm/format/cmsym/components/SymTags.js";
|
|
13
|
+
import { LogObservable } from "@configura/web-utilities";
|
|
14
|
+
import { CfgBoundingBox } from "../utilities/CfgBoundingBox.js";
|
|
15
|
+
import { symTransformToMatrix } from "../utilities/utilities3D.js";
|
|
16
|
+
import { CfgDeferredMeshNode } from "./CfgDeferredMeshNode.js";
|
|
17
|
+
import { CfgTransformNode } from "./CfgTransformNode.js";
|
|
18
|
+
function isNoRender(symNode) {
|
|
19
|
+
var _a;
|
|
20
|
+
const symTags = symNode.symTags();
|
|
21
|
+
return symTags instanceof SymTags && !!((_a = symTags.node) === null || _a === void 0 ? void 0 : _a.components.has("symConnector"));
|
|
22
|
+
}
|
|
23
|
+
export class CfgSymNode extends CfgTransformNode {
|
|
24
|
+
constructor(renderEnvironment, _detailLevel, _symNode, _symNodeParent) {
|
|
25
|
+
super(renderEnvironment, "(SymNode) " + _symNode.id);
|
|
26
|
+
this._detailLevel = _detailLevel;
|
|
27
|
+
this._symNode = _symNode;
|
|
28
|
+
this._symNodeParent = _symNodeParent;
|
|
29
|
+
this.logger = new LogObservable();
|
|
30
|
+
this._symNodeChildren = [];
|
|
31
|
+
this.initTransform();
|
|
32
|
+
}
|
|
33
|
+
static makeCfgSymNode(renderEnvironment, detailLevel, symNode, symNodeParent) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
if (isNoRender(symNode)) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
const node = new CfgSymNode(renderEnvironment, detailLevel, symNode, symNodeParent);
|
|
39
|
+
yield CfgSymNode.initCfgSymNode(node);
|
|
40
|
+
if (node.isEmpty) {
|
|
41
|
+
if (renderEnvironment.cullEmptyNodes) {
|
|
42
|
+
node.dispose();
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
node.logger.info("Empty node");
|
|
46
|
+
}
|
|
47
|
+
if (node._tag && node._tag.length > 0) {
|
|
48
|
+
node.name += " | " + node._tag;
|
|
49
|
+
}
|
|
50
|
+
return node;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
get cfgClassName() {
|
|
54
|
+
return "CfgSymNode";
|
|
55
|
+
}
|
|
56
|
+
static initCfgSymNode(node) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
node.initTag();
|
|
59
|
+
node.initGMaterial();
|
|
60
|
+
yield node.initChildren();
|
|
61
|
+
yield node.loadGeo();
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
getChildrenForAnimation() {
|
|
65
|
+
const target = super.getChildrenForAnimation();
|
|
66
|
+
if (this._deferredMesh !== undefined) {
|
|
67
|
+
target.push(this._deferredMesh);
|
|
68
|
+
}
|
|
69
|
+
return target;
|
|
70
|
+
}
|
|
71
|
+
initTag() {
|
|
72
|
+
const symTags = this._symNode.symTags();
|
|
73
|
+
if (symTags instanceof SymTags && symTags.main !== undefined) {
|
|
74
|
+
this._tag = symTags.main;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
initGMaterial() {
|
|
78
|
+
var _a, _b;
|
|
79
|
+
let material = this._symNode.symGMaterial();
|
|
80
|
+
if ((material === null || material === void 0 ? void 0 : material.gm) === undefined) {
|
|
81
|
+
const selectMaterial = (_a = this._symNode.symGMaterialSelector()) === null || _a === void 0 ? void 0 : _a.symGMaterial;
|
|
82
|
+
if ((selectMaterial === null || selectMaterial === void 0 ? void 0 : selectMaterial.gm) !== undefined) {
|
|
83
|
+
material = selectMaterial;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if ((material === null || material === void 0 ? void 0 : material.gm) === undefined) {
|
|
87
|
+
const parentMaterial = (_b = this._symNodeParent) === null || _b === void 0 ? void 0 : _b._gMaterial;
|
|
88
|
+
if ((parentMaterial === null || parentMaterial === void 0 ? void 0 : parentMaterial.gm) !== undefined) {
|
|
89
|
+
material = parentMaterial;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
this._gMaterial = material;
|
|
93
|
+
}
|
|
94
|
+
get originalMatrix() {
|
|
95
|
+
if (this._originalMatrix === undefined) {
|
|
96
|
+
const symTransform = this._symNode.symTransform();
|
|
97
|
+
if (symTransform === undefined) {
|
|
98
|
+
this._originalMatrix = Matrix.Identity();
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
const transform = symTransform.transform();
|
|
102
|
+
this._originalMatrix = symTransformToMatrix(transform);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return this._originalMatrix;
|
|
106
|
+
}
|
|
107
|
+
initTransform() {
|
|
108
|
+
this.setPreTransformMatrix(this.originalMatrix);
|
|
109
|
+
}
|
|
110
|
+
initChildren() {
|
|
111
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
const promises = [];
|
|
113
|
+
for (const childNode of (this._symNode.children(this.logger, false, true) || []).values()) {
|
|
114
|
+
promises.push((() => __awaiter(this, void 0, void 0, function* () {
|
|
115
|
+
const childSymNode = yield CfgSymNode.makeCfgSymNode(this._renderEnvironment, this._detailLevel, childNode, this);
|
|
116
|
+
if (childSymNode === undefined) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
this._symNodeChildren.push(childSymNode);
|
|
120
|
+
this.add(childSymNode);
|
|
121
|
+
}))());
|
|
122
|
+
}
|
|
123
|
+
yield Promise.all(promises);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
get isEmpty() {
|
|
127
|
+
return this._deferredMesh === undefined && this._symNodeChildren.length === 0;
|
|
128
|
+
}
|
|
129
|
+
findMaterial(areasToMaterials) {
|
|
130
|
+
if (this._tag !== undefined && areasToMaterials.has(this._tag)) {
|
|
131
|
+
return areasToMaterials.get(this._tag);
|
|
132
|
+
}
|
|
133
|
+
if (this._symNodeParent !== undefined) {
|
|
134
|
+
return this._symNodeParent.findMaterial(areasToMaterials);
|
|
135
|
+
}
|
|
136
|
+
return undefined;
|
|
137
|
+
}
|
|
138
|
+
loadGeo() {
|
|
139
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
140
|
+
this._deferredMesh = yield CfgDeferredMeshNode.makeCfgDeferredMesh(this.logger, this._renderEnvironment, this._detailLevel, this._symNode, this._gMaterial);
|
|
141
|
+
if (this._deferredMesh === undefined) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
this._deferredMesh.setEnabled(false);
|
|
145
|
+
this.add(this._deferredMesh);
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
applyGeo() {
|
|
149
|
+
if (this._deferredMesh !== undefined) {
|
|
150
|
+
this._deferredMesh.setEnabled(true);
|
|
151
|
+
}
|
|
152
|
+
for (const symNodeChild of this._symNodeChildren) {
|
|
153
|
+
symNodeChild.applyGeo();
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
isAllMeshMaterialsReady() {
|
|
157
|
+
return ((this._deferredMesh === undefined || this._deferredMesh.isAllMeshMaterialsReady()) &&
|
|
158
|
+
this._symNodeChildren.reduce((a, c) => a && c.isAllMeshMaterialsReady(), true));
|
|
159
|
+
}
|
|
160
|
+
setMaterialsAndLoad(areasToMaterials, animatorCoordinator) {
|
|
161
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
162
|
+
const promises = [];
|
|
163
|
+
if (this._deferredMesh !== undefined) {
|
|
164
|
+
let mtrlWithMetaData = this.findMaterial(areasToMaterials);
|
|
165
|
+
promises.push(this._deferredMesh.setMaterialAndLoad(mtrlWithMetaData, animatorCoordinator));
|
|
166
|
+
}
|
|
167
|
+
for (const symNodeChild of this._symNodeChildren) {
|
|
168
|
+
promises.push(symNodeChild.setMaterialsAndLoad(areasToMaterials, animatorCoordinator));
|
|
169
|
+
}
|
|
170
|
+
yield Promise.all(promises);
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
applyMaterial() {
|
|
174
|
+
if (this._deferredMesh !== undefined) {
|
|
175
|
+
this._deferredMesh.applyMaterial();
|
|
176
|
+
}
|
|
177
|
+
this._symNodeChildren.forEach((child) => {
|
|
178
|
+
child.applyMaterial();
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
get boundingBox() {
|
|
182
|
+
const bb = this._symNodeChildren.reduce((a, m) => {
|
|
183
|
+
a.expand(m.boundingBox);
|
|
184
|
+
return a;
|
|
185
|
+
}, new CfgBoundingBox());
|
|
186
|
+
if (this._deferredMesh !== undefined) {
|
|
187
|
+
bb.expand(this._deferredMesh.boundingBox);
|
|
188
|
+
}
|
|
189
|
+
bb.applyMatrix(this.originalMatrix);
|
|
190
|
+
return bb;
|
|
191
|
+
}
|
|
192
|
+
addInspectorProperties() {
|
|
193
|
+
super.addInspectorProperties();
|
|
194
|
+
this.addInspectableCustomProperty({
|
|
195
|
+
label: "Detail level",
|
|
196
|
+
propertyName: "_detailLevel",
|
|
197
|
+
type: InspectableType.String,
|
|
198
|
+
});
|
|
199
|
+
this.addInspectableCustomProperty({
|
|
200
|
+
label: "Tag",
|
|
201
|
+
propertyName: "_tag",
|
|
202
|
+
type: InspectableType.String,
|
|
203
|
+
});
|
|
204
|
+
this.addInspectableCustomProperty({
|
|
205
|
+
label: "log symNode",
|
|
206
|
+
propertyName: "_inspectorLogSymNode",
|
|
207
|
+
type: InspectableType.Checkbox,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
get _inspectorLogSymNode() {
|
|
211
|
+
return this._symNode === undefined;
|
|
212
|
+
}
|
|
213
|
+
set _inspectorLogSymNode(x) {
|
|
214
|
+
console.log(this._symNode);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { Matrix } from "@babylonjs/core/Maths/math.vector.js";
|
|
2
|
-
import { CfgMaterialMapping, RootNodeSource, Transform as ModelTransform } from "@configura/web-api";
|
|
3
|
-
import { SymNode } from "@configura/web-core/dist/cm/format/cmsym/SymNode.js";
|
|
4
|
-
import { Logger } from "@configura/web-utilities";
|
|
5
|
-
import { CoordinatorWithMeta } from "../animation/coordinator/Coordinator.js";
|
|
6
|
-
import { RenderEnv } from "../view/RenderEnv.js";
|
|
7
|
-
import { CfgSymNode } from "./CfgSymNode.js";
|
|
8
|
-
export declare function isSymRootNode(value: unknown): value is CfgSymRootNode;
|
|
9
|
-
export declare class CfgSymRootNode extends CfgSymNode {
|
|
10
|
-
private _isForDebug;
|
|
11
|
-
_identifier: string;
|
|
12
|
-
static makeCfgSymRootFromRootNodeSource(logger: Logger, isForDebug: boolean, renderEnvironment: RenderEnv, rootNodeSource: RootNodeSource): Promise<CfgSymRootNode | undefined>;
|
|
13
|
-
static makeCfgSymRootFromUrl(logger: Logger, isForDebug: boolean, renderEnvironment: RenderEnv, symUrl: string, transform: ModelTransform | undefined): Promise<CfgSymRootNode | undefined>;
|
|
14
|
-
static makeCfgSymRootFromFile(logger: Logger, isForDebug: boolean, renderEnvironment: RenderEnv, file: File): Promise<CfgSymRootNode | undefined>;
|
|
15
|
-
get cfgClassName(): string;
|
|
16
|
-
static makeCfgSymRootFromSymNode(logger: Logger, renderEnvironment: RenderEnv, isForDebug: boolean, identifier: string, transform: ModelTransform | undefined, symNode: SymNode): Promise<CfgSymRootNode | undefined>;
|
|
17
|
-
private _destroyed;
|
|
18
|
-
private _originalMatrixWithModelTransform;
|
|
19
|
-
private constructor();
|
|
20
|
-
get isForDebug(): boolean;
|
|
21
|
-
isSameIdentifierAndTransform(rootNodeSource: RootNodeSource): boolean;
|
|
22
|
-
destroy(): void;
|
|
23
|
-
isDestroyed(): boolean;
|
|
24
|
-
applyGeo(): void;
|
|
25
|
-
setMaterialsAndLoad(areasToMaterials: CfgMaterialMapping, animatorCoordinator?: CoordinatorWithMeta): Promise<void>;
|
|
26
|
-
applyMaterial(): void;
|
|
27
|
-
private _modelTransform?;
|
|
28
|
-
private get modelTransform();
|
|
29
|
-
private set modelTransform(value);
|
|
30
|
-
get originalMatrix(): Matrix;
|
|
31
|
-
protected addInspectorProperties(): void;
|
|
32
|
-
private get _inspectorIsForDebug();
|
|
33
|
-
}
|
|
1
|
+
import { Matrix } from "@babylonjs/core/Maths/math.vector.js";
|
|
2
|
+
import { CfgMaterialMapping, RootNodeSource, Transform as ModelTransform } from "@configura/web-api";
|
|
3
|
+
import { SymNode } from "@configura/web-core/dist/cm/format/cmsym/SymNode.js";
|
|
4
|
+
import { Logger } from "@configura/web-utilities";
|
|
5
|
+
import { CoordinatorWithMeta } from "../animation/coordinator/Coordinator.js";
|
|
6
|
+
import { RenderEnv } from "../view/RenderEnv.js";
|
|
7
|
+
import { CfgSymNode } from "./CfgSymNode.js";
|
|
8
|
+
export declare function isSymRootNode(value: unknown): value is CfgSymRootNode;
|
|
9
|
+
export declare class CfgSymRootNode extends CfgSymNode {
|
|
10
|
+
private _isForDebug;
|
|
11
|
+
_identifier: string;
|
|
12
|
+
static makeCfgSymRootFromRootNodeSource(logger: Logger, isForDebug: boolean, renderEnvironment: RenderEnv, rootNodeSource: RootNodeSource): Promise<CfgSymRootNode | undefined>;
|
|
13
|
+
static makeCfgSymRootFromUrl(logger: Logger, isForDebug: boolean, renderEnvironment: RenderEnv, symUrl: string, transform: ModelTransform | undefined): Promise<CfgSymRootNode | undefined>;
|
|
14
|
+
static makeCfgSymRootFromFile(logger: Logger, isForDebug: boolean, renderEnvironment: RenderEnv, file: File): Promise<CfgSymRootNode | undefined>;
|
|
15
|
+
get cfgClassName(): string;
|
|
16
|
+
static makeCfgSymRootFromSymNode(logger: Logger, renderEnvironment: RenderEnv, isForDebug: boolean, identifier: string, transform: ModelTransform | undefined, symNode: SymNode): Promise<CfgSymRootNode | undefined>;
|
|
17
|
+
private _destroyed;
|
|
18
|
+
private _originalMatrixWithModelTransform;
|
|
19
|
+
private constructor();
|
|
20
|
+
get isForDebug(): boolean;
|
|
21
|
+
isSameIdentifierAndTransform(rootNodeSource: RootNodeSource): boolean;
|
|
22
|
+
destroy(): void;
|
|
23
|
+
isDestroyed(): boolean;
|
|
24
|
+
applyGeo(): void;
|
|
25
|
+
setMaterialsAndLoad(areasToMaterials: CfgMaterialMapping, animatorCoordinator?: CoordinatorWithMeta): Promise<void>;
|
|
26
|
+
applyMaterial(): void;
|
|
27
|
+
private _modelTransform?;
|
|
28
|
+
private get modelTransform();
|
|
29
|
+
private set modelTransform(value);
|
|
30
|
+
get originalMatrix(): Matrix;
|
|
31
|
+
protected addInspectorProperties(): void;
|
|
32
|
+
private get _inspectorIsForDebug();
|
|
33
|
+
}
|
|
34
34
|
//# sourceMappingURL=CfgSymRootNode.d.ts.map
|