@viamrobotics/motion-tools 0.8.0 → 0.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/components/App.svelte +1 -1
- package/dist/components/Camera.svelte +16 -17
- package/dist/components/CameraControls.svelte +5 -4
- package/dist/components/Details.svelte +1 -1
- package/dist/components/Focus.svelte +1 -1
- package/dist/components/Label.svelte +25 -0
- package/dist/components/Label.svelte.d.ts +6 -0
- package/dist/components/Labels.svelte +0 -0
- package/dist/components/{Frames.svelte.d.ts → Labels.svelte.d.ts} +14 -6
- package/dist/components/Line.svelte +5 -2
- package/dist/components/Line.svelte.d.ts +2 -0
- package/dist/components/Pointcloud.svelte +4 -1
- package/dist/components/Pointcloud.svelte.d.ts +2 -0
- package/dist/components/RefreshRate.svelte +4 -4
- package/dist/components/Scene.svelte +3 -6
- package/dist/components/SceneProviders.svelte +4 -4
- package/dist/components/Selected.svelte +5 -1
- package/dist/components/Tree/Settings.svelte +37 -17
- package/dist/components/Tree/TreeContainer.svelte +1 -1
- package/dist/components/WorldObjects.svelte +131 -0
- package/dist/components/{Shapes.svelte.d.ts → WorldObjects.svelte.d.ts} +3 -3
- package/dist/components/dashboard/Dashboard.svelte +1 -1
- package/dist/hooks/{useShapes.svelte.d.ts → useDrawAPI.svelte.d.ts} +3 -2
- package/dist/hooks/{useShapes.svelte.js → useDrawAPI.svelte.js} +8 -5
- package/dist/hooks/useFrames.svelte.js +2 -13
- package/dist/hooks/useGeometries.svelte.js +22 -17
- package/dist/hooks/useMachineSettings.svelte.d.ts +8 -0
- package/dist/hooks/useMachineSettings.svelte.js +40 -0
- package/dist/hooks/useObjects.svelte.js +8 -8
- package/dist/hooks/usePointclouds.svelte.js +28 -21
- package/dist/hooks/usePose.svelte.js +3 -3
- package/dist/hooks/usePoses.svelte.js +2 -2
- package/dist/hooks/useSettings.svelte.d.ts +1 -0
- package/dist/hooks/useSettings.svelte.js +1 -0
- package/package.json +31 -31
- package/dist/components/Frames.svelte +0 -54
- package/dist/components/Pointclouds.svelte +0 -21
- package/dist/components/Pointclouds.svelte.d.ts +0 -18
- package/dist/components/Shapes.svelte +0 -54
- package/dist/hooks/useRefreshRates.svelte.d.ts +0 -5
- package/dist/hooks/useRefreshRates.svelte.js +0 -23
|
@@ -1,38 +1,37 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { T } from '@threlte/core'
|
|
3
|
-
import { PerspectiveCamera, OrthographicCamera } from 'three'
|
|
4
3
|
import { useSettings } from '../hooks/useSettings.svelte'
|
|
5
4
|
|
|
6
5
|
let { children, ...rest } = $props()
|
|
7
6
|
|
|
8
7
|
const settings = useSettings()
|
|
9
8
|
const mode = $derived(settings.current.cameraMode)
|
|
10
|
-
|
|
11
|
-
const perspective = new PerspectiveCamera()
|
|
12
|
-
perspective.near = 0.01
|
|
13
|
-
perspective.up.set(0, 0, 1)
|
|
14
|
-
|
|
15
|
-
const orthographic = new OrthographicCamera()
|
|
16
|
-
orthographic.near = -100
|
|
17
|
-
orthographic.far = 100
|
|
18
|
-
orthographic.up.set(0, 0, 1)
|
|
19
|
-
orthographic.zoom = 200
|
|
20
9
|
</script>
|
|
21
10
|
|
|
22
11
|
{#if mode === 'perspective'}
|
|
23
|
-
<T
|
|
24
|
-
is={perspective}
|
|
12
|
+
<T.PerspectiveCamera
|
|
25
13
|
makeDefault
|
|
14
|
+
near={0.01}
|
|
15
|
+
up={[0, 0, 1]}
|
|
16
|
+
oncreate={(ref) => {
|
|
17
|
+
ref.lookAt(0, 0, 0)
|
|
18
|
+
}}
|
|
26
19
|
{...rest}
|
|
27
20
|
>
|
|
28
21
|
{@render children?.()}
|
|
29
|
-
</T>
|
|
22
|
+
</T.PerspectiveCamera>
|
|
30
23
|
{:else if mode === 'orthographic'}
|
|
31
|
-
<T
|
|
32
|
-
is={orthographic}
|
|
24
|
+
<T.OrthographicCamera
|
|
33
25
|
makeDefault
|
|
26
|
+
near={-100}
|
|
27
|
+
far={100}
|
|
28
|
+
zoom={200}
|
|
29
|
+
up={[0, 0, 1]}
|
|
30
|
+
oncreate={(ref) => {
|
|
31
|
+
ref.lookAt(0, 0, 0)
|
|
32
|
+
}}
|
|
34
33
|
{...rest}
|
|
35
34
|
>
|
|
36
35
|
{@render children?.()}
|
|
37
|
-
</T>
|
|
36
|
+
</T.OrthographicCamera>
|
|
38
37
|
{/if}
|
|
@@ -4,18 +4,19 @@
|
|
|
4
4
|
import KeyboardControls from './KeyboardControls.svelte'
|
|
5
5
|
import Portal from './portal/Portal.svelte'
|
|
6
6
|
import Button from './dashboard/Button.svelte'
|
|
7
|
-
import {
|
|
7
|
+
import { useDrawAPI } from '../hooks/useDrawAPI.svelte'
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const drawAPI = useDrawAPI()
|
|
10
10
|
const transformControls = useTransformControls()
|
|
11
11
|
|
|
12
12
|
let ref = $state.raw<CameraControlsRef>()
|
|
13
13
|
|
|
14
14
|
$effect(() => {
|
|
15
|
-
if (
|
|
16
|
-
const { position, lookAt, animate } =
|
|
15
|
+
if (drawAPI.camera) {
|
|
16
|
+
const { position, lookAt, animate } = drawAPI.camera
|
|
17
17
|
ref?.setPosition(position.x, position.y, position.z, animate)
|
|
18
18
|
ref?.setLookAt(position.x, position.y, position.z, lookAt.x, lookAt.y, lookAt.z, animate)
|
|
19
|
+
drawAPI.clearCamera()
|
|
19
20
|
}
|
|
20
21
|
})
|
|
21
22
|
</script>
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
{#if object}
|
|
76
76
|
{@const { geometry } = object}
|
|
77
77
|
<div
|
|
78
|
-
class="border-medium bg-extralight absolute top-0 right-0 z-
|
|
78
|
+
class="border-medium bg-extralight absolute top-0 right-0 z-1000 m-2 w-60 border p-2 text-xs"
|
|
79
79
|
style:transform="translate({draggable.current.x}px, {draggable.current.y}px)"
|
|
80
80
|
{...rest}
|
|
81
81
|
>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { HTML } from '@threlte/extras'
|
|
3
|
+
|
|
4
|
+
import { useSettings } from '../hooks/useSettings.svelte'
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
text: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
let { text }: Props = $props()
|
|
11
|
+
|
|
12
|
+
const settings = useSettings()
|
|
13
|
+
|
|
14
|
+
const labels = $derived(settings.current.enableLabels)
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
{#if labels}
|
|
18
|
+
<HTML
|
|
19
|
+
center
|
|
20
|
+
zIndexRange={[100, 0]}
|
|
21
|
+
class="border-gray-7 border bg-white px-2 py-1 text-xs"
|
|
22
|
+
>
|
|
23
|
+
{text}
|
|
24
|
+
</HTML>
|
|
25
|
+
{/if}
|
|
File without changes
|
|
@@ -1,5 +1,18 @@
|
|
|
1
|
+
export default Labels;
|
|
2
|
+
type Labels = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const Labels: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
1
14
|
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
-
new (options: import(
|
|
15
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
3
16
|
$$bindings?: Bindings;
|
|
4
17
|
} & Exports;
|
|
5
18
|
(internal: unknown, props: {
|
|
@@ -11,8 +24,3 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
|
11
24
|
};
|
|
12
25
|
z_$$bindings?: Bindings;
|
|
13
26
|
}
|
|
14
|
-
declare const Frames: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
-
[evt: string]: CustomEvent<any>;
|
|
16
|
-
}, {}, {}, string>;
|
|
17
|
-
type Frames = InstanceType<typeof Frames>;
|
|
18
|
-
export default Frames;
|
|
@@ -4,15 +4,16 @@
|
|
|
4
4
|
import Frame from './Frame.svelte'
|
|
5
5
|
import type { WorldObject } from '../WorldObject'
|
|
6
6
|
import { useSettings } from '../hooks/useSettings.svelte'
|
|
7
|
+
import type { Snippet } from 'svelte'
|
|
7
8
|
|
|
8
9
|
interface Props {
|
|
9
10
|
object: WorldObject
|
|
11
|
+
children?: Snippet
|
|
10
12
|
}
|
|
11
13
|
|
|
12
|
-
let { object }: Props = $props()
|
|
14
|
+
let { object, children }: Props = $props()
|
|
13
15
|
|
|
14
16
|
const settings = useSettings()
|
|
15
|
-
$inspect(object.metadata.points)
|
|
16
17
|
</script>
|
|
17
18
|
|
|
18
19
|
<Frame
|
|
@@ -36,5 +37,7 @@
|
|
|
36
37
|
scale={Number(settings.current.lineDotSize)}
|
|
37
38
|
/>
|
|
38
39
|
{/each}
|
|
40
|
+
|
|
41
|
+
{@render children?.()}
|
|
39
42
|
</InstancedMesh>
|
|
40
43
|
{/if}
|
|
@@ -13,12 +13,14 @@
|
|
|
13
13
|
import { meshBounds } from '@threlte/extras'
|
|
14
14
|
import { poseToObject3d } from '../transform'
|
|
15
15
|
import { useSettings } from '../hooks/useSettings.svelte'
|
|
16
|
+
import type { Snippet } from 'svelte'
|
|
16
17
|
|
|
17
18
|
interface Props {
|
|
18
19
|
object: WorldObject<{ case: 'points'; value: Float32Array<ArrayBuffer> }>
|
|
20
|
+
children?: Snippet
|
|
19
21
|
}
|
|
20
22
|
|
|
21
|
-
let { object }: Props = $props()
|
|
23
|
+
let { object, children }: Props = $props()
|
|
22
24
|
|
|
23
25
|
const { camera } = useThrelte()
|
|
24
26
|
const settings = useSettings()
|
|
@@ -88,4 +90,5 @@
|
|
|
88
90
|
>
|
|
89
91
|
<T is={geometry} />
|
|
90
92
|
<T is={material} />
|
|
93
|
+
{@render children?.()}
|
|
91
94
|
</T>
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { WorldObject } from '../WorldObject';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
2
3
|
interface Props {
|
|
3
4
|
object: WorldObject<{
|
|
4
5
|
case: 'points';
|
|
5
6
|
value: Float32Array<ArrayBuffer>;
|
|
6
7
|
}>;
|
|
8
|
+
children?: Snippet;
|
|
7
9
|
}
|
|
8
10
|
declare const Pointcloud: import("svelte").Component<Props, {}, "">;
|
|
9
11
|
type Pointcloud = ReturnType<typeof Pointcloud>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Select } from '@viamrobotics/prime-core'
|
|
3
|
-
import {
|
|
3
|
+
import { useMachineSettings } from '../hooks/useMachineSettings.svelte'
|
|
4
4
|
import type { Snippet } from 'svelte'
|
|
5
5
|
|
|
6
6
|
interface Props {
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
let { name, children }: Props = $props()
|
|
12
12
|
|
|
13
|
-
const
|
|
14
|
-
const rate = $derived(
|
|
13
|
+
const { refreshRates } = useMachineSettings()
|
|
14
|
+
const rate = $derived(refreshRates.get(name))
|
|
15
15
|
</script>
|
|
16
16
|
|
|
17
17
|
<label class="flex flex-col gap-1">
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
onchange={(event: InputEvent) => {
|
|
21
21
|
if (event.target instanceof HTMLSelectElement) {
|
|
22
22
|
const { value } = event.target
|
|
23
|
-
|
|
23
|
+
refreshRates.set(name, Number.parseInt(value, 10))
|
|
24
24
|
}
|
|
25
25
|
}}
|
|
26
26
|
value={String(rate ?? '')}
|
|
@@ -3,12 +3,10 @@
|
|
|
3
3
|
import { T } from '@threlte/core'
|
|
4
4
|
import { Grid, interactivity, PerfMonitor } from '@threlte/extras'
|
|
5
5
|
import { PortalTarget } from './portal'
|
|
6
|
-
import
|
|
7
|
-
import Pointclouds from './Pointclouds.svelte'
|
|
6
|
+
import WorldObjects from './WorldObjects.svelte'
|
|
8
7
|
import Selected from './Selected.svelte'
|
|
9
8
|
import Focus from './Focus.svelte'
|
|
10
9
|
import StaticGeometries from './StaticGeometries.svelte'
|
|
11
|
-
import Shapes from './Shapes.svelte'
|
|
12
10
|
import Camera from './Camera.svelte'
|
|
13
11
|
import { useFocusedObject3d } from '../hooks/useSelection.svelte'
|
|
14
12
|
import type { Snippet } from 'svelte'
|
|
@@ -66,9 +64,8 @@
|
|
|
66
64
|
|
|
67
65
|
<MeasureTool />
|
|
68
66
|
<StaticGeometries />
|
|
69
|
-
|
|
70
|
-
<
|
|
71
|
-
<Shapes />
|
|
67
|
+
|
|
68
|
+
<WorldObjects />
|
|
72
69
|
|
|
73
70
|
<Selected />
|
|
74
71
|
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
import { provideSelection } from '../hooks/useSelection.svelte'
|
|
7
7
|
import { provideStaticGeometries } from '../hooks/useStaticGeometries.svelte'
|
|
8
8
|
import { provideVisibility } from '../hooks/useVisibility.svelte'
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { provideDrawAPI } from '../hooks/useDrawAPI.svelte'
|
|
10
|
+
import { provideMachineSettings } from '../hooks/useMachineSettings.svelte'
|
|
11
11
|
import { provideTransformControls } from '../hooks/useControls.svelte'
|
|
12
12
|
import type { Snippet } from 'svelte'
|
|
13
13
|
import { provideObjects } from '../hooks/useObjects.svelte'
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
provideSettings()
|
|
28
28
|
provideTransformControls()
|
|
29
29
|
provideVisibility()
|
|
30
|
-
|
|
30
|
+
provideMachineSettings()
|
|
31
31
|
provideLogs()
|
|
32
32
|
|
|
33
33
|
provideOrigin()
|
|
34
34
|
provideStaticGeometries()
|
|
35
|
-
|
|
35
|
+
provideDrawAPI()
|
|
36
36
|
|
|
37
37
|
provideFrames(() => partID.current)
|
|
38
38
|
provideGeometries(() => partID.current)
|
|
@@ -35,7 +35,11 @@
|
|
|
35
35
|
} else {
|
|
36
36
|
const object3d = scene.getObjectByProperty('uuid', selected.current.uuid)
|
|
37
37
|
if (object3d) {
|
|
38
|
-
box
|
|
38
|
+
// Create a clone so that our bounding box doesn't include children
|
|
39
|
+
const clone = object3d.clone(false)
|
|
40
|
+
object3d.getWorldPosition(clone.position)
|
|
41
|
+
object3d.getWorldQuaternion(clone.quaternion)
|
|
42
|
+
box.setFromObject(clone)
|
|
39
43
|
}
|
|
40
44
|
}
|
|
41
45
|
})
|
|
@@ -4,8 +4,14 @@
|
|
|
4
4
|
import { useMotionClient } from '../../hooks/useMotionClient.svelte'
|
|
5
5
|
import Drawer from './Drawer.svelte'
|
|
6
6
|
import { useSettings } from '../../hooks/useSettings.svelte'
|
|
7
|
+
import { useResourceNames } from '@viamrobotics/svelte-sdk'
|
|
8
|
+
import { usePartID } from '../../hooks/usePartID.svelte'
|
|
9
|
+
import { useMachineSettings } from '../../hooks/useMachineSettings.svelte'
|
|
7
10
|
|
|
11
|
+
const partID = usePartID()
|
|
12
|
+
const cameras = useResourceNames(() => partID.current, 'camera')
|
|
8
13
|
const settings = useSettings()
|
|
14
|
+
const { disabledCameras } = useMachineSettings()
|
|
9
15
|
const motionClient = useMotionClient()
|
|
10
16
|
</script>
|
|
11
17
|
|
|
@@ -14,20 +20,30 @@
|
|
|
14
20
|
defaultOpen
|
|
15
21
|
>
|
|
16
22
|
<div class="flex h-100 flex-col gap-2 overflow-scroll p-3">
|
|
17
|
-
<h3 class="text-
|
|
23
|
+
<h3 class="text-sm"><strong>Machine connection</strong></h3>
|
|
18
24
|
|
|
19
|
-
<RefreshRate name="Frames">
|
|
20
|
-
<option value="0">Do not fetch</option>
|
|
21
|
-
<option value="1">Fetch on reconfigure</option>
|
|
22
|
-
</RefreshRate>
|
|
23
|
-
<RefreshRate name="Pointclouds" />
|
|
24
25
|
<RefreshRate name="Geometries" />
|
|
25
26
|
<RefreshRate name="Poses" />
|
|
26
|
-
|
|
27
|
-
<
|
|
27
|
+
<RefreshRate name="Pointclouds" />
|
|
28
|
+
<div>
|
|
29
|
+
<div>Enabled pointcloud cameras</div>
|
|
30
|
+
{#each cameras.current as camera (camera)}
|
|
31
|
+
<div class="flex items-center justify-between gap-4 py-2">
|
|
32
|
+
{camera.name}
|
|
33
|
+
<Switch
|
|
34
|
+
on={disabledCameras.get(camera.name) !== true}
|
|
35
|
+
on:change={(event) => {
|
|
36
|
+
disabledCameras.set(camera.name, !event.detail)
|
|
37
|
+
}}
|
|
38
|
+
/>
|
|
39
|
+
</div>
|
|
40
|
+
{:else}
|
|
41
|
+
No cameras detected
|
|
42
|
+
{/each}
|
|
43
|
+
</div>
|
|
28
44
|
|
|
29
45
|
<label class="flex flex-col gap-1">
|
|
30
|
-
|
|
46
|
+
Motion client
|
|
31
47
|
<Select
|
|
32
48
|
onchange={(event: InputEvent) => {
|
|
33
49
|
if (event.target instanceof HTMLSelectElement) {
|
|
@@ -42,7 +58,7 @@
|
|
|
42
58
|
</Select>
|
|
43
59
|
</label>
|
|
44
60
|
|
|
45
|
-
<h3 class="text-
|
|
61
|
+
<h3 class="pt-2 text-sm"><strong>Pointclouds</strong></h3>
|
|
46
62
|
<div class="flex flex-col gap-2.5">
|
|
47
63
|
<label class="flex items-center justify-between gap-2">
|
|
48
64
|
Default point size
|
|
@@ -68,14 +84,18 @@
|
|
|
68
84
|
</label>
|
|
69
85
|
</div>
|
|
70
86
|
|
|
71
|
-
<h3 class="text-
|
|
87
|
+
<h3 class="pt-2 text-sm"><strong>Scene</strong></h3>
|
|
72
88
|
<div class="flex flex-col gap-2.5">
|
|
73
89
|
<label class="flex items-center justify-between gap-2">
|
|
74
|
-
|
|
90
|
+
Object labels <Switch bind:on={settings.current.enableLabels} />
|
|
91
|
+
</label>
|
|
92
|
+
|
|
93
|
+
<label class="flex items-center justify-between gap-2">
|
|
94
|
+
Grid <Switch bind:on={settings.current.grid} />
|
|
75
95
|
</label>
|
|
76
96
|
|
|
77
97
|
<label class="flex items-center justify-between gap-2">
|
|
78
|
-
|
|
98
|
+
Grid cell size (m)
|
|
79
99
|
|
|
80
100
|
<div class="w-20">
|
|
81
101
|
<Input
|
|
@@ -86,7 +106,7 @@
|
|
|
86
106
|
</label>
|
|
87
107
|
|
|
88
108
|
<label class="flex items-center justify-between gap-2">
|
|
89
|
-
|
|
109
|
+
Grid section size (m)
|
|
90
110
|
|
|
91
111
|
<div class="w-20">
|
|
92
112
|
<Input
|
|
@@ -97,7 +117,7 @@
|
|
|
97
117
|
</label>
|
|
98
118
|
|
|
99
119
|
<label class="flex items-center justify-between gap-2">
|
|
100
|
-
|
|
120
|
+
Grid fade distance (m)
|
|
101
121
|
|
|
102
122
|
<div class="w-20">
|
|
103
123
|
<Input
|
|
@@ -108,7 +128,7 @@
|
|
|
108
128
|
</label>
|
|
109
129
|
</div>
|
|
110
130
|
|
|
111
|
-
<h3 class="text-
|
|
131
|
+
<h3 class="pt-2 text-sm"><strong>Lines</strong></h3>
|
|
112
132
|
<div class="flex flex-col gap-2.5">
|
|
113
133
|
<label class="flex items-center justify-between gap-2">
|
|
114
134
|
Thickness
|
|
@@ -133,7 +153,7 @@
|
|
|
133
153
|
</label>
|
|
134
154
|
</div>
|
|
135
155
|
|
|
136
|
-
<h3 class="text-
|
|
156
|
+
<h3 class="pt-2 text-sm"><strong>Misc</strong></h3>
|
|
137
157
|
<div class="flex flex-col gap-2.5">
|
|
138
158
|
<label class="flex items-center justify-between gap-2">
|
|
139
159
|
Render stats <Switch bind:on={settings.current.renderStats} />
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
</script>
|
|
36
36
|
|
|
37
37
|
<div
|
|
38
|
-
class="bg-extralight border-medium absolute top-0 left-0 m-2 overflow-y-auto border text-xs"
|
|
38
|
+
class="bg-extralight border-medium absolute top-0 left-0 z-1000 m-2 overflow-y-auto border text-xs"
|
|
39
39
|
style:transform="translate({draggable.current.x}px, {draggable.current.y}px)"
|
|
40
40
|
{...rest}
|
|
41
41
|
>
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { T } from '@threlte/core'
|
|
3
|
+
import { Portal, PortalTarget } from './portal'
|
|
4
|
+
import { useFrames } from '../hooks/useFrames.svelte'
|
|
5
|
+
import { useGeometries } from '../hooks/useGeometries.svelte'
|
|
6
|
+
import { usePointClouds } from '../hooks/usePointclouds.svelte'
|
|
7
|
+
import { useDrawAPI } from '../hooks/useDrawAPI.svelte'
|
|
8
|
+
import Pose from './Pose.svelte'
|
|
9
|
+
import Frame from './Frame.svelte'
|
|
10
|
+
import Line from './Line.svelte'
|
|
11
|
+
import Pointcloud from './Pointcloud.svelte'
|
|
12
|
+
import Model from './WorldObject.svelte'
|
|
13
|
+
import Label from './Label.svelte'
|
|
14
|
+
|
|
15
|
+
const points = usePointClouds()
|
|
16
|
+
const drawAPI = useDrawAPI()
|
|
17
|
+
const frames = useFrames()
|
|
18
|
+
const geometries = useGeometries()
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
{#each frames.current as object (object.uuid)}
|
|
22
|
+
<Pose name={object.name}>
|
|
23
|
+
{#snippet children({ pose })}
|
|
24
|
+
{#if pose}
|
|
25
|
+
<Frame
|
|
26
|
+
uuid={object.uuid}
|
|
27
|
+
name={object.name}
|
|
28
|
+
{pose}
|
|
29
|
+
geometry={object.geometry}
|
|
30
|
+
metadata={object.metadata}
|
|
31
|
+
>
|
|
32
|
+
<PortalTarget id={object.name} />
|
|
33
|
+
<Label text={object.name} />
|
|
34
|
+
</Frame>
|
|
35
|
+
{:else}
|
|
36
|
+
<Portal id={object.referenceFrame}>
|
|
37
|
+
<Frame
|
|
38
|
+
uuid={object.uuid}
|
|
39
|
+
name={object.name}
|
|
40
|
+
pose={pose ?? object.pose}
|
|
41
|
+
geometry={object.geometry}
|
|
42
|
+
metadata={object.metadata}
|
|
43
|
+
>
|
|
44
|
+
<PortalTarget id={object.name} />
|
|
45
|
+
<Label text={object.name} />
|
|
46
|
+
</Frame>
|
|
47
|
+
</Portal>
|
|
48
|
+
{/if}
|
|
49
|
+
{/snippet}
|
|
50
|
+
</Pose>
|
|
51
|
+
{/each}
|
|
52
|
+
|
|
53
|
+
{#each geometries.current as object (object.uuid)}
|
|
54
|
+
<Portal id={object.referenceFrame}>
|
|
55
|
+
<Frame
|
|
56
|
+
uuid={object.uuid}
|
|
57
|
+
name={object.name}
|
|
58
|
+
pose={object.pose}
|
|
59
|
+
geometry={object.geometry}
|
|
60
|
+
metadata={object.metadata}
|
|
61
|
+
>
|
|
62
|
+
<PortalTarget id={object.name} />
|
|
63
|
+
<Label text={object.name} />
|
|
64
|
+
</Frame>
|
|
65
|
+
</Portal>
|
|
66
|
+
{/each}
|
|
67
|
+
|
|
68
|
+
{#each points.current as object (object.uuid)}
|
|
69
|
+
<Portal id={object.referenceFrame}>
|
|
70
|
+
<Pointcloud {object}>
|
|
71
|
+
<Label text={object.name} />
|
|
72
|
+
</Pointcloud>
|
|
73
|
+
</Portal>
|
|
74
|
+
{/each}
|
|
75
|
+
|
|
76
|
+
{#each drawAPI.points as object (object.uuid)}
|
|
77
|
+
<Portal id={object.referenceFrame}>
|
|
78
|
+
<Pointcloud {object}>
|
|
79
|
+
<Label text={object.name} />
|
|
80
|
+
</Pointcloud>
|
|
81
|
+
</Portal>
|
|
82
|
+
{/each}
|
|
83
|
+
|
|
84
|
+
<T
|
|
85
|
+
name={drawAPI.object3ds.batchedArrow.object3d.name}
|
|
86
|
+
is={drawAPI.object3ds.batchedArrow.object3d}
|
|
87
|
+
dispose={false}
|
|
88
|
+
/>
|
|
89
|
+
|
|
90
|
+
{#each drawAPI.meshes as object (object.uuid)}
|
|
91
|
+
<Portal id={object.referenceFrame}>
|
|
92
|
+
<Frame
|
|
93
|
+
uuid={object.uuid}
|
|
94
|
+
name={object.name}
|
|
95
|
+
pose={object.pose}
|
|
96
|
+
geometry={object.geometry}
|
|
97
|
+
metadata={object.metadata}
|
|
98
|
+
>
|
|
99
|
+
<PortalTarget id={object.name} />
|
|
100
|
+
<Label text={object.name} />
|
|
101
|
+
</Frame>
|
|
102
|
+
</Portal>
|
|
103
|
+
{/each}
|
|
104
|
+
|
|
105
|
+
{#each drawAPI.nurbs as object (object.uuid)}
|
|
106
|
+
<Portal id={object.referenceFrame}>
|
|
107
|
+
<Frame
|
|
108
|
+
uuid={object.uuid}
|
|
109
|
+
name={object.name}
|
|
110
|
+
pose={object.pose}
|
|
111
|
+
geometry={object.geometry}
|
|
112
|
+
metadata={object.metadata}
|
|
113
|
+
>
|
|
114
|
+
<PortalTarget id={object.name} />
|
|
115
|
+
<Label text={object.name} />
|
|
116
|
+
</Frame>
|
|
117
|
+
</Portal>
|
|
118
|
+
{/each}
|
|
119
|
+
|
|
120
|
+
{#each drawAPI.models as object (object.uuid)}
|
|
121
|
+
<Model {object}>
|
|
122
|
+
<PortalTarget id={object.name} />
|
|
123
|
+
<Label text={object.name} />
|
|
124
|
+
</Model>
|
|
125
|
+
{/each}
|
|
126
|
+
|
|
127
|
+
{#each drawAPI.lines as object (object.uuid)}
|
|
128
|
+
<Line {object}>
|
|
129
|
+
<Label text={object.name} />
|
|
130
|
+
</Line>
|
|
131
|
+
{/each}
|
|
@@ -11,8 +11,8 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
|
11
11
|
};
|
|
12
12
|
z_$$bindings?: Bindings;
|
|
13
13
|
}
|
|
14
|
-
declare const
|
|
14
|
+
declare const WorldObjects: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
15
|
[evt: string]: CustomEvent<any>;
|
|
16
16
|
}, {}, {}, string>;
|
|
17
|
-
type
|
|
18
|
-
export default
|
|
17
|
+
type WorldObjects = InstanceType<typeof WorldObjects>;
|
|
18
|
+
export default WorldObjects;
|
|
@@ -18,7 +18,8 @@ interface Context {
|
|
|
18
18
|
lookAt: Vector3;
|
|
19
19
|
animate: boolean;
|
|
20
20
|
} | undefined;
|
|
21
|
+
clearCamera: () => void;
|
|
21
22
|
}
|
|
22
|
-
export declare const
|
|
23
|
-
export declare const
|
|
23
|
+
export declare const provideDrawAPI: () => void;
|
|
24
|
+
export declare const useDrawAPI: () => Context;
|
|
24
25
|
export {};
|