@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,192 +1,192 @@
|
|
|
1
|
-
import { VertexBuffer } from "@babylonjs/core/Meshes/buffer.js";
|
|
2
|
-
// Will try to split the geometry along planes on the xy, yz and xz-planes for
|
|
3
|
-
// a total of maximum 8 groups. If a triangle straddles a plane those groups
|
|
4
|
-
// will be merged
|
|
5
|
-
export function splitIndexQuick(logger, geo) {
|
|
6
|
-
const indexArray = geo.getIndices();
|
|
7
|
-
if (!indexArray) {
|
|
8
|
-
logger.info("No index array, could not try split geo");
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
const indexCount = geo.getTotalIndices();
|
|
12
|
-
if (indexCount === 0) {
|
|
13
|
-
logger.warn("Empty geo index");
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
const positionArray = geo.getVerticesData(VertexBuffer.PositionKind);
|
|
17
|
-
if (!positionArray) {
|
|
18
|
-
logger.info("No position array, could not try split geo");
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
// Three axis, so max potential resultGroups 2^3
|
|
22
|
-
const resultGroups = [[], [], [], [], [], [], [], []];
|
|
23
|
-
for (let triIndex = 0; triIndex < indexCount; triIndex += 3) {
|
|
24
|
-
const belongsInGroups = [];
|
|
25
|
-
// For each triangle
|
|
26
|
-
for (let i = triIndex; i < triIndex + 3; i++) {
|
|
27
|
-
const offset = indexArray[i] * 3;
|
|
28
|
-
let belongsIndex = 0;
|
|
29
|
-
for (let c = 0; c < 3; c++) {
|
|
30
|
-
belongsIndex += 0 <= positionArray[offset + c] ? 1 << c : 0;
|
|
31
|
-
}
|
|
32
|
-
if (!belongsInGroups.some((g) => g === belongsIndex)) {
|
|
33
|
-
belongsInGroups.push(belongsIndex);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
const targetGroup = resultGroups[belongsInGroups[0]];
|
|
37
|
-
// Merge groups straddled by this triangle (if needed)
|
|
38
|
-
for (let i = 1; i < belongsInGroups.length; i++) {
|
|
39
|
-
const resultGroupIndex = belongsInGroups[i];
|
|
40
|
-
const otherGroup = resultGroups[resultGroupIndex];
|
|
41
|
-
// Let this position in the result groups array point to the same group as they share
|
|
42
|
-
// at least one triangle
|
|
43
|
-
if (targetGroup !== otherGroup) {
|
|
44
|
-
// The group can be in multiple positions
|
|
45
|
-
let j = resultGroups.length;
|
|
46
|
-
while (j--) {
|
|
47
|
-
if (otherGroup === resultGroups[j]) {
|
|
48
|
-
resultGroups[j] = targetGroup;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
const otherGroupLength = otherGroup.length;
|
|
52
|
-
for (let j = 0; j < otherGroupLength; j++) {
|
|
53
|
-
targetGroup.push(otherGroup[j]);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
for (let i = triIndex; i < triIndex + 3; i++) {
|
|
58
|
-
targetGroup.push(indexArray[i]);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
// Filter so that we only get one instance of each group and no empty groups
|
|
62
|
-
let i = resultGroups.length;
|
|
63
|
-
while (i--) {
|
|
64
|
-
const group = resultGroups[i];
|
|
65
|
-
if (group.length === 0) {
|
|
66
|
-
resultGroups.splice(i, 1);
|
|
67
|
-
continue;
|
|
68
|
-
}
|
|
69
|
-
let j = i;
|
|
70
|
-
while (j--) {
|
|
71
|
-
if (group === resultGroups[j]) {
|
|
72
|
-
resultGroups.splice(i, 1);
|
|
73
|
-
break;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return resultGroups;
|
|
78
|
-
}
|
|
79
|
-
export function splitIndexComplete(logger, geo, conf) {
|
|
80
|
-
const { maxProgressGroups, maxFinalGroups, acceptCoordinateMatch } = conf;
|
|
81
|
-
const indexArray = geo.getIndices();
|
|
82
|
-
if (!indexArray) {
|
|
83
|
-
logger.info("No index array, could not try split geo");
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
const indexCount = geo.getTotalIndices();
|
|
87
|
-
if (indexCount === 0) {
|
|
88
|
-
logger.warn("Empty geo index");
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
const positionArray = geo.getVerticesData(VertexBuffer.PositionKind);
|
|
92
|
-
if (!positionArray) {
|
|
93
|
-
logger.info("No position array, could not try split geo");
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
const resultGroups = [];
|
|
97
|
-
let targetGroup;
|
|
98
|
-
// Loop over each triangle in the index
|
|
99
|
-
for (let triIndex = 0; triIndex < indexCount; triIndex += 3) {
|
|
100
|
-
// Groups that neighbor this triangle
|
|
101
|
-
const intersectingGroupIndices = [];
|
|
102
|
-
const resultGroupsCount = resultGroups.length;
|
|
103
|
-
if (maxProgressGroups < resultGroupsCount) {
|
|
104
|
-
logger.info(`Geo split into too many groups while in progress`, `(max allowed ${maxProgressGroups})`);
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
// Loop over each group.
|
|
108
|
-
for (let resultGroupIndex = 0; resultGroupIndex < resultGroupsCount; resultGroupIndex++) {
|
|
109
|
-
const group = resultGroups[resultGroupIndex];
|
|
110
|
-
const groupLength = group.length;
|
|
111
|
-
let found = false;
|
|
112
|
-
// For nodes in the current triangle
|
|
113
|
-
for (let i = triIndex; i < triIndex + 3; i++) {
|
|
114
|
-
let j = groupLength;
|
|
115
|
-
// Loop backwards through indices in the group. Backwards since it's likely new
|
|
116
|
-
// nodes will be close to previous ones
|
|
117
|
-
while (j--) {
|
|
118
|
-
if (indexArray[i] === group[j]) {
|
|
119
|
-
intersectingGroupIndices.push(resultGroupIndex);
|
|
120
|
-
found = true;
|
|
121
|
-
break;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
if (found) {
|
|
125
|
-
break;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
if (!found && acceptCoordinateMatch) {
|
|
129
|
-
// For nodes in the current triangle
|
|
130
|
-
for (let i = triIndex; i < triIndex + 3; i++) {
|
|
131
|
-
let j = groupLength;
|
|
132
|
-
// Loop backwards through indices in the group. Backwards since it's likely new
|
|
133
|
-
// nodes will be close to previous ones
|
|
134
|
-
while (j--) {
|
|
135
|
-
const offset1 = indexArray[i] * 3;
|
|
136
|
-
const offset2 = group[j] * 3;
|
|
137
|
-
let c = 3;
|
|
138
|
-
while (c--) {
|
|
139
|
-
if (positionArray[offset1 + c] !== positionArray[offset2 + c]) {
|
|
140
|
-
break;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
if (c === -1) {
|
|
144
|
-
intersectingGroupIndices.push(resultGroupIndex);
|
|
145
|
-
found = true;
|
|
146
|
-
break;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
if (found) {
|
|
150
|
-
break;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
targetGroup = undefined;
|
|
156
|
-
const intersectingGroupIndicesCount = intersectingGroupIndices.length;
|
|
157
|
-
if (intersectingGroupIndicesCount === 0) {
|
|
158
|
-
// The triangle is not adjacent to any existing node in any group
|
|
159
|
-
targetGroup = [];
|
|
160
|
-
resultGroups.push(targetGroup);
|
|
161
|
-
}
|
|
162
|
-
else {
|
|
163
|
-
let i = intersectingGroupIndicesCount - 1;
|
|
164
|
-
// Pick one (probably not important which one) to merge the other groups into. If this
|
|
165
|
-
// was the only one it will skip the loop
|
|
166
|
-
targetGroup = resultGroups[intersectingGroupIndices[i]];
|
|
167
|
-
// The nodes are sorted in ascending order. So we back through to nodes to allow us to
|
|
168
|
-
// use splice without disturbing unbroken ground.
|
|
169
|
-
while (i--) {
|
|
170
|
-
// Move all nodes to the target group and remove this one, as the latest triangle
|
|
171
|
-
// is adjacent to both
|
|
172
|
-
const resultGroupIndex = intersectingGroupIndices[i];
|
|
173
|
-
const group = resultGroups[resultGroupIndex];
|
|
174
|
-
resultGroups.splice(resultGroupIndex, 1);
|
|
175
|
-
const resultGroupCount = group.length;
|
|
176
|
-
for (let j = 0; j < resultGroupCount; j++) {
|
|
177
|
-
targetGroup.push(group[j]);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
// Add the latest triangle to the target group
|
|
182
|
-
for (let i = triIndex; i < triIndex + 3; i++) {
|
|
183
|
-
targetGroup.push(indexArray[i]);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
const resultGroupsCount = resultGroups.length;
|
|
187
|
-
if (resultGroupsCount > maxFinalGroups) {
|
|
188
|
-
logger.info(`Geo split into too many final groups`, `(actual ${resultGroupsCount}, max allowed ${maxFinalGroups})`);
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
return resultGroups;
|
|
192
|
-
}
|
|
1
|
+
import { VertexBuffer } from "@babylonjs/core/Meshes/buffer.js";
|
|
2
|
+
// Will try to split the geometry along planes on the xy, yz and xz-planes for
|
|
3
|
+
// a total of maximum 8 groups. If a triangle straddles a plane those groups
|
|
4
|
+
// will be merged
|
|
5
|
+
export function splitIndexQuick(logger, geo) {
|
|
6
|
+
const indexArray = geo.getIndices();
|
|
7
|
+
if (!indexArray) {
|
|
8
|
+
logger.info("No index array, could not try split geo");
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const indexCount = geo.getTotalIndices();
|
|
12
|
+
if (indexCount === 0) {
|
|
13
|
+
logger.warn("Empty geo index");
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const positionArray = geo.getVerticesData(VertexBuffer.PositionKind);
|
|
17
|
+
if (!positionArray) {
|
|
18
|
+
logger.info("No position array, could not try split geo");
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
// Three axis, so max potential resultGroups 2^3
|
|
22
|
+
const resultGroups = [[], [], [], [], [], [], [], []];
|
|
23
|
+
for (let triIndex = 0; triIndex < indexCount; triIndex += 3) {
|
|
24
|
+
const belongsInGroups = [];
|
|
25
|
+
// For each triangle
|
|
26
|
+
for (let i = triIndex; i < triIndex + 3; i++) {
|
|
27
|
+
const offset = indexArray[i] * 3;
|
|
28
|
+
let belongsIndex = 0;
|
|
29
|
+
for (let c = 0; c < 3; c++) {
|
|
30
|
+
belongsIndex += 0 <= positionArray[offset + c] ? 1 << c : 0;
|
|
31
|
+
}
|
|
32
|
+
if (!belongsInGroups.some((g) => g === belongsIndex)) {
|
|
33
|
+
belongsInGroups.push(belongsIndex);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const targetGroup = resultGroups[belongsInGroups[0]];
|
|
37
|
+
// Merge groups straddled by this triangle (if needed)
|
|
38
|
+
for (let i = 1; i < belongsInGroups.length; i++) {
|
|
39
|
+
const resultGroupIndex = belongsInGroups[i];
|
|
40
|
+
const otherGroup = resultGroups[resultGroupIndex];
|
|
41
|
+
// Let this position in the result groups array point to the same group as they share
|
|
42
|
+
// at least one triangle
|
|
43
|
+
if (targetGroup !== otherGroup) {
|
|
44
|
+
// The group can be in multiple positions
|
|
45
|
+
let j = resultGroups.length;
|
|
46
|
+
while (j--) {
|
|
47
|
+
if (otherGroup === resultGroups[j]) {
|
|
48
|
+
resultGroups[j] = targetGroup;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const otherGroupLength = otherGroup.length;
|
|
52
|
+
for (let j = 0; j < otherGroupLength; j++) {
|
|
53
|
+
targetGroup.push(otherGroup[j]);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
for (let i = triIndex; i < triIndex + 3; i++) {
|
|
58
|
+
targetGroup.push(indexArray[i]);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
// Filter so that we only get one instance of each group and no empty groups
|
|
62
|
+
let i = resultGroups.length;
|
|
63
|
+
while (i--) {
|
|
64
|
+
const group = resultGroups[i];
|
|
65
|
+
if (group.length === 0) {
|
|
66
|
+
resultGroups.splice(i, 1);
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
let j = i;
|
|
70
|
+
while (j--) {
|
|
71
|
+
if (group === resultGroups[j]) {
|
|
72
|
+
resultGroups.splice(i, 1);
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return resultGroups;
|
|
78
|
+
}
|
|
79
|
+
export function splitIndexComplete(logger, geo, conf) {
|
|
80
|
+
const { maxProgressGroups, maxFinalGroups, acceptCoordinateMatch } = conf;
|
|
81
|
+
const indexArray = geo.getIndices();
|
|
82
|
+
if (!indexArray) {
|
|
83
|
+
logger.info("No index array, could not try split geo");
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const indexCount = geo.getTotalIndices();
|
|
87
|
+
if (indexCount === 0) {
|
|
88
|
+
logger.warn("Empty geo index");
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const positionArray = geo.getVerticesData(VertexBuffer.PositionKind);
|
|
92
|
+
if (!positionArray) {
|
|
93
|
+
logger.info("No position array, could not try split geo");
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const resultGroups = [];
|
|
97
|
+
let targetGroup;
|
|
98
|
+
// Loop over each triangle in the index
|
|
99
|
+
for (let triIndex = 0; triIndex < indexCount; triIndex += 3) {
|
|
100
|
+
// Groups that neighbor this triangle
|
|
101
|
+
const intersectingGroupIndices = [];
|
|
102
|
+
const resultGroupsCount = resultGroups.length;
|
|
103
|
+
if (maxProgressGroups < resultGroupsCount) {
|
|
104
|
+
logger.info(`Geo split into too many groups while in progress`, `(max allowed ${maxProgressGroups})`);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
// Loop over each group.
|
|
108
|
+
for (let resultGroupIndex = 0; resultGroupIndex < resultGroupsCount; resultGroupIndex++) {
|
|
109
|
+
const group = resultGroups[resultGroupIndex];
|
|
110
|
+
const groupLength = group.length;
|
|
111
|
+
let found = false;
|
|
112
|
+
// For nodes in the current triangle
|
|
113
|
+
for (let i = triIndex; i < triIndex + 3; i++) {
|
|
114
|
+
let j = groupLength;
|
|
115
|
+
// Loop backwards through indices in the group. Backwards since it's likely new
|
|
116
|
+
// nodes will be close to previous ones
|
|
117
|
+
while (j--) {
|
|
118
|
+
if (indexArray[i] === group[j]) {
|
|
119
|
+
intersectingGroupIndices.push(resultGroupIndex);
|
|
120
|
+
found = true;
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (found) {
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if (!found && acceptCoordinateMatch) {
|
|
129
|
+
// For nodes in the current triangle
|
|
130
|
+
for (let i = triIndex; i < triIndex + 3; i++) {
|
|
131
|
+
let j = groupLength;
|
|
132
|
+
// Loop backwards through indices in the group. Backwards since it's likely new
|
|
133
|
+
// nodes will be close to previous ones
|
|
134
|
+
while (j--) {
|
|
135
|
+
const offset1 = indexArray[i] * 3;
|
|
136
|
+
const offset2 = group[j] * 3;
|
|
137
|
+
let c = 3;
|
|
138
|
+
while (c--) {
|
|
139
|
+
if (positionArray[offset1 + c] !== positionArray[offset2 + c]) {
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if (c === -1) {
|
|
144
|
+
intersectingGroupIndices.push(resultGroupIndex);
|
|
145
|
+
found = true;
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
if (found) {
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
targetGroup = undefined;
|
|
156
|
+
const intersectingGroupIndicesCount = intersectingGroupIndices.length;
|
|
157
|
+
if (intersectingGroupIndicesCount === 0) {
|
|
158
|
+
// The triangle is not adjacent to any existing node in any group
|
|
159
|
+
targetGroup = [];
|
|
160
|
+
resultGroups.push(targetGroup);
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
let i = intersectingGroupIndicesCount - 1;
|
|
164
|
+
// Pick one (probably not important which one) to merge the other groups into. If this
|
|
165
|
+
// was the only one it will skip the loop
|
|
166
|
+
targetGroup = resultGroups[intersectingGroupIndices[i]];
|
|
167
|
+
// The nodes are sorted in ascending order. So we back through to nodes to allow us to
|
|
168
|
+
// use splice without disturbing unbroken ground.
|
|
169
|
+
while (i--) {
|
|
170
|
+
// Move all nodes to the target group and remove this one, as the latest triangle
|
|
171
|
+
// is adjacent to both
|
|
172
|
+
const resultGroupIndex = intersectingGroupIndices[i];
|
|
173
|
+
const group = resultGroups[resultGroupIndex];
|
|
174
|
+
resultGroups.splice(resultGroupIndex, 1);
|
|
175
|
+
const resultGroupCount = group.length;
|
|
176
|
+
for (let j = 0; j < resultGroupCount; j++) {
|
|
177
|
+
targetGroup.push(group[j]);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
// Add the latest triangle to the target group
|
|
182
|
+
for (let i = triIndex; i < triIndex + 3; i++) {
|
|
183
|
+
targetGroup.push(indexArray[i]);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
const resultGroupsCount = resultGroups.length;
|
|
187
|
+
if (resultGroupsCount > maxFinalGroups) {
|
|
188
|
+
logger.info(`Geo split into too many final groups`, `(actual ${resultGroupsCount}, max allowed ${maxFinalGroups})`);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
return resultGroups;
|
|
192
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export * from "./animation/coordinator/CoordinatorDropAndSpin.js";
|
|
2
|
-
export * from "./animation/coordinator/CoordinatorPulseBounce.js";
|
|
3
|
-
export * from "./animation/coordinator/CoordinatorPulseHighlight.js";
|
|
4
|
-
export * from "./animation/coordinator/CoordinatorPulseInflate.js";
|
|
5
|
-
export * from "./camera/CfgOrbitalCameraControlProps.js";
|
|
6
|
-
export * from "./utilities/utilities3D.js";
|
|
7
|
-
export * from "./view/BaseView.js";
|
|
8
|
-
export * from "./view/BaseViewConfiguration.js";
|
|
9
|
-
export * from "./view/RenderEnv.js";
|
|
10
|
-
export * from "./view/SingleProductDefaultCameraView.js";
|
|
11
|
-
export * from "./view/SingleProductDefaultCameraViewConfiguration.js";
|
|
12
|
-
export * from "./view/SingleProductView.js";
|
|
13
|
-
export * from "./view/SingleProductViewConfiguration.js";
|
|
1
|
+
export * from "./animation/coordinator/CoordinatorDropAndSpin.js";
|
|
2
|
+
export * from "./animation/coordinator/CoordinatorPulseBounce.js";
|
|
3
|
+
export * from "./animation/coordinator/CoordinatorPulseHighlight.js";
|
|
4
|
+
export * from "./animation/coordinator/CoordinatorPulseInflate.js";
|
|
5
|
+
export * from "./camera/CfgOrbitalCameraControlProps.js";
|
|
6
|
+
export * from "./utilities/utilities3D.js";
|
|
7
|
+
export * from "./view/BaseView.js";
|
|
8
|
+
export * from "./view/BaseViewConfiguration.js";
|
|
9
|
+
export * from "./view/RenderEnv.js";
|
|
10
|
+
export * from "./view/SingleProductDefaultCameraView.js";
|
|
11
|
+
export * from "./view/SingleProductDefaultCameraViewConfiguration.js";
|
|
12
|
+
export * from "./view/SingleProductView.js";
|
|
13
|
+
export * from "./view/SingleProductViewConfiguration.js";
|
|
14
14
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export * from "./animation/coordinator/CoordinatorDropAndSpin.js";
|
|
2
|
-
export * from "./animation/coordinator/CoordinatorPulseBounce.js";
|
|
3
|
-
export * from "./animation/coordinator/CoordinatorPulseHighlight.js";
|
|
4
|
-
export * from "./animation/coordinator/CoordinatorPulseInflate.js";
|
|
5
|
-
export * from "./camera/CfgOrbitalCameraControlProps.js";
|
|
6
|
-
export * from "./utilities/utilities3D.js";
|
|
7
|
-
export * from "./view/BaseView.js";
|
|
8
|
-
export * from "./view/BaseViewConfiguration.js";
|
|
9
|
-
export * from "./view/RenderEnv.js";
|
|
10
|
-
export * from "./view/SingleProductDefaultCameraView.js";
|
|
11
|
-
export * from "./view/SingleProductDefaultCameraViewConfiguration.js";
|
|
12
|
-
export * from "./view/SingleProductView.js";
|
|
13
|
-
export * from "./view/SingleProductViewConfiguration.js";
|
|
1
|
+
export * from "./animation/coordinator/CoordinatorDropAndSpin.js";
|
|
2
|
+
export * from "./animation/coordinator/CoordinatorPulseBounce.js";
|
|
3
|
+
export * from "./animation/coordinator/CoordinatorPulseHighlight.js";
|
|
4
|
+
export * from "./animation/coordinator/CoordinatorPulseInflate.js";
|
|
5
|
+
export * from "./camera/CfgOrbitalCameraControlProps.js";
|
|
6
|
+
export * from "./utilities/utilities3D.js";
|
|
7
|
+
export * from "./view/BaseView.js";
|
|
8
|
+
export * from "./view/BaseViewConfiguration.js";
|
|
9
|
+
export * from "./view/RenderEnv.js";
|
|
10
|
+
export * from "./view/SingleProductDefaultCameraView.js";
|
|
11
|
+
export * from "./view/SingleProductDefaultCameraViewConfiguration.js";
|
|
12
|
+
export * from "./view/SingleProductView.js";
|
|
13
|
+
export * from "./view/SingleProductViewConfiguration.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { DirectionalLight } from "@babylonjs/core/Lights/directionalLight.js";
|
|
2
|
-
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
3
|
-
import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
|
|
4
|
-
import { Node } from "@babylonjs/core/node.js";
|
|
5
|
-
import { Scene } from "@babylonjs/core/scene.js";
|
|
6
|
-
export declare class CfgDirectionalLight extends DirectionalLight {
|
|
7
|
-
constructor(name: string, scene: Scene, parent?: Node, direction?: Vector3, color?: Color3 | string | number, intensity?: number);
|
|
8
|
-
}
|
|
1
|
+
import { DirectionalLight } from "@babylonjs/core/Lights/directionalLight.js";
|
|
2
|
+
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
3
|
+
import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
|
|
4
|
+
import { Node } from "@babylonjs/core/node.js";
|
|
5
|
+
import { Scene } from "@babylonjs/core/scene.js";
|
|
6
|
+
export declare class CfgDirectionalLight extends DirectionalLight {
|
|
7
|
+
constructor(name: string, scene: Scene, parent?: Node, direction?: Vector3, color?: Color3 | string | number, intensity?: number);
|
|
8
|
+
}
|
|
9
9
|
//# sourceMappingURL=CfgDirectionalLight.d.ts.map
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { DirectionalLight } from "@babylonjs/core/Lights/directionalLight.js";
|
|
2
|
-
import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
|
|
3
|
-
import { toColor3 } from "../utilities/utilitiesColor.js";
|
|
4
|
-
export class CfgDirectionalLight extends DirectionalLight {
|
|
5
|
-
constructor(name, scene, parent, direction, color, intensity) {
|
|
6
|
-
if (direction === undefined) {
|
|
7
|
-
direction = Vector3.Down();
|
|
8
|
-
}
|
|
9
|
-
super(name, direction, scene);
|
|
10
|
-
if (parent) {
|
|
11
|
-
this.parent = parent;
|
|
12
|
-
}
|
|
13
|
-
this.specular = this.diffuse = toColor3(color);
|
|
14
|
-
if (intensity !== undefined) {
|
|
15
|
-
this.intensity = intensity;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
1
|
+
import { DirectionalLight } from "@babylonjs/core/Lights/directionalLight.js";
|
|
2
|
+
import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
|
|
3
|
+
import { toColor3 } from "../utilities/utilitiesColor.js";
|
|
4
|
+
export class CfgDirectionalLight extends DirectionalLight {
|
|
5
|
+
constructor(name, scene, parent, direction, color, intensity) {
|
|
6
|
+
if (direction === undefined) {
|
|
7
|
+
direction = Vector3.Down();
|
|
8
|
+
}
|
|
9
|
+
super(name, direction, scene);
|
|
10
|
+
if (parent) {
|
|
11
|
+
this.parent = parent;
|
|
12
|
+
}
|
|
13
|
+
this.specular = this.diffuse = toColor3(color);
|
|
14
|
+
if (intensity !== undefined) {
|
|
15
|
+
this.intensity = intensity;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { HemisphericLight } from "@babylonjs/core/Lights/hemisphericLight.js";
|
|
2
|
-
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
3
|
-
import { Node } from "@babylonjs/core/node.js";
|
|
4
|
-
import { Scene } from "@babylonjs/core/scene.js";
|
|
5
|
-
export declare class CfgHemisphericLight extends HemisphericLight {
|
|
6
|
-
constructor(name: string, scene: Scene, parent?: Node, color?: Color3 | string | number, intensity?: number);
|
|
7
|
-
}
|
|
1
|
+
import { HemisphericLight } from "@babylonjs/core/Lights/hemisphericLight.js";
|
|
2
|
+
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
3
|
+
import { Node } from "@babylonjs/core/node.js";
|
|
4
|
+
import { Scene } from "@babylonjs/core/scene.js";
|
|
5
|
+
export declare class CfgHemisphericLight extends HemisphericLight {
|
|
6
|
+
constructor(name: string, scene: Scene, parent?: Node, color?: Color3 | string | number, intensity?: number);
|
|
7
|
+
}
|
|
8
8
|
//# sourceMappingURL=CfgHemisphericLight.d.ts.map
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { HemisphericLight } from "@babylonjs/core/Lights/hemisphericLight.js";
|
|
2
|
-
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
3
|
-
import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
|
|
4
|
-
import { toColor3 } from "../utilities/utilitiesColor.js";
|
|
5
|
-
export class CfgHemisphericLight extends HemisphericLight {
|
|
6
|
-
constructor(name, scene, parent, color, intensity) {
|
|
7
|
-
super(name, new Vector3(0, 0, 1), scene);
|
|
8
|
-
if (parent) {
|
|
9
|
-
this.parent = parent;
|
|
10
|
-
}
|
|
11
|
-
this.groundColor = Color3.Black();
|
|
12
|
-
this.specular = this.diffuse = toColor3(color);
|
|
13
|
-
if (intensity !== undefined) {
|
|
14
|
-
this.intensity = intensity;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
1
|
+
import { HemisphericLight } from "@babylonjs/core/Lights/hemisphericLight.js";
|
|
2
|
+
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
3
|
+
import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
|
|
4
|
+
import { toColor3 } from "../utilities/utilitiesColor.js";
|
|
5
|
+
export class CfgHemisphericLight extends HemisphericLight {
|
|
6
|
+
constructor(name, scene, parent, color, intensity) {
|
|
7
|
+
super(name, new Vector3(0, 0, 1), scene);
|
|
8
|
+
if (parent) {
|
|
9
|
+
this.parent = parent;
|
|
10
|
+
}
|
|
11
|
+
this.groundColor = Color3.Black();
|
|
12
|
+
this.specular = this.diffuse = toColor3(color);
|
|
13
|
+
if (intensity !== undefined) {
|
|
14
|
+
this.intensity = intensity;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { PointLight } from "@babylonjs/core/Lights/pointLight.js";
|
|
2
|
-
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
3
|
-
import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
|
|
4
|
-
import { Node } from "@babylonjs/core/node.js";
|
|
5
|
-
import { Scene } from "@babylonjs/core/scene.js";
|
|
6
|
-
export declare class CfgPointLight extends PointLight {
|
|
7
|
-
constructor(name: string, scene: Scene, parent?: Node, position?: Vector3, color?: Color3 | string | number, intensity?: number);
|
|
8
|
-
}
|
|
1
|
+
import { PointLight } from "@babylonjs/core/Lights/pointLight.js";
|
|
2
|
+
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
3
|
+
import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
|
|
4
|
+
import { Node } from "@babylonjs/core/node.js";
|
|
5
|
+
import { Scene } from "@babylonjs/core/scene.js";
|
|
6
|
+
export declare class CfgPointLight extends PointLight {
|
|
7
|
+
constructor(name: string, scene: Scene, parent?: Node, position?: Vector3, color?: Color3 | string | number, intensity?: number);
|
|
8
|
+
}
|
|
9
9
|
//# sourceMappingURL=CfgPointLight.d.ts.map
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { PointLight } from "@babylonjs/core/Lights/pointLight.js";
|
|
2
|
-
import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
|
|
3
|
-
import { toColor3 } from "../utilities/utilitiesColor.js";
|
|
4
|
-
export class CfgPointLight extends PointLight {
|
|
5
|
-
constructor(name, scene, parent, position, color, intensity) {
|
|
6
|
-
if (position === undefined) {
|
|
7
|
-
position = Vector3.Zero();
|
|
8
|
-
}
|
|
9
|
-
super(name, position, scene);
|
|
10
|
-
if (parent) {
|
|
11
|
-
this.parent = parent;
|
|
12
|
-
}
|
|
13
|
-
this.specular = this.diffuse = toColor3(color);
|
|
14
|
-
if (intensity !== undefined) {
|
|
15
|
-
this.intensity = intensity;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
1
|
+
import { PointLight } from "@babylonjs/core/Lights/pointLight.js";
|
|
2
|
+
import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
|
|
3
|
+
import { toColor3 } from "../utilities/utilitiesColor.js";
|
|
4
|
+
export class CfgPointLight extends PointLight {
|
|
5
|
+
constructor(name, scene, parent, position, color, intensity) {
|
|
6
|
+
if (position === undefined) {
|
|
7
|
+
position = Vector3.Zero();
|
|
8
|
+
}
|
|
9
|
+
super(name, position, scene);
|
|
10
|
+
if (parent) {
|
|
11
|
+
this.parent = parent;
|
|
12
|
+
}
|
|
13
|
+
this.specular = this.diffuse = toColor3(color);
|
|
14
|
+
if (intensity !== undefined) {
|
|
15
|
+
this.intensity = intensity;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { Node } from "@babylonjs/core/node.js";
|
|
2
|
-
import { Scene } from "@babylonjs/core/scene.js";
|
|
3
|
-
import { LightRig, LightRigCreator } from "./LightRigCreator.js";
|
|
4
|
-
export declare const getDefaultLightRigCreator: (relativeToCamera: boolean) => LightRigCreator;
|
|
5
|
-
export declare class DefaultLightRig extends LightRig {
|
|
6
|
-
private _allLights;
|
|
7
|
-
private _allPointLights;
|
|
8
|
-
private _defaultIntensities;
|
|
9
|
-
private _dimLevel;
|
|
10
|
-
get dimLevel(): number;
|
|
11
|
-
set dimLevel(v: number);
|
|
12
|
-
private _scale;
|
|
13
|
-
get scale(): number;
|
|
14
|
-
set scale(v: number);
|
|
15
|
-
private applyDimLevel;
|
|
16
|
-
private applyScale;
|
|
17
|
-
constructor(scene: Scene, target: Node | undefined);
|
|
18
|
-
get lightCount(): number;
|
|
19
|
-
}
|
|
1
|
+
import { Node } from "@babylonjs/core/node.js";
|
|
2
|
+
import { Scene } from "@babylonjs/core/scene.js";
|
|
3
|
+
import { LightRig, LightRigCreator } from "./LightRigCreator.js";
|
|
4
|
+
export declare const getDefaultLightRigCreator: (relativeToCamera: boolean) => LightRigCreator;
|
|
5
|
+
export declare class DefaultLightRig extends LightRig {
|
|
6
|
+
private _allLights;
|
|
7
|
+
private _allPointLights;
|
|
8
|
+
private _defaultIntensities;
|
|
9
|
+
private _dimLevel;
|
|
10
|
+
get dimLevel(): number;
|
|
11
|
+
set dimLevel(v: number);
|
|
12
|
+
private _scale;
|
|
13
|
+
get scale(): number;
|
|
14
|
+
set scale(v: number);
|
|
15
|
+
private applyDimLevel;
|
|
16
|
+
private applyScale;
|
|
17
|
+
constructor(scene: Scene, target: Node | undefined);
|
|
18
|
+
get lightCount(): number;
|
|
19
|
+
}
|
|
20
20
|
//# sourceMappingURL=DefaultLightRig.d.ts.map
|