@configura/babylon-view 1.3.0-alpha.3 → 1.3.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/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 +26 -10
- package/dist/camera/CfgArcRotateCameraPointersInput.js +264 -262
- package/dist/camera/CfgOrbitalCamera.d.ts +68 -68
- package/dist/camera/CfgOrbitalCamera.js +250 -250
- 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 +29 -12
- package/dist/geometry/CfgGeometry.js +146 -117
- package/dist/geometry/CfgMesh.d.ts +10 -7
- package/dist/geometry/CfgMesh.js +38 -8
- package/dist/geometry/geoSplitter.d.ts +8 -8
- package/dist/geometry/geoSplitter.js +192 -192
- package/dist/geometry/stretch/CfgMorphTarget.d.ts +16 -0
- package/dist/geometry/stretch/CfgMorphTarget.js +65 -0
- package/dist/geometry/stretch/CfgStretchData.d.ts +115 -0
- package/dist/geometry/stretch/CfgStretchData.js +340 -0
- package/dist/geometry/stretch/CfgStretchMorphGeometry.d.ts +17 -0
- package/dist/geometry/stretch/CfgStretchMorphGeometry.js +95 -0
- 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 +68 -53
- package/dist/material/CfgMaterial.js +482 -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 +306 -304
- package/dist/nodes/CfgContentRootNode.d.ts +19 -19
- package/dist/nodes/CfgContentRootNode.js +75 -75
- package/dist/nodes/CfgDeferredMeshNode.d.ts +55 -48
- package/dist/nodes/CfgDeferredMeshNode.js +377 -347
- package/dist/nodes/CfgProductNode.d.ts +126 -61
- package/dist/nodes/CfgProductNode.js +578 -486
- package/dist/nodes/CfgSymNode.d.ts +50 -42
- package/dist/nodes/CfgSymNode.js +249 -216
- package/dist/nodes/CfgSymRootNode.d.ts +45 -33
- package/dist/nodes/CfgSymRootNode.js +220 -175
- package/dist/nodes/CfgTransformNode.d.ts +33 -29
- package/dist/nodes/CfgTransformNode.js +83 -81
- package/dist/scene/SceneCreator.d.ts +6 -6
- package/dist/scene/SceneCreator.js +22 -22
- package/dist/utilities/CfgBoundingBox.d.ts +21 -16
- package/dist/utilities/CfgBoundingBox.js +81 -64
- package/dist/utilities/anchor/anchor.d.ts +52 -0
- package/dist/utilities/anchor/anchor.js +136 -0
- package/dist/utilities/anchor/anchorMap.d.ts +21 -0
- package/dist/utilities/anchor/anchorMap.js +111 -0
- package/dist/utilities/utilities3D.d.ts +70 -26
- package/dist/utilities/utilities3D.js +265 -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 +7 -5
- package/dist/utilities/utilitiesSymRootIdentifier.js +26 -20
- package/dist/view/BaseView.d.ts +78 -70
- package/dist/view/BaseView.js +297 -291
- package/dist/view/BaseViewConfiguration.d.ts +32 -32
- package/dist/view/BaseViewConfiguration.js +8 -8
- package/dist/view/RenderEnv.d.ts +43 -38
- package/dist/view/RenderEnv.js +7 -7
- package/dist/view/SingleProductDefaultCameraView.d.ts +33 -33
- package/dist/view/SingleProductDefaultCameraView.js +141 -141
- package/dist/view/SingleProductDefaultCameraViewConfiguration.d.ts +46 -46
- package/dist/view/SingleProductDefaultCameraViewConfiguration.js +11 -11
- package/dist/view/SingleProductView.d.ts +49 -42
- package/dist/view/SingleProductView.js +206 -205
- package/dist/view/SingleProductViewConfiguration.d.ts +32 -32
- package/dist/view/SingleProductViewConfiguration.js +19 -19
- package/package.json +5 -5
|
@@ -1,43 +1,51 @@
|
|
|
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 {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
private
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
private
|
|
27
|
-
private
|
|
28
|
-
|
|
29
|
-
protected
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
private
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
private
|
|
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 { CfgStretchData } from "../geometry/stretch/CfgStretchData.js";
|
|
9
|
+
import { CfgBoundingBox } from "../utilities/CfgBoundingBox.js";
|
|
10
|
+
import { RenderEnv } from "../view/RenderEnv.js";
|
|
11
|
+
import { CfgProductNode } from "./CfgProductNode.js";
|
|
12
|
+
import { CfgTransformNode } from "./CfgTransformNode.js";
|
|
13
|
+
export declare class CfgSymNode extends CfgTransformNode implements LogProducer, AnimatableObject {
|
|
14
|
+
readonly cfgProductNode: CfgProductNode;
|
|
15
|
+
private readonly _cfgSymNodeParent;
|
|
16
|
+
readonly _detailLevel: DetailLevel;
|
|
17
|
+
readonly _symNode: SymNode;
|
|
18
|
+
static makeCfgSymNode(renderEnvironment: RenderEnv, cfgProductNode: CfgProductNode, cfgSymNodeParent: CfgSymNode, detailLevel: DetailLevel, symNode: SymNode): Promise<CfgSymNode | undefined>;
|
|
19
|
+
get cfgClassName(): string;
|
|
20
|
+
protected static initCfgSymNode(node: CfgSymNode): Promise<void>;
|
|
21
|
+
logger: LogObservable;
|
|
22
|
+
_tag: string | undefined;
|
|
23
|
+
private _gMaterial;
|
|
24
|
+
private _symNodeChildren;
|
|
25
|
+
private _deferredMesh;
|
|
26
|
+
private _originalMatrix;
|
|
27
|
+
private _invertedOriginalMatrix;
|
|
28
|
+
private _accumulatedStretchDatas;
|
|
29
|
+
protected constructor(renderEnvironment: RenderEnv, cfgProductNode: CfgProductNode, _cfgSymNodeParent: CfgSymNode | undefined, _detailLevel: DetailLevel, _symNode: SymNode);
|
|
30
|
+
get accumulatedStretchDatas(): CfgStretchData[];
|
|
31
|
+
refreshStretch(): void;
|
|
32
|
+
getChildrenForAnimation(): CfgTransformNode[];
|
|
33
|
+
private initTag;
|
|
34
|
+
private initGMaterial;
|
|
35
|
+
get originalMatrix(): Matrix;
|
|
36
|
+
get invertedOriginalMatrix(): Matrix;
|
|
37
|
+
protected initTransform(): void;
|
|
38
|
+
private initChildren;
|
|
39
|
+
get isEmpty(): boolean;
|
|
40
|
+
findMaterial(areasToMaterials: CfgMaterialMapping): CfgMtrlSourceWithMetaData | undefined;
|
|
41
|
+
private loadGeo;
|
|
42
|
+
applyGeo(): void;
|
|
43
|
+
isAllMeshMaterialsReady(): boolean;
|
|
44
|
+
setMaterialsAndLoad(areasToMaterials: CfgMaterialMapping, animatorCoordinator?: CoordinatorWithMeta): Promise<void>;
|
|
45
|
+
applyMaterial(): void;
|
|
46
|
+
get boundingBox(): CfgBoundingBox;
|
|
47
|
+
protected addInspectorProperties(): void;
|
|
48
|
+
private get _inspectorLogSymNode();
|
|
49
|
+
private set _inspectorLogSymNode(value);
|
|
50
|
+
}
|
|
43
51
|
//# sourceMappingURL=CfgSymNode.d.ts.map
|
package/dist/nodes/CfgSymNode.js
CHANGED
|
@@ -1,216 +1,249 @@
|
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
node
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
return
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
this
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
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, _b;
|
|
20
|
+
// Do not render SymPlanes. Disable to debug Stretch. Search for aTriMeshPlane to set radius.
|
|
21
|
+
if (symNode.symPlane() !== undefined) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
// Do not render connectors. Disable to debug connectors, only boxes will show up for now.
|
|
25
|
+
if (((_b = (_a = symNode.symTags()) === null || _a === void 0 ? void 0 : _a.node) === null || _b === void 0 ? void 0 : _b.components.has("symConnector")) === true) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
export class CfgSymNode extends CfgTransformNode {
|
|
31
|
+
constructor(renderEnvironment, cfgProductNode, _cfgSymNodeParent, _detailLevel, _symNode) {
|
|
32
|
+
super(renderEnvironment, "(SymNode) " + _symNode.id);
|
|
33
|
+
this.cfgProductNode = cfgProductNode;
|
|
34
|
+
this._cfgSymNodeParent = _cfgSymNodeParent;
|
|
35
|
+
this._detailLevel = _detailLevel;
|
|
36
|
+
this._symNode = _symNode;
|
|
37
|
+
this.logger = new LogObservable();
|
|
38
|
+
this._symNodeChildren = [];
|
|
39
|
+
this.initTransform();
|
|
40
|
+
}
|
|
41
|
+
static makeCfgSymNode(renderEnvironment, cfgProductNode, cfgSymNodeParent, detailLevel, symNode) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
if (isNoRender(symNode)) {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
const node = new this(renderEnvironment, cfgProductNode, cfgSymNodeParent, detailLevel, symNode);
|
|
47
|
+
yield this.initCfgSymNode(node);
|
|
48
|
+
if (node.isEmpty) {
|
|
49
|
+
if (renderEnvironment.cullEmptyNodes) {
|
|
50
|
+
node.dispose();
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
node.logger.info("Empty node");
|
|
54
|
+
}
|
|
55
|
+
if (node._tag && node._tag.length > 0) {
|
|
56
|
+
node.name += " | " + node._tag;
|
|
57
|
+
}
|
|
58
|
+
return node;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
get cfgClassName() {
|
|
62
|
+
return "CfgSymNode";
|
|
63
|
+
}
|
|
64
|
+
static initCfgSymNode(node) {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
node.initTag();
|
|
67
|
+
node.initGMaterial();
|
|
68
|
+
yield node.initChildren();
|
|
69
|
+
yield node.loadGeo();
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
get accumulatedStretchDatas() {
|
|
73
|
+
var _a;
|
|
74
|
+
if (this._accumulatedStretchDatas === undefined) {
|
|
75
|
+
this._accumulatedStretchDatas = (((_a = this._cfgSymNodeParent) === null || _a === void 0 ? void 0 : _a.accumulatedStretchDatas) || []).map((stretchData) => stretchData.applyMatrix(this.invertedOriginalMatrix));
|
|
76
|
+
}
|
|
77
|
+
return this._accumulatedStretchDatas;
|
|
78
|
+
}
|
|
79
|
+
refreshStretch() {
|
|
80
|
+
if (this._deferredMesh !== undefined) {
|
|
81
|
+
this._deferredMesh.refreshStretch();
|
|
82
|
+
}
|
|
83
|
+
for (const child of this._symNodeChildren) {
|
|
84
|
+
child.refreshStretch();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
getChildrenForAnimation() {
|
|
88
|
+
const target = super.getChildrenForAnimation();
|
|
89
|
+
if (this._deferredMesh !== undefined) {
|
|
90
|
+
target.push(this._deferredMesh);
|
|
91
|
+
}
|
|
92
|
+
return target;
|
|
93
|
+
}
|
|
94
|
+
initTag() {
|
|
95
|
+
const symTags = this._symNode.symTags();
|
|
96
|
+
if (symTags instanceof SymTags && symTags.main !== undefined) {
|
|
97
|
+
this._tag = symTags.main;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
initGMaterial() {
|
|
101
|
+
var _a, _b;
|
|
102
|
+
let material = this._symNode.symGMaterial();
|
|
103
|
+
if ((material === null || material === void 0 ? void 0 : material.gm) === undefined) {
|
|
104
|
+
const selectMaterial = (_a = this._symNode.symGMaterialSelector()) === null || _a === void 0 ? void 0 : _a.symGMaterial;
|
|
105
|
+
if ((selectMaterial === null || selectMaterial === void 0 ? void 0 : selectMaterial.gm) !== undefined) {
|
|
106
|
+
material = selectMaterial;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if ((material === null || material === void 0 ? void 0 : material.gm) === undefined) {
|
|
110
|
+
const parentMaterial = (_b = this._cfgSymNodeParent) === null || _b === void 0 ? void 0 : _b._gMaterial;
|
|
111
|
+
if ((parentMaterial === null || parentMaterial === void 0 ? void 0 : parentMaterial.gm) !== undefined) {
|
|
112
|
+
material = parentMaterial;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
this._gMaterial = material;
|
|
116
|
+
}
|
|
117
|
+
get originalMatrix() {
|
|
118
|
+
if (this._originalMatrix === undefined) {
|
|
119
|
+
const symTransform = this._symNode.symTransform();
|
|
120
|
+
if (symTransform === undefined) {
|
|
121
|
+
this._originalMatrix = Matrix.Identity();
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
const transform = symTransform.transform();
|
|
125
|
+
this._originalMatrix = symTransformToMatrix(transform);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return this._originalMatrix;
|
|
129
|
+
}
|
|
130
|
+
get invertedOriginalMatrix() {
|
|
131
|
+
if (this._invertedOriginalMatrix === undefined) {
|
|
132
|
+
this._invertedOriginalMatrix = this.originalMatrix.clone().invert();
|
|
133
|
+
}
|
|
134
|
+
return this._invertedOriginalMatrix;
|
|
135
|
+
}
|
|
136
|
+
initTransform() {
|
|
137
|
+
this.setPreTransformMatrix(this.originalMatrix);
|
|
138
|
+
}
|
|
139
|
+
initChildren() {
|
|
140
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
141
|
+
const promises = [];
|
|
142
|
+
const { logger, _detailLevel: detailLevel } = this;
|
|
143
|
+
for (const childNode of (this._symNode.children(this.logger, false, true) || []).values()) {
|
|
144
|
+
if (childNode.isStretch(logger, detailLevel)) {
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
promises.push((() => __awaiter(this, void 0, void 0, function* () {
|
|
148
|
+
const childSymNode = yield CfgSymNode.makeCfgSymNode(this._renderEnvironment, this.cfgProductNode, this, this._detailLevel, childNode);
|
|
149
|
+
if (childSymNode === undefined) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
this._symNodeChildren.push(childSymNode);
|
|
153
|
+
this.add(childSymNode);
|
|
154
|
+
}))());
|
|
155
|
+
}
|
|
156
|
+
yield Promise.all(promises);
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
get isEmpty() {
|
|
160
|
+
return this._deferredMesh === undefined && this._symNodeChildren.length === 0;
|
|
161
|
+
}
|
|
162
|
+
findMaterial(areasToMaterials) {
|
|
163
|
+
if (this._tag !== undefined && areasToMaterials.has(this._tag)) {
|
|
164
|
+
return areasToMaterials.get(this._tag);
|
|
165
|
+
}
|
|
166
|
+
if (this._cfgSymNodeParent !== undefined) {
|
|
167
|
+
return this._cfgSymNodeParent.findMaterial(areasToMaterials);
|
|
168
|
+
}
|
|
169
|
+
return undefined;
|
|
170
|
+
}
|
|
171
|
+
loadGeo() {
|
|
172
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
173
|
+
this._deferredMesh = yield CfgDeferredMeshNode.makeCfgDeferredMesh(this.logger, this._renderEnvironment, this.cfgProductNode, this._detailLevel, this._symNode, this._gMaterial, this.accumulatedStretchDatas);
|
|
174
|
+
if (this._deferredMesh === undefined) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
this._deferredMesh.setEnabled(false);
|
|
178
|
+
this.add(this._deferredMesh);
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
applyGeo() {
|
|
182
|
+
if (this._deferredMesh !== undefined) {
|
|
183
|
+
this._deferredMesh.setEnabled(true);
|
|
184
|
+
}
|
|
185
|
+
for (const symNodeChild of this._symNodeChildren) {
|
|
186
|
+
symNodeChild.applyGeo();
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
isAllMeshMaterialsReady() {
|
|
190
|
+
return ((this._deferredMesh === undefined || this._deferredMesh.isAllMeshMaterialsReady()) &&
|
|
191
|
+
this._symNodeChildren.reduce((a, c) => a && c.isAllMeshMaterialsReady(), true));
|
|
192
|
+
}
|
|
193
|
+
setMaterialsAndLoad(areasToMaterials, animatorCoordinator) {
|
|
194
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
195
|
+
const promises = [];
|
|
196
|
+
if (this._deferredMesh !== undefined) {
|
|
197
|
+
let mtrlWithMetaData = this.findMaterial(areasToMaterials);
|
|
198
|
+
promises.push(this._deferredMesh.setMaterialAndLoad(mtrlWithMetaData, animatorCoordinator));
|
|
199
|
+
}
|
|
200
|
+
for (const symNodeChild of this._symNodeChildren) {
|
|
201
|
+
promises.push(symNodeChild.setMaterialsAndLoad(areasToMaterials, animatorCoordinator));
|
|
202
|
+
}
|
|
203
|
+
yield Promise.all(promises);
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
applyMaterial() {
|
|
207
|
+
if (this._deferredMesh !== undefined) {
|
|
208
|
+
this._deferredMesh.applyMaterial();
|
|
209
|
+
}
|
|
210
|
+
this._symNodeChildren.forEach((child) => {
|
|
211
|
+
child.applyMaterial();
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
get boundingBox() {
|
|
215
|
+
const bb = new CfgBoundingBox();
|
|
216
|
+
for (const symNodeChild of this._symNodeChildren) {
|
|
217
|
+
bb.expand(symNodeChild.boundingBox);
|
|
218
|
+
}
|
|
219
|
+
if (this._deferredMesh !== undefined) {
|
|
220
|
+
bb.expand(this._deferredMesh.boundingBox);
|
|
221
|
+
}
|
|
222
|
+
bb.applyMatrix(this.originalMatrix);
|
|
223
|
+
return bb;
|
|
224
|
+
}
|
|
225
|
+
addInspectorProperties() {
|
|
226
|
+
super.addInspectorProperties();
|
|
227
|
+
this.addInspectableCustomProperty({
|
|
228
|
+
label: "Detail level",
|
|
229
|
+
propertyName: "_detailLevel",
|
|
230
|
+
type: InspectableType.String,
|
|
231
|
+
});
|
|
232
|
+
this.addInspectableCustomProperty({
|
|
233
|
+
label: "Tag",
|
|
234
|
+
propertyName: "_tag",
|
|
235
|
+
type: InspectableType.String,
|
|
236
|
+
});
|
|
237
|
+
this.addInspectableCustomProperty({
|
|
238
|
+
label: "log symNode",
|
|
239
|
+
propertyName: "_inspectorLogSymNode",
|
|
240
|
+
type: InspectableType.Checkbox,
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
get _inspectorLogSymNode() {
|
|
244
|
+
return this._symNode === undefined;
|
|
245
|
+
}
|
|
246
|
+
set _inspectorLogSymNode(x) {
|
|
247
|
+
console.log(this._symNode);
|
|
248
|
+
}
|
|
249
|
+
}
|