3dtiles-inspector 0.2.13 → 0.2.15
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/CHANGELOG.md +25 -0
- package/README.md +11 -4
- package/dist/inspector-assets/viewer/app.js +4673 -787
- package/package.json +3 -3
- package/src/server/splatCrop/gaussianPrimitives.js +37 -7
- package/src/server/splatCrop/index.js +10 -2
- package/src/server/splatCrop/normalize.js +43 -6
- package/src/server/splatCrop/traversal.js +162 -0
- package/src/server/splatCrop/worker.js +43 -8
- package/src/server/splatCrop/workerPool.js +2 -0
- package/src/server/viewerHtml.js +54 -10
- package/src/viewer/app.js +16 -1
- package/src/viewer/dom/cropUi.js +50 -0
- package/src/viewer/dom/elements.js +8 -0
- package/src/viewer/dom/events.js +63 -0
- package/src/viewer/scene/cameraController.js +18 -3
- package/src/viewer/screenSelection/cropController.js +578 -6
- package/src/viewer/screenSelection/index.js +15 -2
- package/src/viewer/screenSelection/sdf.js +51 -6
- package/src/viewer/screenSelection/state.js +1 -0
- package/src/viewer/transform/geoCamera.js +1 -1
- package/src/viewer/transform/transformModeController.js +19 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SCREEN_SELECTION_ACTION_EXCLUDE,
|
|
3
|
+
SCREEN_SELECTION_ACTION_INCLUDE,
|
|
3
4
|
SCREEN_SELECTION_MIN_DEPTH_RANGE,
|
|
4
5
|
cameraPosition,
|
|
5
6
|
copyDepthRange,
|
|
@@ -27,6 +28,7 @@ import {
|
|
|
27
28
|
} from './farHandle.js';
|
|
28
29
|
|
|
29
30
|
export { SCREEN_SELECTION_ACTION_EXCLUDE } from './state.js';
|
|
31
|
+
export { SCREEN_SELECTION_ACTION_INCLUDE } from './state.js';
|
|
30
32
|
export {
|
|
31
33
|
createScreenSelectionEdit,
|
|
32
34
|
setScreenSelectionEditSelection,
|
|
@@ -38,6 +40,7 @@ export {
|
|
|
38
40
|
export { createScreenSelectionPointerTracker } from './pointerTracker.js';
|
|
39
41
|
|
|
40
42
|
export function createScreenSelection({
|
|
43
|
+
action = SCREEN_SELECTION_ACTION_EXCLUDE,
|
|
41
44
|
cameraPosition: sourceCameraPosition,
|
|
42
45
|
depthRange,
|
|
43
46
|
farPlane,
|
|
@@ -51,7 +54,7 @@ export function createScreenSelection({
|
|
|
51
54
|
const copiedPlaneMatrices = planeMatrices.map((matrix) => matrix.slice());
|
|
52
55
|
const referenceTransformMatrix = copyMatrix4Array(transformMatrix);
|
|
53
56
|
return {
|
|
54
|
-
action
|
|
57
|
+
action,
|
|
55
58
|
basePlaneMatrices: copiedPlaneMatrices.map((matrix) => matrix.slice()),
|
|
56
59
|
cameraPosition: copyVectorArray(sourceCameraPosition),
|
|
57
60
|
currentTransformMatrix: referenceTransformMatrix.slice(),
|
|
@@ -80,8 +83,18 @@ export function disposeScreenSelection(selection) {
|
|
|
80
83
|
}
|
|
81
84
|
|
|
82
85
|
export function getScreenSelectionPayload(selection) {
|
|
86
|
+
if (selection?.type === 'sphere') {
|
|
87
|
+
return {
|
|
88
|
+
action: SCREEN_SELECTION_ACTION_INCLUDE,
|
|
89
|
+
sphere: {
|
|
90
|
+
center: selection.worldCenter.slice(),
|
|
91
|
+
radius: selection.worldRadius,
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
83
96
|
return {
|
|
84
|
-
action: SCREEN_SELECTION_ACTION_EXCLUDE,
|
|
97
|
+
action: selection.action || SCREEN_SELECTION_ACTION_EXCLUDE,
|
|
85
98
|
planeMatrices: selection.planeMatrices.map((matrix) => matrix.slice()),
|
|
86
99
|
rect: copyRect(selection.rect),
|
|
87
100
|
viewProjectionMatrix: selection.viewProjectionMatrix.slice(),
|
|
@@ -36,6 +36,46 @@ export function createScreenSelectionSdfs(planeMatrices) {
|
|
|
36
36
|
return planeMatrices.map((matrix) => createScreenSelectionSdf(matrix));
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
export function createSphereSelectionSdf(selection) {
|
|
40
|
+
const sdf = new SplatEditSdf({
|
|
41
|
+
type: SplatEditSdfType.SPHERE,
|
|
42
|
+
invert: false,
|
|
43
|
+
color: SCREEN_SELECTION_EXCLUDE_COLOR.clone(),
|
|
44
|
+
opacity: 1,
|
|
45
|
+
radius: Number(selection?.worldRadius) || 0,
|
|
46
|
+
});
|
|
47
|
+
if (Array.isArray(selection?.worldCenter)) {
|
|
48
|
+
sdf.position.fromArray(selection.worldCenter);
|
|
49
|
+
}
|
|
50
|
+
sdf.updateMatrix();
|
|
51
|
+
sdf.updateMatrixWorld(true);
|
|
52
|
+
return sdf;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function applySphereSelectionSdf(selection) {
|
|
56
|
+
if (!selection) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (!Array.isArray(selection.sdfs) || selection.sdfs.length !== 1) {
|
|
60
|
+
selection.sdfs?.forEach((sdf) => {
|
|
61
|
+
sdf.removeFromParent();
|
|
62
|
+
});
|
|
63
|
+
selection.sdfs = [createSphereSelectionSdf(selection)];
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const sdf = selection.sdfs[0];
|
|
68
|
+
sdf.type = SplatEditSdfType.SPHERE;
|
|
69
|
+
sdf.invert = false;
|
|
70
|
+
sdf.radius = Number(selection.worldRadius) || 0;
|
|
71
|
+
if (Array.isArray(selection.worldCenter)) {
|
|
72
|
+
sdf.position.fromArray(selection.worldCenter);
|
|
73
|
+
}
|
|
74
|
+
sdf.scale.setScalar(1);
|
|
75
|
+
sdf.updateMatrix();
|
|
76
|
+
sdf.updateMatrixWorld(true);
|
|
77
|
+
}
|
|
78
|
+
|
|
39
79
|
export function applyScreenSelectionSdfMatrices(selection) {
|
|
40
80
|
if (
|
|
41
81
|
!selection.sdfs ||
|
|
@@ -54,10 +94,11 @@ export function applyScreenSelectionSdfMatrices(selection) {
|
|
|
54
94
|
}
|
|
55
95
|
|
|
56
96
|
export function setScreenSelectionEditSelection(edit, selection, style) {
|
|
57
|
-
const hidden = style === true || style === 'exclude';
|
|
97
|
+
const hidden = style === true || style === 'exclude' || style === 'include';
|
|
98
|
+
const sphere = selection?.type === 'sphere';
|
|
58
99
|
edit.sdfs = null;
|
|
59
100
|
edit.clear();
|
|
60
|
-
edit.invert = !!selection;
|
|
101
|
+
edit.invert = sphere ? hidden : !!selection;
|
|
61
102
|
edit.rgbaBlendMode = hidden
|
|
62
103
|
? SplatEditRgbaBlendMode.MULTIPLY
|
|
63
104
|
: SplatEditRgbaBlendMode.SET_RGB;
|
|
@@ -66,10 +107,14 @@ export function setScreenSelectionEditSelection(edit, selection, style) {
|
|
|
66
107
|
}
|
|
67
108
|
|
|
68
109
|
edit.name = hidden
|
|
69
|
-
?
|
|
70
|
-
|
|
110
|
+
? sphere
|
|
111
|
+
? `Crop Sphere ${selection.id} Include`
|
|
112
|
+
: `Screen Selection ${selection.id} Exclude`
|
|
113
|
+
: sphere
|
|
114
|
+
? `Crop Sphere ${selection.id} Preview`
|
|
115
|
+
: `Screen Selection ${selection.id} Preview`;
|
|
71
116
|
selection.sdfs.forEach((sdf) => {
|
|
72
|
-
sdf.invert = true;
|
|
117
|
+
sdf.invert = sphere ? false : true;
|
|
73
118
|
if (hidden) {
|
|
74
119
|
sdf.color.copy(SCREEN_SELECTION_HIDDEN_COLOR);
|
|
75
120
|
sdf.opacity = SCREEN_SELECTION_HIDDEN_ALPHA;
|
|
@@ -82,7 +127,7 @@ export function setScreenSelectionEditSelection(edit, selection, style) {
|
|
|
82
127
|
}
|
|
83
128
|
|
|
84
129
|
export function createScreenSelectionEdit({ style, hidden, name }) {
|
|
85
|
-
const isHidden = style === 'exclude' || hidden === true;
|
|
130
|
+
const isHidden = style === 'exclude' || style === 'include' || hidden === true;
|
|
86
131
|
return new SplatEdit({
|
|
87
132
|
name,
|
|
88
133
|
rgbaBlendMode: isHidden
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Color, Matrix4, Plane, Vector2, Vector3 } from 'three';
|
|
2
2
|
|
|
3
3
|
export const SCREEN_SELECTION_ACTION_EXCLUDE = 'exclude';
|
|
4
|
+
export const SCREEN_SELECTION_ACTION_INCLUDE = 'include';
|
|
4
5
|
|
|
5
6
|
export const SCREEN_SELECTION_EXCLUDE_COLOR = new Color(1, 0.82, 0);
|
|
6
7
|
export const SCREEN_SELECTION_HIDDEN_COLOR = new Color(1, 1, 1);
|
|
@@ -83,7 +83,7 @@ export function createGeoCameraController({
|
|
|
83
83
|
|
|
84
84
|
function getLocalFrameQuaternion(referencePoint, target) {
|
|
85
85
|
if (
|
|
86
|
-
referencePoint.lengthSq()
|
|
86
|
+
referencePoint.lengthSq() <= centerModeDistanceSq ||
|
|
87
87
|
!getActiveEllipsoid()
|
|
88
88
|
) {
|
|
89
89
|
return target.identity();
|
|
@@ -24,10 +24,19 @@ export function createTransformModeController({
|
|
|
24
24
|
const pendingPositionPick =
|
|
25
25
|
setPositionController.isPending() || cropController.getPendingMode();
|
|
26
26
|
const activeCropScreenSelection = cropController.getActiveSelection();
|
|
27
|
+
const activeKeepSphere =
|
|
28
|
+
activeCropScreenSelection?.type === 'sphere'
|
|
29
|
+
? activeCropScreenSelection
|
|
30
|
+
: null;
|
|
27
31
|
const farControlsVisible =
|
|
28
32
|
!!activeCropScreenSelection?.farHandle && !pendingPositionPick;
|
|
33
|
+
const sphereControlsVisible =
|
|
34
|
+
!!activeKeepSphere?.wireframe && !pendingPositionPick;
|
|
29
35
|
const rootControlsVisible =
|
|
30
|
-
activeMode !== null &&
|
|
36
|
+
activeMode !== null &&
|
|
37
|
+
!farControlsVisible &&
|
|
38
|
+
!sphereControlsVisible &&
|
|
39
|
+
!pendingPositionPick;
|
|
31
40
|
|
|
32
41
|
if (farControlsVisible) {
|
|
33
42
|
if (transformControls.object !== activeCropScreenSelection.farHandle) {
|
|
@@ -36,6 +45,13 @@ export function createTransformModeController({
|
|
|
36
45
|
transformControls.setMode('translate');
|
|
37
46
|
transformControls.setSpace('local');
|
|
38
47
|
setAxes(false, false, true);
|
|
48
|
+
} else if (sphereControlsVisible) {
|
|
49
|
+
if (transformControls.object !== activeKeepSphere.wireframe) {
|
|
50
|
+
transformControls.attach(activeKeepSphere.wireframe);
|
|
51
|
+
}
|
|
52
|
+
transformControls.setMode('translate');
|
|
53
|
+
transformControls.setSpace('local');
|
|
54
|
+
setAxes(true, true, true);
|
|
39
55
|
} else if (rootControlsVisible) {
|
|
40
56
|
if (transformControls.object !== transformHandle) {
|
|
41
57
|
transformControls.attach(transformHandle);
|
|
@@ -47,7 +63,8 @@ export function createTransformModeController({
|
|
|
47
63
|
transformControls.detach();
|
|
48
64
|
}
|
|
49
65
|
|
|
50
|
-
const controlsVisible =
|
|
66
|
+
const controlsVisible =
|
|
67
|
+
farControlsVisible || sphereControlsVisible || rootControlsVisible;
|
|
51
68
|
transformControls.enabled = controlsVisible;
|
|
52
69
|
if (transformControlsHelper) {
|
|
53
70
|
transformControlsHelper.visible = controlsVisible;
|