copper3d 3.8.1 → 3.9.1
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/dist/Controls/Copper3dTrackballControls.d.ts +51 -1
- package/dist/Controls/Copper3dTrackballControls.js +37 -0
- package/dist/Controls/Copper3dTrackballControls.js.map +1 -1
- package/dist/Controls/controlsAxes.d.ts +31 -0
- package/dist/Controls/controlsAxes.js +63 -0
- package/dist/Controls/controlsAxes.js.map +1 -0
- package/dist/Controls/gestureGate.d.ts +48 -0
- package/dist/Controls/gestureGate.js +67 -0
- package/dist/Controls/gestureGate.js.map +1 -0
- package/dist/Controls/setCameraPose.d.ts +50 -0
- package/dist/Controls/setCameraPose.js +20 -0
- package/dist/Controls/setCameraPose.js.map +1 -0
- package/dist/Loader/copperGltfLoader.d.ts +35 -0
- package/dist/Loader/copperGltfLoader.js +43 -2
- package/dist/Loader/copperGltfLoader.js.map +1 -1
- package/dist/Loader/copperNrrdLoader.d.ts +47 -0
- package/dist/Loader/copperNrrdLoader.js +88 -42
- package/dist/Loader/copperNrrdLoader.js.map +1 -1
- package/dist/Loader/volumeBoundingBox.d.ts +44 -0
- package/dist/Loader/volumeBoundingBox.js +32 -0
- package/dist/Loader/volumeBoundingBox.js.map +1 -0
- package/dist/Renderer/copperRendererOnDemond.d.ts +12 -2
- package/dist/Renderer/copperRendererOnDemond.js +12 -2
- package/dist/Renderer/copperRendererOnDemond.js.map +1 -1
- package/dist/Renderer/disposeScene.d.ts +4 -0
- package/dist/Renderer/disposeScene.js +6 -1
- package/dist/Renderer/disposeScene.js.map +1 -1
- package/dist/Scene/copperMScene.d.ts +2 -1
- package/dist/Scene/copperMScene.js +4 -4
- package/dist/Scene/copperMScene.js.map +1 -1
- package/dist/Scene/copperScene.d.ts +2 -1
- package/dist/Scene/copperScene.js +6 -4
- package/dist/Scene/copperScene.js.map +1 -1
- package/dist/Scene/copperSceneOnDemond.d.ts +54 -3
- package/dist/Scene/copperSceneOnDemond.js +85 -7
- package/dist/Scene/copperSceneOnDemond.js.map +1 -1
- package/dist/Utils/kiwrious/configKiwrious.d.ts +23 -1
- package/dist/Utils/kiwrious/configKiwrious.js +154 -42
- package/dist/Utils/kiwrious/configKiwrious.js.map +1 -1
- package/dist/bundle.esm.js +830 -10579
- package/dist/bundle.umd.js +846 -10579
- package/dist/index.d.ts +15 -3
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/types/Controls/Copper3dTrackballControls.d.ts +51 -1
- package/dist/types/Controls/controlsAxes.d.ts +31 -0
- package/dist/types/Controls/gestureGate.d.ts +48 -0
- package/dist/types/Controls/setCameraPose.d.ts +50 -0
- package/dist/types/Loader/copperGltfLoader.d.ts +35 -0
- package/dist/types/Loader/copperNrrdLoader.d.ts +47 -0
- package/dist/types/Loader/volumeBoundingBox.d.ts +44 -0
- package/dist/types/Renderer/copperRendererOnDemond.d.ts +12 -2
- package/dist/types/Renderer/disposeScene.d.ts +4 -0
- package/dist/types/Scene/copperMScene.d.ts +2 -1
- package/dist/types/Scene/copperScene.d.ts +2 -1
- package/dist/types/Scene/copperSceneOnDemond.d.ts +54 -3
- package/dist/types/Utils/kiwrious/configKiwrious.d.ts +23 -1
- package/dist/types/index.d.ts +15 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4,13 +4,15 @@ import { copperScene } from "./Scene/copperScene";
|
|
|
4
4
|
import { CameraViewPoint } from "./Controls/copperControls";
|
|
5
5
|
import { addLabelToScene, positionType, screenPosType, convert3DPostoScreenPos, convertScreenPosto3DPos } from "./Utils/add3DLabel";
|
|
6
6
|
import { addBoxHelper, optsType } from "./Loader/copperNrrdLoader";
|
|
7
|
+
import { copperGltfLoader, setDracoDecoderPath, setKTX2TranscoderPath } from "./Loader/copperGltfLoader";
|
|
8
|
+
import type { GltfLoadOpts } from "./Loader/copperGltfLoader";
|
|
7
9
|
import { fullScreenListenner, loading, throttle } from "./Utils/utils";
|
|
8
10
|
import { copperRendererOnDemond } from "./Renderer/copperRendererOnDemond";
|
|
9
11
|
import { copperSceneOnDemond } from "./Scene/copperSceneOnDemond";
|
|
10
12
|
import { copperMSceneRenderer } from "./Renderer/copperMSceneRenderer";
|
|
11
13
|
import { copperMScene } from "./Scene/copperMScene";
|
|
12
14
|
import { createTexture2D_NRRD } from "./Utils/texture2d";
|
|
13
|
-
import { configKiwriousHeart } from "./Utils/kiwrious/configKiwrious";
|
|
15
|
+
import { configKiwriousHeart, loadKiwrious } from "./Utils/kiwrious/configKiwrious";
|
|
14
16
|
import kiwrious from "./Utils/kiwrious/configKiwrious";
|
|
15
17
|
import { NrrdTools } from "./Utils/segmentation/NrrdTools";
|
|
16
18
|
import { GaussianSmoother } from "./Utils/segmentation/core/GaussianSmoother";
|
|
@@ -32,6 +34,16 @@ import { fitDistance } from "./Controls/orbitFraming";
|
|
|
32
34
|
import type { FitBounds } from "./Controls/orbitFraming";
|
|
33
35
|
import { fitView } from "./Controls/fitView";
|
|
34
36
|
import type { FitViewScene } from "./Controls/fitView";
|
|
37
|
+
import { isRotateEnabled, setRotateEnabled, isPanEnabled, setPanEnabled, isZoomEnabled, setZoomEnabled } from "./Controls/controlsAxes";
|
|
38
|
+
import type { AxisGatedControls } from "./Controls/controlsAxes";
|
|
39
|
+
import { beginGesture, isGestureActive } from "./Controls/gestureGate";
|
|
40
|
+
import type { GestureAxes } from "./Controls/gestureGate";
|
|
41
|
+
import { setCameraPose } from "./Controls/setCameraPose";
|
|
42
|
+
import type { PosableScene } from "./Controls/setCameraPose";
|
|
43
|
+
import { addVolumeBoundingBox, VOLUME_BOUNDS_NAME } from "./Loader/volumeBoundingBox";
|
|
44
|
+
import type { BoundingBoxHost, VolumeBoundingBoxOpts } from "./Loader/volumeBoundingBox";
|
|
45
|
+
import { DEFAULT_AXES } from "./Loader/copperNrrdLoader";
|
|
46
|
+
import type { NrrdAxis } from "./Loader/copperNrrdLoader";
|
|
35
47
|
import { easeInOutCubic, viewPointToPose, rotateAroundAxis, interpolateFlightPose, poseDistance, orbitStepPose, zoomPose, orbitSwingAngle } from "./Controls/cameraTransitions";
|
|
36
48
|
import type { Pose } from "./Controls/cameraTransitions";
|
|
37
49
|
import { installFastSliceRepaint } from "./Loader/fastSliceRepaint";
|
|
@@ -47,6 +59,6 @@ import type { LayerId, ChannelValue } from "./Utils/segmentation/core/index";
|
|
|
47
59
|
import type { AiPromptTool, AiPromptPoint, AiPromptPayload, AiMaskResult } from "./Utils/segmentation/tools/AiAssistTool";
|
|
48
60
|
import "./css/style.css";
|
|
49
61
|
export declare const REVISION: string;
|
|
50
|
-
export { copperRenderer, copperRendererOnDemond, copperMSceneRenderer, setHDRFilePath, addLabelToScene, convert3DPostoScreenPos, convertScreenPosto3DPos, addBoxHelper, fullScreenListenner, configKiwriousHeart, copperScene, copperSceneOnDemond, copperMScene, CameraViewPoint, kiwrious, NrrdTools, loading, Copper3dTrackballControls, Copper3dOrbitControls, createTexture2D_NRRD, MeshNodeTool, throttle, removeGuiFolderChilden, CHANNEL_COLORS, CHANNEL_HEX_COLORS, AI_MASK_CHANNEL_COLORS, AI_CHANNEL_HEX_COLORS, rgbaToHex, rgbaToCss, GaussianSmoother, SurfaceAnnotator, exposureExponent, DEFAULT_TARGET_GREY, disposeObject3D, disposeMaterial, collectFadeTargets, setFade, restoreFade, createSceneBudget, defaultBudgetBytes, disposeScene, removeSceneFromMap, fitDistance, fitView, easeInOutCubic, viewPointToPose, rotateAroundAxis, interpolateFlightPose, poseDistance, orbitStepPose, zoomPose, orbitSwingAngle, installFastSliceRepaint, };
|
|
51
|
-
export type { positionType, screenPosType, optsType, nrrdMeshesType, nrrdSliceType, SensorDecodedValue_kiwrious, SensorReadResult_kiwrious, HeartRateResult_kiwrious, loadingBarType, IPaintImage, exportPaintImageType, IOptVTKLoader, aligned4DSurfaceType, aligned4DOptsType, Aligned4DController, raw4DVolumeTransformType, raw4DVolumeOptsType, Raw4DVolumeController, ICommXYZ, IGUIStates, IGuiParameterSettings, INrrdStates, NrrdState, GuiState, IGuiMeta, ToolMode, IAnnotationCallbacks, LayerId, ChannelValue, AiPromptTool, AiPromptPoint, AiPromptPayload, AiMaskResult, SurfaceAnnotatorOptions, Annotation, AnnotationMode, ExportOptions, ExposureVolume, DisposableObject3D, DisposableMaterial, FadeTarget, FadeableMaterial, SceneBudget, DisposableScene, SceneDisposalHost, FitBounds, FitViewScene, Pose, };
|
|
62
|
+
export { copperRenderer, copperRendererOnDemond, copperMSceneRenderer, setHDRFilePath, addLabelToScene, convert3DPostoScreenPos, convertScreenPosto3DPos, addBoxHelper, fullScreenListenner, configKiwriousHeart, copperScene, copperSceneOnDemond, copperMScene, CameraViewPoint, kiwrious, loadKiwrious, NrrdTools, loading, Copper3dTrackballControls, Copper3dOrbitControls, createTexture2D_NRRD, MeshNodeTool, throttle, removeGuiFolderChilden, CHANNEL_COLORS, CHANNEL_HEX_COLORS, AI_MASK_CHANNEL_COLORS, AI_CHANNEL_HEX_COLORS, rgbaToHex, rgbaToCss, GaussianSmoother, SurfaceAnnotator, exposureExponent, DEFAULT_TARGET_GREY, disposeObject3D, disposeMaterial, collectFadeTargets, setFade, restoreFade, createSceneBudget, defaultBudgetBytes, disposeScene, removeSceneFromMap, fitDistance, fitView, isRotateEnabled, setRotateEnabled, isPanEnabled, setPanEnabled, isZoomEnabled, setZoomEnabled, beginGesture, isGestureActive, setCameraPose, addVolumeBoundingBox, VOLUME_BOUNDS_NAME, DEFAULT_AXES, copperGltfLoader, setDracoDecoderPath, setKTX2TranscoderPath, easeInOutCubic, viewPointToPose, rotateAroundAxis, interpolateFlightPose, poseDistance, orbitStepPose, zoomPose, orbitSwingAngle, installFastSliceRepaint, };
|
|
63
|
+
export type { positionType, screenPosType, optsType, GltfLoadOpts, nrrdMeshesType, nrrdSliceType, SensorDecodedValue_kiwrious, SensorReadResult_kiwrious, HeartRateResult_kiwrious, loadingBarType, IPaintImage, exportPaintImageType, IOptVTKLoader, aligned4DSurfaceType, aligned4DOptsType, Aligned4DController, raw4DVolumeTransformType, raw4DVolumeOptsType, Raw4DVolumeController, ICommXYZ, IGUIStates, IGuiParameterSettings, INrrdStates, NrrdState, GuiState, IGuiMeta, ToolMode, IAnnotationCallbacks, LayerId, ChannelValue, AiPromptTool, AiPromptPoint, AiPromptPayload, AiMaskResult, SurfaceAnnotatorOptions, Annotation, AnnotationMode, ExportOptions, ExposureVolume, DisposableObject3D, DisposableMaterial, FadeTarget, FadeableMaterial, SceneBudget, DisposableScene, SceneDisposalHost, FitBounds, FitViewScene, AxisGatedControls, GestureAxes, PosableScene, BoundingBoxHost, VolumeBoundingBoxOpts, NrrdAxis, Pose, };
|
|
52
64
|
export type { CameraViewPreset } from "./Controls/orbitFraming";
|
package/dist/index.js
CHANGED
|
@@ -5,13 +5,14 @@ import { copperScene } from "./Scene/copperScene";
|
|
|
5
5
|
import { CameraViewPoint } from "./Controls/copperControls";
|
|
6
6
|
import { addLabelToScene, convert3DPostoScreenPos, convertScreenPosto3DPos, } from "./Utils/add3DLabel";
|
|
7
7
|
import { addBoxHelper } from "./Loader/copperNrrdLoader";
|
|
8
|
+
import { copperGltfLoader, setDracoDecoderPath, setKTX2TranscoderPath, } from "./Loader/copperGltfLoader";
|
|
8
9
|
import { fullScreenListenner, loading, throttle } from "./Utils/utils";
|
|
9
10
|
import { copperRendererOnDemond } from "./Renderer/copperRendererOnDemond";
|
|
10
11
|
import { copperSceneOnDemond } from "./Scene/copperSceneOnDemond";
|
|
11
12
|
import { copperMSceneRenderer } from "./Renderer/copperMSceneRenderer";
|
|
12
13
|
import { copperMScene } from "./Scene/copperMScene";
|
|
13
14
|
import { createTexture2D_NRRD } from "./Utils/texture2d";
|
|
14
|
-
import { configKiwriousHeart } from "./Utils/kiwrious/configKiwrious";
|
|
15
|
+
import { configKiwriousHeart, loadKiwrious, } from "./Utils/kiwrious/configKiwrious";
|
|
15
16
|
import kiwrious from "./Utils/kiwrious/configKiwrious";
|
|
16
17
|
import { NrrdTools } from "./Utils/segmentation/NrrdTools";
|
|
17
18
|
import { GaussianSmoother } from "./Utils/segmentation/core/GaussianSmoother";
|
|
@@ -27,6 +28,11 @@ import { createSceneBudget, defaultBudgetBytes } from "./Renderer/sceneBudget";
|
|
|
27
28
|
import { disposeScene, removeSceneFromMap } from "./Renderer/disposeScene";
|
|
28
29
|
import { fitDistance } from "./Controls/orbitFraming";
|
|
29
30
|
import { fitView } from "./Controls/fitView";
|
|
31
|
+
import { isRotateEnabled, setRotateEnabled, isPanEnabled, setPanEnabled, isZoomEnabled, setZoomEnabled, } from "./Controls/controlsAxes";
|
|
32
|
+
import { beginGesture, isGestureActive } from "./Controls/gestureGate";
|
|
33
|
+
import { setCameraPose } from "./Controls/setCameraPose";
|
|
34
|
+
import { addVolumeBoundingBox, VOLUME_BOUNDS_NAME, } from "./Loader/volumeBoundingBox";
|
|
35
|
+
import { DEFAULT_AXES } from "./Loader/copperNrrdLoader";
|
|
30
36
|
import { easeInOutCubic, viewPointToPose, rotateAroundAxis, interpolateFlightPose, poseDistance, orbitStepPose, zoomPose, orbitSwingAngle, } from "./Controls/cameraTransitions";
|
|
31
37
|
import { installFastSliceRepaint } from "./Loader/fastSliceRepaint";
|
|
32
38
|
import { SurfaceAnnotator } from "./Utils/surfaceAnnotation";
|
|
@@ -50,5 +56,5 @@ if (typeof window !== "undefined") {
|
|
|
50
56
|
if (typeof console !== "undefined") {
|
|
51
57
|
console.log(`%cCopper3D Visualisation %c${REVISION}`, "padding: 3px;color:white; background:#023047", "padding: 3px;color:white; background:#f50a25");
|
|
52
58
|
}
|
|
53
|
-
export { copperRenderer, copperRendererOnDemond, copperMSceneRenderer, setHDRFilePath, addLabelToScene, convert3DPostoScreenPos, convertScreenPosto3DPos, addBoxHelper, fullScreenListenner, configKiwriousHeart, copperScene, copperSceneOnDemond, copperMScene, CameraViewPoint, kiwrious, NrrdTools, loading, Copper3dTrackballControls, Copper3dOrbitControls, createTexture2D_NRRD, MeshNodeTool, throttle, removeGuiFolderChilden, CHANNEL_COLORS, CHANNEL_HEX_COLORS, AI_MASK_CHANNEL_COLORS, AI_CHANNEL_HEX_COLORS, rgbaToHex, rgbaToCss, GaussianSmoother, SurfaceAnnotator, exposureExponent, DEFAULT_TARGET_GREY, disposeObject3D, disposeMaterial, collectFadeTargets, setFade, restoreFade, createSceneBudget, defaultBudgetBytes, disposeScene, removeSceneFromMap, fitDistance, fitView, easeInOutCubic, viewPointToPose, rotateAroundAxis, interpolateFlightPose, poseDistance, orbitStepPose, zoomPose, orbitSwingAngle, installFastSliceRepaint, };
|
|
59
|
+
export { copperRenderer, copperRendererOnDemond, copperMSceneRenderer, setHDRFilePath, addLabelToScene, convert3DPostoScreenPos, convertScreenPosto3DPos, addBoxHelper, fullScreenListenner, configKiwriousHeart, copperScene, copperSceneOnDemond, copperMScene, CameraViewPoint, kiwrious, loadKiwrious, NrrdTools, loading, Copper3dTrackballControls, Copper3dOrbitControls, createTexture2D_NRRD, MeshNodeTool, throttle, removeGuiFolderChilden, CHANNEL_COLORS, CHANNEL_HEX_COLORS, AI_MASK_CHANNEL_COLORS, AI_CHANNEL_HEX_COLORS, rgbaToHex, rgbaToCss, GaussianSmoother, SurfaceAnnotator, exposureExponent, DEFAULT_TARGET_GREY, disposeObject3D, disposeMaterial, collectFadeTargets, setFade, restoreFade, createSceneBudget, defaultBudgetBytes, disposeScene, removeSceneFromMap, fitDistance, fitView, isRotateEnabled, setRotateEnabled, isPanEnabled, setPanEnabled, isZoomEnabled, setZoomEnabled, beginGesture, isGestureActive, setCameraPose, addVolumeBoundingBox, VOLUME_BOUNDS_NAME, DEFAULT_AXES, copperGltfLoader, setDracoDecoderPath, setKTX2TranscoderPath, easeInOutCubic, viewPointToPose, rotateAroundAxis, interpolateFlightPose, poseDistance, orbitStepPose, zoomPose, orbitSwingAngle, installFastSliceRepaint, };
|
|
54
60
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"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CAAC;AAED,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,uBAAuB,EACvB,uBAAuB,EACvB,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,WAAW,EACX,mBAAmB,EACnB,YAAY,EACZ,eAAe,EACf,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,OAAO,EACP,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,EACpB,YAAY,EACZ,QAAQ,EACR,sBAAsB,EACtB,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,OAAO,EACP,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,OAAO,EACP,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,aAAa,EACb,cAAc,EACd,YAAY,EACZ,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,eAAe,EACf,uBAAuB,GACxB,CAAC"}
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import { EventDispatcher, MOUSE, Vector3, PerspectiveCamera, OrthographicCamera } from "three";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* The events this class dispatches. Without it `EventDispatcher` defaults to an
|
|
4
|
+
* empty map, so `keyof` it is `never` and `addEventListener("change", ...)` is a
|
|
5
|
+
* type error for every caller -- which is why the dispatches below still need
|
|
6
|
+
* their `as never` casts.
|
|
7
|
+
*/
|
|
8
|
+
export interface Copper3dTrackballControlsEventMap {
|
|
9
|
+
change: {};
|
|
10
|
+
start: {};
|
|
11
|
+
end: {};
|
|
12
|
+
}
|
|
13
|
+
declare class Copper3dTrackballControls extends EventDispatcher<Copper3dTrackballControlsEventMap> {
|
|
3
14
|
object: PerspectiveCamera | OrthographicCamera;
|
|
4
15
|
domElement: HTMLElement;
|
|
5
16
|
enabled: boolean;
|
|
@@ -17,6 +28,45 @@ declare class Copper3dTrackballControls extends EventDispatcher {
|
|
|
17
28
|
noPan: boolean;
|
|
18
29
|
staticMoving: boolean;
|
|
19
30
|
dynamicDampingFactor: number;
|
|
31
|
+
/**
|
|
32
|
+
* Drive the camera from the input handlers as well as from `update()`.
|
|
33
|
+
*
|
|
34
|
+
* Off by default, which is the historical behaviour: input handlers only
|
|
35
|
+
* record positions, and nothing moves until something calls `update()`.
|
|
36
|
+
* That is fine under a continuous `requestAnimationFrame` loop and a
|
|
37
|
+
* deadlock without one -- see the note on `update()`.
|
|
38
|
+
*
|
|
39
|
+
* Turn it on for on-demand rendering. Leave it off with
|
|
40
|
+
* `staticMoving = false`: each extra `update()` advances the damping decay
|
|
41
|
+
* by one step, so input-driven updates make the glide shorter.
|
|
42
|
+
*/
|
|
43
|
+
updateOnInput: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* A world-space point that rotation orbits INSTEAD of `target`.
|
|
46
|
+
*
|
|
47
|
+
* `panCamera` translates `target` along with the camera, so once the reader
|
|
48
|
+
* has panned, `target` is wherever they dragged it to and a rotate swings the
|
|
49
|
+
* content through an arc around that empty point rather than turning it on
|
|
50
|
+
* the spot. Snapping `target` back to the content's centre fixes the axis but
|
|
51
|
+
* throws the pan away, because the camera re-aims at the new target.
|
|
52
|
+
*
|
|
53
|
+
* With a pivot set, the same rotation is applied to BOTH `_eye` and
|
|
54
|
+
* `target - rotationPivot`, which is what keeps the pan. Writing
|
|
55
|
+
* `q` for the frame's rotation and `C` for the pivot:
|
|
56
|
+
*
|
|
57
|
+
* target' = C + q(target - C)
|
|
58
|
+
* eye' = q(eye)
|
|
59
|
+
* position' = target' + eye' = C + q(position - C)
|
|
60
|
+
*
|
|
61
|
+
* i.e. the whole camera rig rotates rigidly about `C`. The content turns
|
|
62
|
+
* about its own centre and stays exactly where it was panned to, because the
|
|
63
|
+
* pivot's projection on screen does not move.
|
|
64
|
+
*
|
|
65
|
+
* `null` (the default) is the historical behaviour: rotation orbits `target`.
|
|
66
|
+
* Setting it equal to `target` is also a no-op, so a viewer that never pans
|
|
67
|
+
* cannot tell the difference.
|
|
68
|
+
*/
|
|
69
|
+
rotationPivot: Vector3 | null;
|
|
20
70
|
minDistance: number;
|
|
21
71
|
maxDistance: number;
|
|
22
72
|
minZoom: number;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One way to ask about, and set, whether a controls instance may rotate, pan
|
|
3
|
+
* or zoom.
|
|
4
|
+
*
|
|
5
|
+
* There are two spellings in play and they are opposites. `OrbitControls` (and
|
|
6
|
+
* `Copper3dOrbitControls`) use positive `enableRotate` / `enablePan` /
|
|
7
|
+
* `enableZoom`; `TrackballControls` and `Copper3dTrackballControls` use
|
|
8
|
+
* negative `noRotate` / `noPan` / `noZoom`. Neither class complains about the
|
|
9
|
+
* other's property name -- it lands as an unread extra field -- so writing the
|
|
10
|
+
* wrong one is a SILENT no-op, and code that has to work with whatever
|
|
11
|
+
* controls a scene happens to be carrying gets it wrong sooner or later.
|
|
12
|
+
*
|
|
13
|
+
* Deliberately structural and free of `three`: a caller holding a controls
|
|
14
|
+
* instance out of a published bundle can still pass it here.
|
|
15
|
+
*/
|
|
16
|
+
export interface AxisGatedControls {
|
|
17
|
+
/** Trackball spelling. */
|
|
18
|
+
noRotate?: boolean;
|
|
19
|
+
noPan?: boolean;
|
|
20
|
+
noZoom?: boolean;
|
|
21
|
+
/** Orbit spelling. */
|
|
22
|
+
enableRotate?: boolean;
|
|
23
|
+
enablePan?: boolean;
|
|
24
|
+
enableZoom?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare function isRotateEnabled(controls: AxisGatedControls): boolean;
|
|
27
|
+
export declare function setRotateEnabled(controls: AxisGatedControls, enabled: boolean): void;
|
|
28
|
+
export declare function isPanEnabled(controls: AxisGatedControls): boolean;
|
|
29
|
+
export declare function setPanEnabled(controls: AxisGatedControls, enabled: boolean): void;
|
|
30
|
+
export declare function isZoomEnabled(controls: AxisGatedControls): boolean;
|
|
31
|
+
export declare function setZoomEnabled(controls: AxisGatedControls, enabled: boolean): void;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { AxisGatedControls } from "./controlsAxes";
|
|
2
|
+
/**
|
|
3
|
+
* Suppresses camera axes for the duration of a gesture that means something
|
|
4
|
+
* else -- scrubbing a slice plane, dragging an annotation anchor, painting on
|
|
5
|
+
* a mesh -- and puts back exactly what was there before.
|
|
6
|
+
*
|
|
7
|
+
* ## Restore what was there, never `true`
|
|
8
|
+
*
|
|
9
|
+
* This is the whole reason to have a helper rather than two assignments. The
|
|
10
|
+
* obvious hand-rolled version disables the axis on pointerdown and re-enables
|
|
11
|
+
* it on pointerup, and it is wrong on any view that was ALREADY locked: a 2D
|
|
12
|
+
* modality with rotation deliberately turned off silently becomes orbitable
|
|
13
|
+
* the first time the reader scrubs it, and nothing ever turns it back off.
|
|
14
|
+
*
|
|
15
|
+
* ## Attach the listener in the CAPTURE phase
|
|
16
|
+
*
|
|
17
|
+
* The gate cannot do this for you, and getting it wrong costs a whole
|
|
18
|
+
* gesture. `Copper3dTrackballControls` listens on the canvas in the bubble
|
|
19
|
+
* phase and latches its rotate state inside its own `pointerdown` handler
|
|
20
|
+
* (`onMouseDown` reads `noRotate` there and copies the pointer position). A
|
|
21
|
+
* listener that opens the gate in the bubble phase runs after that, so the
|
|
22
|
+
* first gesture both scrubs AND orbits:
|
|
23
|
+
*
|
|
24
|
+
* ```ts
|
|
25
|
+
* el.addEventListener("pointerdown", onDown, true); // <- the `true`
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* ## Nesting
|
|
29
|
+
*
|
|
30
|
+
* Gates on the same controls object refcount. The first one captures and
|
|
31
|
+
* suppresses; the last one released restores. Each releaser is idempotent, so
|
|
32
|
+
* calling it from both `pointerup` and `pointercancel` is safe.
|
|
33
|
+
*/
|
|
34
|
+
export interface GestureAxes {
|
|
35
|
+
/** Default `true` -- rotation is what a drag gesture collides with. */
|
|
36
|
+
rotate?: boolean;
|
|
37
|
+
pan?: boolean;
|
|
38
|
+
zoom?: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Suppresses the requested axes and returns the function that restores them.
|
|
42
|
+
*
|
|
43
|
+
* @param controls the scene's controls; trackball or orbit, either spelling
|
|
44
|
+
* @param axes which axes the gesture needs; rotate only by default
|
|
45
|
+
*/
|
|
46
|
+
export declare function beginGesture(controls: AxisGatedControls, axes?: GestureAxes): () => void;
|
|
47
|
+
/** Whether a gesture currently holds this controls object. Mainly for tests. */
|
|
48
|
+
export declare function isGestureActive(controls: AxisGatedControls): boolean;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Pose } from "./cameraTransitions";
|
|
2
|
+
/**
|
|
3
|
+
* Writes a camera pose onto a scene, including the one line everybody forgets.
|
|
4
|
+
*
|
|
5
|
+
* Moving a camera programmatically is three obvious assignments and one
|
|
6
|
+
* non-obvious one:
|
|
7
|
+
*
|
|
8
|
+
* camera.position.set(...)
|
|
9
|
+
* camera.up.set(...)
|
|
10
|
+
* camera.lookAt(...)
|
|
11
|
+
* controls.target.set(...) // <- this one
|
|
12
|
+
*
|
|
13
|
+
* Nothing in copper3d syncs the controls' orbit pivot with `camera.lookAt()`.
|
|
14
|
+
* Leave that last line out and everything appears to work until the user
|
|
15
|
+
* touches the mouse: the first drag calls `controls.update()`, which re-aims
|
|
16
|
+
* the camera at whatever `target` still held, silently undoing the move. The
|
|
17
|
+
* symptom -- "the camera jumps back the moment I drag" -- points at the
|
|
18
|
+
* controls rather than at the code that actually caused it.
|
|
19
|
+
*
|
|
20
|
+
* A free function taking the scene first, so it works on a scene instance from
|
|
21
|
+
* a published bundle and is unit-testable without a renderer. The scene class
|
|
22
|
+
* wraps it as a one-line method.
|
|
23
|
+
*
|
|
24
|
+
* `fitView` does the same thing for the specific case of re-framing on
|
|
25
|
+
* content; this is the general one, for a pose you already have.
|
|
26
|
+
*/
|
|
27
|
+
interface Vec3Like {
|
|
28
|
+
set: (x: number, y: number, z: number) => void;
|
|
29
|
+
}
|
|
30
|
+
export interface PosableScene {
|
|
31
|
+
camera: {
|
|
32
|
+
position: Vec3Like;
|
|
33
|
+
up: Vec3Like;
|
|
34
|
+
lookAt: (x: number, y: number, z: number) => void;
|
|
35
|
+
updateProjectionMatrix?: () => void;
|
|
36
|
+
};
|
|
37
|
+
controls?: {
|
|
38
|
+
/** OrbitControls / TrackballControls' orbit pivot. */
|
|
39
|
+
target?: Vec3Like;
|
|
40
|
+
/** TrackballControls caches the canvas's page box and recomputes it only
|
|
41
|
+
* here; OrbitControls measures per event and does not define this. */
|
|
42
|
+
handleResize?: () => void;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Does NOT render. The caller decides when to draw, which matters under
|
|
47
|
+
* on-demand rendering where this may be one of several changes in a frame.
|
|
48
|
+
*/
|
|
49
|
+
export declare function setCameraPose(scene: PosableScene, pose: Pose): void;
|
|
50
|
+
export {};
|
|
@@ -1,3 +1,38 @@
|
|
|
1
1
|
import * as THREE from "three";
|
|
2
2
|
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader";
|
|
3
|
+
/**
|
|
4
|
+
* Points the Draco decoder at `path`, which must end in a slash -- three
|
|
5
|
+
* appends `draco_wasm_wrapper.js` and `draco_decoder.wasm` to it directly.
|
|
6
|
+
*
|
|
7
|
+
* On a subpath deploy the base URL has to be included: a decoder served from
|
|
8
|
+
* `/te-uma/draco/` is not found at `/draco/`.
|
|
9
|
+
*
|
|
10
|
+
* Call once at startup. The decoder module is fetched on first use and cached
|
|
11
|
+
* inside `DRACOLoader`, so a later change does not re-fetch it.
|
|
12
|
+
*/
|
|
13
|
+
export declare function setDracoDecoderPath(path: string): void;
|
|
14
|
+
/** The same, for the Basis/KTX2 transcoder. Also expects a trailing slash. */
|
|
15
|
+
export declare function setKTX2TranscoderPath(path: string): void;
|
|
16
|
+
/**
|
|
17
|
+
* Optional callbacks for `scene.loadGltf`.
|
|
18
|
+
*
|
|
19
|
+
* Until 3.9.0 there were none, and the third argument every `loadGltf` passed
|
|
20
|
+
* to `GLTFLoader.load` was an empty function NAMED `error` sitting in the
|
|
21
|
+
* *onProgress* slot -- so a failed fetch or a corrupt file invoked nothing at
|
|
22
|
+
* all, and the caller's `callback` simply never fired. A load that fails and a
|
|
23
|
+
* load that is merely slow were indistinguishable from outside.
|
|
24
|
+
*/
|
|
25
|
+
export interface GltfLoadOpts {
|
|
26
|
+
/** Download progress. Fires only when the server sends a Content-Length. */
|
|
27
|
+
onProgress?: (event: ProgressEvent) => void;
|
|
28
|
+
/** Fetch or parse failure. The one signal that a load is never coming. */
|
|
29
|
+
onError?: (error: unknown) => void;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A GLTFLoader wired to the shared Draco and KTX2 loaders.
|
|
33
|
+
*
|
|
34
|
+
* Exported so callers who need their own loader -- their own
|
|
35
|
+
* `LoadingManager`, `onError`, or a load not going through a copper3d scene --
|
|
36
|
+
* do not have to rebuild the decoder wiring and get the paths right again.
|
|
37
|
+
*/
|
|
3
38
|
export declare function copperGltfLoader(renderer: THREE.WebGLRenderer): GLTFLoader;
|
|
@@ -3,11 +3,58 @@ import { copperScene } from "../Scene/copperScene";
|
|
|
3
3
|
import { GUI } from "dat.gui";
|
|
4
4
|
import { nrrdMeshesType, nrrdSliceType, loadingBarType } from "../types/types";
|
|
5
5
|
import { Copper3dTrackballControls } from "../Controls/Copper3dTrackballControls";
|
|
6
|
+
/** A slice axis, in the sense `Volume.extractSlice` uses. */
|
|
7
|
+
export type NrrdAxis = "x" | "y" | "z";
|
|
8
|
+
/** All three, which is what `loadNrrd` has always extracted. */
|
|
9
|
+
export declare const DEFAULT_AXES: readonly NrrdAxis[];
|
|
6
10
|
export interface optsType {
|
|
7
11
|
openGui: boolean;
|
|
8
12
|
container?: HTMLDivElement;
|
|
13
|
+
/**
|
|
14
|
+
* Which slice planes to extract. Defaults to all three, i.e. exactly what
|
|
15
|
+
* previous versions did.
|
|
16
|
+
*
|
|
17
|
+
* Narrow it when you display fewer. `extractSlice` walks the whole volume
|
|
18
|
+
* per call and the result is retained on `volume.sliceList` for the volume's
|
|
19
|
+
* lifetime, so an axis you never show costs a full pass over a 50MB buffer
|
|
20
|
+
* plus a geometry, a material and a canvas-backed texture that nothing ever
|
|
21
|
+
* frees.
|
|
22
|
+
*
|
|
23
|
+
* ::: warning
|
|
24
|
+
* The omitted axes are `undefined` on the `nrrdMeshes` / `nrrdSlices` the
|
|
25
|
+
* callback receives. Their types still declare all three present -- widening
|
|
26
|
+
* them to optional would break every existing caller's compile -- so a
|
|
27
|
+
* caller that narrows `axes` is responsible for only reading what it asked
|
|
28
|
+
* for.
|
|
29
|
+
* :::
|
|
30
|
+
*/
|
|
31
|
+
axes?: readonly NrrdAxis[];
|
|
32
|
+
/**
|
|
33
|
+
* Download progress, in ADDITION to the built-in loading bar -- that keeps
|
|
34
|
+
* writing its percentage into `loadingBar.progress` exactly as before.
|
|
35
|
+
*
|
|
36
|
+
* New in 3.9.0. Until then the loading bar's text was the only progress
|
|
37
|
+
* signal copper3d exposed, so a caller that needed to know a large download
|
|
38
|
+
* was still alive had to watch that DOM node for mutations.
|
|
39
|
+
*/
|
|
40
|
+
onProgress?: (event: ProgressEvent) => void;
|
|
41
|
+
/**
|
|
42
|
+
* Fetch or parse failure. New in 3.9.0; there was no error channel at all
|
|
43
|
+
* before, so a failed volume was indistinguishable from a slow one and the
|
|
44
|
+
* `callback` simply never fired.
|
|
45
|
+
*/
|
|
46
|
+
onError?: (error: unknown) => void;
|
|
9
47
|
}
|
|
10
48
|
export declare function copperNrrdLoader(url: string, loadingBar: loadingBarType, segmentation: boolean, callback?: (volume: any, nrrdMeshes: nrrdMeshesType, nrrdSlices: nrrdSliceType, gui?: GUI) => void, opts?: optsType): void;
|
|
11
49
|
export declare function copperNrrdTexture3dLoader(url: string, scene: THREE.Scene, container: HTMLDivElement, callback?: (volume: any, gui?: GUI) => void): void;
|
|
12
50
|
export declare function getWholeSlices(nrrdSlices: nrrdSliceType, scene: THREE.Scene, gui: GUI, controls: Copper3dTrackballControls): void;
|
|
51
|
+
/**
|
|
52
|
+
* @deprecated Since 3.9.0, use `addVolumeBoundingBox(scene, rasDimensions)`.
|
|
53
|
+
*
|
|
54
|
+
* Kept unchanged for callers passing their own `boxCube`, which works. The
|
|
55
|
+
* two-argument form does not: `cube` is declared in this module and never
|
|
56
|
+
* assigned, so it reaches `new THREE.BoxHelper(undefined)`. This also cannot
|
|
57
|
+
* take a `copperSceneOnDemond` -- a sibling of `copperScene`, not a descendant
|
|
58
|
+
* -- and sizes the box from `volume.matrix` rather than its RAS dimensions.
|
|
59
|
+
*/
|
|
13
60
|
export declare function addBoxHelper(scene: copperScene, volume: any, boxCube?: THREE.Object3D<THREE.Object3DEventMap>): void;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
/**
|
|
3
|
+
* The wireframe box around an NRRD volume.
|
|
4
|
+
*
|
|
5
|
+
* It is the only thing that gives a lone slice plane spatial context -- without
|
|
6
|
+
* it the plane floats in an unbounded void and nothing tells the reader how far
|
|
7
|
+
* through the volume they have scrubbed.
|
|
8
|
+
*
|
|
9
|
+
* Replaces `addBoxHelper`, which cannot be used for this:
|
|
10
|
+
*
|
|
11
|
+
* - It is typed to take a `copperScene`, so `copperSceneOnDemond` -- a sibling
|
|
12
|
+
* subclass, not a descendant -- does not type-check even though it has the
|
|
13
|
+
* `addObject` this needs.
|
|
14
|
+
* - Without its optional third argument it wraps a module-level `cube` that
|
|
15
|
+
* `copperNrrdLoader` never assigns, i.e. `new THREE.BoxHelper(undefined)`.
|
|
16
|
+
* - It sizes the box from `volume.matrix` rather than the volume's RAS
|
|
17
|
+
* dimensions, which is not the box a reader expects around the data.
|
|
18
|
+
*
|
|
19
|
+
* `addBoxHelper` is kept as-is and deprecated rather than fixed, because a
|
|
20
|
+
* caller passing their own `boxCube` gets working behaviour from it today.
|
|
21
|
+
*/
|
|
22
|
+
/** The parts of a scene this needs -- structural, so both `copperScene` and
|
|
23
|
+
* `copperSceneOnDemond` satisfy it, as does a plain test double. */
|
|
24
|
+
export interface BoundingBoxHost {
|
|
25
|
+
addObject: (object: THREE.Object3D) => void;
|
|
26
|
+
}
|
|
27
|
+
export interface VolumeBoundingBoxOpts {
|
|
28
|
+
/** Defaults to white, which is what reads against a dark viewer. Pass a
|
|
29
|
+
* darker tone for a light background, where white lines vanish. */
|
|
30
|
+
color?: THREE.ColorRepresentation;
|
|
31
|
+
/** `object.name`, so a later children sweep can find and dispose it like
|
|
32
|
+
* anything else in the scene. */
|
|
33
|
+
name?: string;
|
|
34
|
+
}
|
|
35
|
+
export declare const VOLUME_BOUNDS_NAME = "volume-bounds";
|
|
36
|
+
/**
|
|
37
|
+
* Adds the box and returns it, so the caller can hide, move or dispose it.
|
|
38
|
+
* Returns `undefined` for a degenerate volume -- a zero extent on any axis
|
|
39
|
+
* would produce a flat or empty helper rather than a box.
|
|
40
|
+
*
|
|
41
|
+
* @param rasDimensions the volume's `RASDimensions`, i.e. its extent in world
|
|
42
|
+
* units along x, y and z
|
|
43
|
+
*/
|
|
44
|
+
export declare function addVolumeBoundingBox(scene: BoundingBoxHost, rasDimensions: ArrayLike<number>, opts?: VolumeBoundingBoxOpts): THREE.BoxHelper | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { baseRenderer } from "./baseRenderer";
|
|
2
|
-
import { ICopperRenderOpt, SceneMapType } from "../types/types";
|
|
2
|
+
import { ICopperRenderOpt, ICopperSceneOpts, SceneMapType } from "../types/types";
|
|
3
3
|
import { copperSceneOnDemond } from "../Scene/copperSceneOnDemond";
|
|
4
4
|
export declare class copperRendererOnDemond extends baseRenderer {
|
|
5
5
|
/** Public so `disposeScene` can unregister an entry. Nothing else removes
|
|
@@ -14,7 +14,17 @@ export declare class copperRendererOnDemond extends baseRenderer {
|
|
|
14
14
|
*/
|
|
15
15
|
disposeScene(name: string): import("./disposeScene").DisposableScene | undefined;
|
|
16
16
|
setCurrentScene(sceneIn: copperSceneOnDemond): void;
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* `opt` is per-scene and new in 3.9.0 -- `{ controls: "copper3d" }` builds
|
|
19
|
+
* the scene with `Copper3dTrackballControls` instead of the default
|
|
20
|
+
* `OrbitControls`. Omit it for exactly the previous behaviour.
|
|
21
|
+
*
|
|
22
|
+
* Deliberately a parameter rather than a read of this renderer's own
|
|
23
|
+
* `options.controls`: that option has never had any effect on on-demand
|
|
24
|
+
* scenes, so honouring it now would swap the controls under anyone who set
|
|
25
|
+
* it and never noticed.
|
|
26
|
+
*/
|
|
27
|
+
createScene(name: string, opt?: ICopperSceneOpts): copperSceneOnDemond | undefined;
|
|
18
28
|
animate: () => void;
|
|
19
29
|
render(): void;
|
|
20
30
|
}
|
|
@@ -24,6 +24,10 @@ export interface DisposableScene {
|
|
|
24
24
|
removeEventListener?: (type: 'change', listener: () => void) => void;
|
|
25
25
|
};
|
|
26
26
|
requestRenderIfNotRequested: () => void;
|
|
27
|
+
/** `copperSceneOnDemond.dispose()`, which releases the `window` resize
|
|
28
|
+
* listener the scene registered on itself. Optional: scene classes that
|
|
29
|
+
* attach nothing outside themselves do not have one. */
|
|
30
|
+
dispose?: () => void;
|
|
27
31
|
}
|
|
28
32
|
export interface SceneDisposalHost<S extends DisposableScene = DisposableScene> {
|
|
29
33
|
sceneMap: Record<string, S>;
|
|
@@ -2,6 +2,7 @@ import * as THREE from "three";
|
|
|
2
2
|
import { GUI } from "dat.gui";
|
|
3
3
|
import { Controls, CameraViewPoint } from "../Controls/copperControls";
|
|
4
4
|
import { customMeshType } from "../lib/three-vignette";
|
|
5
|
+
import type { GltfLoadOpts } from "../Loader/copperGltfLoader";
|
|
5
6
|
import { positionType, nrrdSliceType } from "../types/types";
|
|
6
7
|
import { commonScene } from "./commonSceneMethod";
|
|
7
8
|
export declare class copperMScene extends commonScene {
|
|
@@ -24,7 +25,7 @@ export declare class copperMScene extends commonScene {
|
|
|
24
25
|
constructor(container: HTMLDivElement, renderer: THREE.WebGLRenderer);
|
|
25
26
|
init(): void;
|
|
26
27
|
setControls(type: number): void;
|
|
27
|
-
loadGltf(url: string, callback?: (content: THREE.Group) => void): void;
|
|
28
|
+
loadGltf(url: string, callback?: (content: THREE.Group) => void, opts?: GltfLoadOpts): void;
|
|
28
29
|
setViewPoint(camera: THREE.PerspectiveCamera, target?: number[]): CameraViewPoint;
|
|
29
30
|
loadOBJ(url: string, callback?: (mesh: THREE.Group) => void): void;
|
|
30
31
|
drawWholeNrrd(nrrdSlices: nrrdSliceType): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as THREE from "three";
|
|
2
2
|
import { Copper3dTrackballControls } from "../Controls/Copper3dTrackballControls";
|
|
3
3
|
import { CameraViewPoint } from "../Controls/copperControls";
|
|
4
|
+
import type { GltfLoadOpts } from "../Loader/copperGltfLoader";
|
|
4
5
|
import { OrbitControls } from "three/examples/jsm/controls/OrbitControls";
|
|
5
6
|
import { baseScene } from "./baseScene";
|
|
6
7
|
import { vtkModels } from "../types/types";
|
|
@@ -17,7 +18,7 @@ export declare class copperScene extends baseScene {
|
|
|
17
18
|
private clipAction;
|
|
18
19
|
private surfaceAnnotators;
|
|
19
20
|
constructor(container: HTMLDivElement, renderer: THREE.WebGLRenderer, opt?: ICopperSceneOpts);
|
|
20
|
-
loadGltf(url: string, callback?: (content: THREE.Group) => void): void;
|
|
21
|
+
loadGltf(url: string, callback?: (content: THREE.Group) => void, opts?: GltfLoadOpts): void;
|
|
21
22
|
loadPureGLB(url: string, callback?: (mesh: THREE.Group) => void, opts?: {
|
|
22
23
|
color: string;
|
|
23
24
|
enhanceMaterial?: boolean;
|
|
@@ -1,14 +1,33 @@
|
|
|
1
1
|
import * as THREE from "three";
|
|
2
2
|
import { baseScene } from "./baseScene";
|
|
3
|
+
import type { GltfLoadOpts } from "../Loader/copperGltfLoader";
|
|
3
4
|
import { OrbitControls } from "three/examples/jsm/controls/OrbitControls";
|
|
5
|
+
import { TrackballControls } from "three/examples/jsm/controls/TrackballControls";
|
|
6
|
+
import { Copper3dTrackballControls } from "../Controls/Copper3dTrackballControls";
|
|
4
7
|
import { CameraViewPoint } from "../Controls/copperControls";
|
|
5
8
|
import type { FitBounds } from "../Controls/orbitFraming";
|
|
9
|
+
import type { Pose } from "../Controls/cameraTransitions";
|
|
10
|
+
import { ICopperSceneOpts } from "../types/types";
|
|
6
11
|
export declare class copperSceneOnDemond extends baseScene {
|
|
7
|
-
controls: OrbitControls;
|
|
12
|
+
controls: OrbitControls | Copper3dTrackballControls | TrackballControls;
|
|
8
13
|
renderRequested: boolean | undefined;
|
|
9
14
|
isResize: boolean;
|
|
10
|
-
|
|
11
|
-
|
|
15
|
+
/**
|
|
16
|
+
* `opt.controls` picks the controls class, as it already did on
|
|
17
|
+
* `copperScene`. New in 3.9.0 -- this class hardcoded `OrbitControls`
|
|
18
|
+
* before, so passing the option produced no error and no effect.
|
|
19
|
+
*
|
|
20
|
+
* The DEFAULT stays `OrbitControls`, which is what this class has always
|
|
21
|
+
* built. It differs from `copperScene`'s default (`Copper3dTrackballControls`)
|
|
22
|
+
* on purpose: changing it would silently swap the controls under every
|
|
23
|
+
* existing on-demand viewer.
|
|
24
|
+
*
|
|
25
|
+
* Note that the renderer's own `options.controls` is deliberately NOT
|
|
26
|
+
* consulted. It has never had any effect here, so honouring it now would
|
|
27
|
+
* change behaviour for anyone who set it and never noticed.
|
|
28
|
+
*/
|
|
29
|
+
constructor(container: HTMLDivElement, renderer: THREE.WebGLRenderer, opt?: ICopperSceneOpts);
|
|
30
|
+
loadGltf(url: string, callback?: (content: THREE.Group) => void, opts?: GltfLoadOpts): void;
|
|
12
31
|
/**
|
|
13
32
|
* Re-frames the camera on `bounds`, keeping the preset's view direction and
|
|
14
33
|
* up and replacing only its distance. Returns false when there is nothing
|
|
@@ -19,7 +38,39 @@ export declare class copperSceneOnDemond extends baseScene {
|
|
|
19
38
|
* because this scene renders on demand.
|
|
20
39
|
*/
|
|
21
40
|
fitView(preset: CameraViewPoint, aspect: number, bounds: FitBounds, margin?: number): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Moves the camera to `pose` and syncs the controls' orbit pivot with it.
|
|
43
|
+
* Without that last part the next drag silently undoes the move -- see
|
|
44
|
+
* `Controls/setCameraPose.ts`.
|
|
45
|
+
*
|
|
46
|
+
* Does not render; the caller decides when to draw.
|
|
47
|
+
*/
|
|
48
|
+
setCameraPose(pose: Pose): void;
|
|
22
49
|
confirmResize: () => void;
|
|
50
|
+
/**
|
|
51
|
+
* Releases what this scene attached OUTSIDE itself.
|
|
52
|
+
*
|
|
53
|
+
* The `resize` listener the constructor puts on `window` used to have no
|
|
54
|
+
* counterpart: every scene ever created stayed subscribed for the life of
|
|
55
|
+
* the page, kept alive by the closure, and went on calling
|
|
56
|
+
* `requestRenderIfNotRequested` -- and so `onWindowResize`, which resizes
|
|
57
|
+
* the SHARED renderer -- long after it stopped being displayed. An app that
|
|
58
|
+
* creates a scene per case leaks one of those per case.
|
|
59
|
+
*
|
|
60
|
+
* Does not touch the scene graph or the renderer: what a scene's contents
|
|
61
|
+
* are worth keeping is the caller's decision, and the renderer is shared
|
|
62
|
+
* with every other scene. `disposeScene(renderer, name)` is the one that
|
|
63
|
+
* tears the contents down.
|
|
64
|
+
*
|
|
65
|
+
* Deliberately NOT `controls.dispose()`. That path ends in
|
|
66
|
+
* `domElement.style.touchAction = ""`, and every scene here shares one
|
|
67
|
+
* canvas -- only `connect()` sets it back to `"none"`. Disposing one
|
|
68
|
+
* scene's controls would kill touch rotation on the canvas for the rest of
|
|
69
|
+
* the session. Disabling them is enough.
|
|
70
|
+
*
|
|
71
|
+
* Safe to call twice.
|
|
72
|
+
*/
|
|
73
|
+
dispose(): void;
|
|
23
74
|
render: () => void;
|
|
24
75
|
requestRenderIfNotRequested: () => void;
|
|
25
76
|
}
|
|
@@ -1,4 +1,26 @@
|
|
|
1
1
|
import { kiwriousType } from "../../types/types";
|
|
2
|
+
/**
|
|
3
|
+
* Imports the sensor plugin once and caches it. Concurrent callers share the
|
|
4
|
+
* import. Everything on the `kiwrious` facade below funnels through here, so
|
|
5
|
+
* callers only need this directly when they want to await the load.
|
|
6
|
+
*/
|
|
7
|
+
export declare function loadKiwrious(): Promise<kiwriousType>;
|
|
8
|
+
/**
|
|
9
|
+
* The plugin's public surface, unchanged for callers: `kiwrious.setBinUrl()`,
|
|
10
|
+
* `kiwrious.setWasm()` and `kiwrious.serialService.*` all still work without
|
|
11
|
+
* awaiting anything. The first call that genuinely needs the module
|
|
12
|
+
* (`connectAndReadAsync`) is what triggers the import.
|
|
13
|
+
*
|
|
14
|
+
* Cast because `SerialService_kiwrious` is declared with private fields, so
|
|
15
|
+
* nothing structural can satisfy it -- the facade forwards every public
|
|
16
|
+
* member.
|
|
17
|
+
*/
|
|
2
18
|
declare const kiwrious: kiwriousType;
|
|
3
19
|
export default kiwrious;
|
|
4
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Now async: it awaits the plugin before wiring the buttons, so a click that
|
|
22
|
+
* lands immediately after cannot race the import. Callers that ignored the
|
|
23
|
+
* return value before still work -- the buttons are simply live one
|
|
24
|
+
* microtask-chain later.
|
|
25
|
+
*/
|
|
26
|
+
export declare function configKiwriousHeart(connectBtn: HTMLButtonElement, disconnectBtn: HTMLButtonElement, binUrl: string, wasmUrl: string, connectionCallback: (isConnected: boolean) => void, heartDataCallback: (heartData: any, status: string, hrVal: number) => void): Promise<void>;
|