@nebula-spatial/studio 0.0.0-stage → 0.1.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/README.md +206 -3
- package/dist/ai/contract.d.ts +73 -0
- package/dist/ai/host.d.ts +28 -0
- package/dist/asset/dependency-scan.d.ts +78 -0
- package/dist/asset/intake.d.ts +84 -0
- package/dist/asset/layout-detect.d.ts +40 -0
- package/dist/asset/media-type.d.ts +10 -0
- package/dist/asset/model-inspection.d.ts +127 -0
- package/dist/asset/record.d.ts +35 -0
- package/dist/asset/remote-asset-resolver.d.ts +36 -0
- package/dist/asset/repairs.d.ts +53 -0
- package/dist/asset/resource-locator.d.ts +15 -0
- package/dist/asset/revision-diff.d.ts +33 -0
- package/dist/asset/source-contracts.d.ts +21 -0
- package/dist/asset/source-paths.d.ts +15 -0
- package/dist/asset/usd-inspection.d.ts +39 -0
- package/dist/asset/usd-source-metadata.d.ts +142 -0
- package/dist/asset/visual-intake.d.ts +27 -0
- package/dist/asset/visual-record.d.ts +22 -0
- package/dist/asset/web-intake.d.ts +46 -0
- package/dist/asset-source-BExlEcRt.js +444 -0
- package/dist/assets/openusd_three_loader-DLiqJWUM.js +13769 -0
- package/dist/assets/usd-export-worker-BRxTLqer.js +182 -0
- package/dist/assets/usd-worker-DekqMsQv.js +1392 -0
- package/dist/builders-BAXRR5o5.js +1854 -0
- package/dist/core/asset-task.d.ts +105 -0
- package/dist/core/context.d.ts +23 -0
- package/dist/core/host.d.ts +432 -0
- package/dist/core/persistence-controller.d.ts +58 -0
- package/dist/core/plugins.d.ts +139 -0
- package/dist/core/scene-tree.d.ts +62 -0
- package/dist/core/versions.d.ts +2 -0
- package/dist/core/when.d.ts +13 -0
- package/dist/core/write-policy.d.ts +29 -0
- package/dist/delivery/build-plan.d.ts +2 -0
- package/dist/delivery/contracts.d.ts +362 -0
- package/dist/delivery/digest.d.ts +3 -0
- package/dist/delivery/evidence.d.ts +10 -0
- package/dist/delivery/export-evidence.d.ts +3 -0
- package/dist/delivery/index.d.ts +9 -0
- package/dist/delivery/prim-name.d.ts +17 -0
- package/dist/delivery/profile.d.ts +4 -0
- package/dist/doc/builders.d.ts +99 -0
- package/dist/doc/command.d.ts +195 -0
- package/dist/doc/domain-extensions.d.ts +34 -0
- package/dist/doc/node-facts.d.ts +87 -0
- package/dist/doc/physics-facts.d.ts +74 -0
- package/dist/doc/placement-policy.d.ts +71 -0
- package/dist/doc/random-placement.d.ts +30 -0
- package/dist/doc/scene-graph.d.ts +80 -0
- package/dist/doc/scene-regions.d.ts +29 -0
- package/dist/doc/schema.d.ts +452 -0
- package/dist/doc/task.d.ts +71 -0
- package/dist/doc/validate.d.ts +68 -0
- package/dist/editor/asset-source.d.ts +15 -0
- package/dist/editor/editor.d.ts +246 -0
- package/dist/editor/index.d.ts +22 -0
- package/dist/editor/shortcuts.d.ts +2 -0
- package/dist/editor/types.d.ts +143 -0
- package/dist/editor/ui-plugins.d.ts +64 -0
- package/dist/editor.js +1755 -0
- package/dist/editorial-BkAFWfbg.js +83 -0
- package/dist/export-evidence-DMNRhgL9.js +2705 -0
- package/dist/generalization/domain.d.ts +10 -0
- package/dist/generalization/generalization.d.ts +371 -0
- package/dist/generalization/index.d.ts +11 -0
- package/dist/generalization.js +1659 -0
- package/dist/history/undo-stack.d.ts +74 -0
- package/dist/index.d.ts +91 -0
- package/dist/index.js +2840 -0
- package/dist/mjcf-visual-Bt4bUxd1.js +72 -0
- package/dist/mujoco-runtime-BYZnrvbR.js +467 -0
- package/dist/persist/content-addressed.d.ts +11 -0
- package/dist/persist/create-scene-package-from-host.d.ts +7 -0
- package/dist/persist/indexeddb-store.d.ts +69 -0
- package/dist/persist/scene-file.d.ts +52 -0
- package/dist/persist/scene-package.d.ts +8 -0
- package/dist/persist/snapshot.d.ts +5 -0
- package/dist/physics-facts-tfQYyNTD.js +337 -0
- package/dist/placement-policy-DY_FNRDu.js +405 -0
- package/dist/ports/asset-ingestor.d.ts +41 -0
- package/dist/ports/asset-source.d.ts +57 -0
- package/dist/ports/delivery.d.ts +13 -0
- package/dist/ports/persistence.d.ts +29 -0
- package/dist/project/asset-catalog.d.ts +21 -0
- package/dist/project/contracts.d.ts +272 -0
- package/dist/project/editorial.d.ts +16 -0
- package/dist/project/identity.d.ts +20 -0
- package/dist/project/index.d.ts +9 -0
- package/dist/project/scene-document.d.ts +5 -0
- package/dist/project/source-dependencies.d.ts +7 -0
- package/dist/remote-asset-resolver-Cb8cfNmw.js +136 -0
- package/dist/scene/index.d.ts +12 -0
- package/dist/scene-graph-DBLKAhxa.js +681 -0
- package/dist/scene-session-Cy6vDJ1l.js +21981 -0
- package/dist/scene.js +244 -0
- package/dist/session-BRBrCLdd.js +963 -0
- package/dist/session-DI5tPJxn.js +825 -0
- package/dist/session-q3uuG7OP.js +296 -0
- package/dist/studio/delivery-catalog.d.ts +28 -0
- package/dist/studio/in-memory-asset-source.d.ts +15 -0
- package/dist/studio/index.d.ts +31 -0
- package/dist/studio/indexeddb-asset-source.d.ts +32 -0
- package/dist/studio/indexeddb-persistence.d.ts +13 -0
- package/dist/studio/remote-asset-importer.d.ts +56 -0
- package/dist/studio/source-package.d.ts +9 -0
- package/dist/studio/usd-export-client.d.ts +13 -0
- package/dist/studio/usd-export-protocol.d.ts +98 -0
- package/dist/studio/usd-export-worker.d.ts +1 -0
- package/dist/studio/usd-zip-reader.d.ts +14 -0
- package/dist/studio/web-asset-ingestor.d.ts +10 -0
- package/dist/studio/web-host.d.ts +8 -0
- package/dist/studio.js +5545 -0
- package/dist/urdf-session-CQir2nb2.js +1230 -0
- package/dist/usd-session-DZJnEEOs.js +7385 -0
- package/dist/util/asset-facts.d.ts +3 -0
- package/dist/util/data.d.ts +17 -0
- package/dist/util/diagnostics.d.ts +38 -0
- package/dist/util/geometry.d.ts +11 -0
- package/dist/util/hash.d.ts +9 -0
- package/dist/util/ids.d.ts +20 -0
- package/dist/util/math.d.ts +47 -0
- package/dist/util/ply-metadata.d.ts +19 -0
- package/dist/util/studio-source.d.ts +23 -0
- package/dist/version.d.ts +5 -0
- package/dist/view/appearance.d.ts +13 -0
- package/dist/view/authoring-appearance.d.ts +25 -0
- package/dist/view/bounds-preview.d.ts +34 -0
- package/dist/view/bounds.d.ts +11 -0
- package/dist/view/camera-zoom.d.ts +3 -0
- package/dist/view/geometry-anchors.d.ts +20 -0
- package/dist/view/gizmo-appearance.d.ts +5 -0
- package/dist/view/gizmo.d.ts +81 -0
- package/dist/view/group-selection.d.ts +13 -0
- package/dist/view/node-features.d.ts +39 -0
- package/dist/view/picking.d.ts +49 -0
- package/dist/view/placement.d.ts +48 -0
- package/dist/view/region-editing.d.ts +25 -0
- package/dist/view/rotation-guide.d.ts +36 -0
- package/dist/view/runtime-capabilities.d.ts +22 -0
- package/dist/view/scene-session.d.ts +258 -0
- package/dist/view/screen-bounds.d.ts +17 -0
- package/dist/view/selection-transform.d.ts +20 -0
- package/dist/wasm-module-DZn2AM1W.js +13 -0
- package/dist/xacro-DLRXyk60.js +76 -0
- package/node_modules/@nebula-spatial/cad-loader/CHANGELOG.md +48 -0
- package/node_modules/@nebula-spatial/cad-loader/README.md +108 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/cad-types.d.ts +26 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/errors.d.ts +5 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/index.d.ts +24 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/index.js +2354 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/parser/bin-group-reader.d.ts +9 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/parser/bin-parser.d.ts +78 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/parser/dxbs-sidecar.d.ts +24 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/parser/geometry-segments.d.ts +20 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/parser/text-roundtrip.d.ts +4 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/parser/types.d.ts +81 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/runtime-text-decoder.d.ts +8 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/types.d.ts +153 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/utils/insert-bbox.d.ts +10 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/utils/viewport-rect.d.ts +21 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/index.d.ts +36 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/index.js +5829 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/geo-loader.d.ts +59 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/automatic-external-resources.d.ts +26 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/external-variant-sidecar-fetch.d.ts +13 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/flow-control.d.ts +29 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/frame-budget-scheduler.d.ts +21 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-compact-executor.d.ts +19 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-loader-local-adapter.d.ts +2 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-loader-pipeline.d.ts +92 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-loader-worker-adapter.d.ts +13 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-node-builder.d.ts +34 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-node-load-sink.d.ts +28 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-node.d.ts +304 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-prepare-worker-types.d.ts +94 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-prepare.d.ts +38 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-prepare.worker.d.ts +1 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/insert-model-builder.d.ts +10 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/insert-runtime-geometry.d.ts +15 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/line-canonical.d.ts +37 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/line-quality.d.ts +9 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/prepare-credit-gate.d.ts +20 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/transport.d.ts +2 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/render-resource/cad-render-node.d.ts +80 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/render-resource/geo-node-cad-render-node.d.ts +12 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/scene/geo-cad-line-geometry.d.ts +28 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/scene/geo-cad-line-material.d.ts +18 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/scene/instancing/block-geometry-registry.d.ts +35 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/scene/instancing/insert-instance-table.d.ts +23 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/scene/instancing/viewport-instance-presenter.d.ts +66 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/selection/cad-insert-selection.d.ts +35 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/selection/cad-text-selection.d.ts +31 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/session/annotation-idle-gate.d.ts +14 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/session/cad-document-session.d.ts +187 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/session/cad-font-runtime.d.ts +11 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/session/cad-insert-id.d.ts +6 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/session/cad-text-warmup.d.ts +38 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/session/create-cad-document-session.d.ts +5 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/session/load-session.d.ts +90 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/session/viewport-coverage.d.ts +32 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/abort.d.ts +3 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/cad-display-color.d.ts +55 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/cad-load-source.d.ts +8 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/color-buffer.d.ts +6 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/constants.d.ts +11 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/display-color-buffer.d.ts +27 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/errors.d.ts +2 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/text-builder.d.ts +25 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/text-font.d.ts +12 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/types.d.ts +57 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/utils/insert-bbox.d.ts +1 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/utils/timing.d.ts +2 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/utils/viewport-rect.d.ts +1 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/viewer-theme.d.ts +2 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/workers/geo-prepare.worker.js +2264 -0
- package/node_modules/@nebula-spatial/cad-loader/package.json +62 -0
- package/node_modules/@nebula-spatial/viewer/CHANGELOG.md +426 -0
- package/node_modules/@nebula-spatial/viewer/FBX-MATERIAL-CONVERSION.md +97 -0
- package/node_modules/@nebula-spatial/viewer/README.md +1056 -0
- package/node_modules/@nebula-spatial/viewer/USD-VISUAL-MATERIAL-SUPPORT.md +89 -0
- package/node_modules/@nebula-spatial/viewer/basis/basis_transcoder.js +19 -0
- package/node_modules/@nebula-spatial/viewer/basis/basis_transcoder.wasm +0 -0
- package/node_modules/@nebula-spatial/viewer/dist/asset-ir-DEOK9SqE.js +382 -0
- package/node_modules/@nebula-spatial/viewer/dist/assets/ground-grid.d.ts +6 -0
- package/node_modules/@nebula-spatial/viewer/dist/assets/source-types.d.ts +19 -0
- package/node_modules/@nebula-spatial/viewer/dist/assets/types.d.ts +393 -0
- package/node_modules/@nebula-spatial/viewer/dist/assets/usd-worker-Bom5cjz3.js +1392 -0
- package/node_modules/@nebula-spatial/viewer/dist/cad/text.d.ts +2 -0
- package/node_modules/@nebula-spatial/viewer/dist/cad/types.d.ts +368 -0
- package/node_modules/@nebula-spatial/viewer/dist/index-ByBlfVc0.js +12132 -0
- package/node_modules/@nebula-spatial/viewer/dist/index.d.ts +32 -0
- package/node_modules/@nebula-spatial/viewer/dist/index.js +26 -0
- package/node_modules/@nebula-spatial/viewer/dist/inspection/types.d.ts +112 -0
- package/node_modules/@nebula-spatial/viewer/dist/mjcf-visual-DVRa0w90.js +72 -0
- package/node_modules/@nebula-spatial/viewer/dist/mujoco-runtime-Dhx6Ua2u.js +463 -0
- package/node_modules/@nebula-spatial/viewer/dist/plugins.d.ts +179 -0
- package/node_modules/@nebula-spatial/viewer/dist/scene/instances.d.ts +36 -0
- package/node_modules/@nebula-spatial/viewer/dist/scene/types.d.ts +258 -0
- package/node_modules/@nebula-spatial/viewer/dist/session-B-j6KdA-.js +389 -0
- package/node_modules/@nebula-spatial/viewer/dist/session-B4AICTeJ.js +963 -0
- package/node_modules/@nebula-spatial/viewer/dist/session-BAG5cDYe.js +9153 -0
- package/node_modules/@nebula-spatial/viewer/dist/simulation/mujoco-runtime.d.ts +118 -0
- package/node_modules/@nebula-spatial/viewer/dist/simulation/mujoco-wasm-module.d.ts +11 -0
- package/node_modules/@nebula-spatial/viewer/dist/simulation/openusd-wasm-module.d.ts +10 -0
- package/node_modules/@nebula-spatial/viewer/dist/simulation/physics-runtime-state.d.ts +75 -0
- package/node_modules/@nebula-spatial/viewer/dist/simulation/types.d.ts +129 -0
- package/node_modules/@nebula-spatial/viewer/dist/simulation/usd-inspection.d.ts +66 -0
- package/node_modules/@nebula-spatial/viewer/dist/simulation/usd-query.d.ts +50 -0
- package/node_modules/@nebula-spatial/viewer/dist/simulation/usd-resource-policy.d.ts +28 -0
- package/node_modules/@nebula-spatial/viewer/dist/types.d.ts +278 -0
- package/node_modules/@nebula-spatial/viewer/dist/ui/types.d.ts +48 -0
- package/node_modules/@nebula-spatial/viewer/dist/urdf-session-kemAnBn8.js +3231 -0
- package/node_modules/@nebula-spatial/viewer/dist/usd-session-QtwGKI7v.js +6771 -0
- package/node_modules/@nebula-spatial/viewer/dist/version.d.ts +5 -0
- package/node_modules/@nebula-spatial/viewer/dist/viewer.d.ts +2 -0
- package/node_modules/@nebula-spatial/viewer/dist/xacro-CYTPS7mh.js +1537 -0
- package/node_modules/@nebula-spatial/viewer/openusd/openusd-runtime-manifest.json +15 -0
- package/node_modules/@nebula-spatial/viewer/openusd/openusd_probe.js +14 -0
- package/node_modules/@nebula-spatial/viewer/openusd/openusd_probe.wasm +0 -0
- package/node_modules/@nebula-spatial/viewer/package.json +66 -0
- package/package.json +87 -6
package/dist/scene.js
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { c as ze } from "./scene-session-Cy6vDJ1l.js";
|
|
2
|
+
import { WebGLRenderer as J, SRGBColorSpace as Q, Scene as K, PerspectiveCamera as ee, Group as V, Box3 as G, Vector3 as v, Quaternion as te, BoxGeometry as ne, MeshBasicMaterial as oe, Color as O, Mesh as re, LineSegments as se, EdgesGeometry as ae, LineBasicMaterial as ie, GridHelper as ce } from "three";
|
|
3
|
+
import { OrbitControls as le } from "three/examples/jsm/controls/OrbitControls.js";
|
|
4
|
+
import { X as de } from "./scene-graph-DBLKAhxa.js";
|
|
5
|
+
const ue = Object.freeze({
|
|
6
|
+
X: "#08ddd6",
|
|
7
|
+
Y: "#08ddd6",
|
|
8
|
+
Z: "#08ddd6"
|
|
9
|
+
}), pe = [
|
|
10
|
+
"position:absolute",
|
|
11
|
+
"inset:0",
|
|
12
|
+
"overflow:hidden",
|
|
13
|
+
"contain:layout paint",
|
|
14
|
+
"background:#090d0e"
|
|
15
|
+
].join(";"), he = [
|
|
16
|
+
"display:block",
|
|
17
|
+
"width:100%",
|
|
18
|
+
"height:100%",
|
|
19
|
+
"touch-action:none",
|
|
20
|
+
"cursor:grab"
|
|
21
|
+
].join(";"), me = [
|
|
22
|
+
"position:absolute",
|
|
23
|
+
"inset:0",
|
|
24
|
+
"pointer-events:none",
|
|
25
|
+
'font-family:"JetBrains Mono","SFMono-Regular",Consolas,monospace'
|
|
26
|
+
].join(";");
|
|
27
|
+
function Ae(e) {
|
|
28
|
+
const n = e.container.ownerDocument, t = n.createElement("div");
|
|
29
|
+
t.dataset.studioBoundsPreview = "true", t.style.cssText = pe;
|
|
30
|
+
const o = n.createElement("canvas");
|
|
31
|
+
o.className = "studio-bounds-preview-canvas", o.setAttribute("aria-label", "Three-dimensional bounding box preview"), o.tabIndex = 0, o.style.cssText = he;
|
|
32
|
+
const s = n.createElement("div");
|
|
33
|
+
s.style.cssText = me;
|
|
34
|
+
const r = n.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
35
|
+
r.setAttribute("width", "100%"), r.setAttribute("height", "100%"), r.style.cssText = "position:absolute;inset:0;overflow:visible", s.append(r);
|
|
36
|
+
const d = n.createElement("div");
|
|
37
|
+
d.style.cssText = [
|
|
38
|
+
"position:absolute",
|
|
39
|
+
"top:24px",
|
|
40
|
+
"right:28px",
|
|
41
|
+
"display:flex",
|
|
42
|
+
"align-items:baseline",
|
|
43
|
+
"gap:6px",
|
|
44
|
+
"color:#aeb4b4",
|
|
45
|
+
'font:12px/1.2 "JetBrains Mono",monospace',
|
|
46
|
+
"letter-spacing:.02em",
|
|
47
|
+
"text-shadow:0 1px 2px #000"
|
|
48
|
+
].join(";");
|
|
49
|
+
const u = n.createElement("span"), z = n.createElement("span");
|
|
50
|
+
z.textContent = "↑", d.append(u, z), s.append(d), t.append(o, s), e.container.append(t);
|
|
51
|
+
const i = new J({
|
|
52
|
+
canvas: o,
|
|
53
|
+
alpha: !0,
|
|
54
|
+
antialias: !0,
|
|
55
|
+
preserveDrawingBuffer: !0
|
|
56
|
+
});
|
|
57
|
+
i.outputColorSpace = Q, i.setClearColor(0, 0);
|
|
58
|
+
const f = new K(), m = new ee(34, 1, 0.01, 1e3);
|
|
59
|
+
m.up.set(0, 0, 1);
|
|
60
|
+
const c = new le(m, o);
|
|
61
|
+
c.enableDamping = !1, c.enablePan = !1, c.minDistance = 0.5, c.maxDistance = 500;
|
|
62
|
+
const y = new V();
|
|
63
|
+
y.name = "studio-bounds-preview:content", f.add(y);
|
|
64
|
+
let p = k(e.dimensions), x = e.localUpDirection ?? [0, 0, 1], B = e.showGrid ?? !0, C = e.showMeasurements ?? !0, $ = e.showAxes ?? !0, g = !1, D = new G(new v(-0.5, -0.5, 0), new v(0.5, 0.5, 1)), S = null, P = [], M = null;
|
|
65
|
+
const F = () => {
|
|
66
|
+
g || (i.render(f, m), q());
|
|
67
|
+
}, L = () => {
|
|
68
|
+
g || requestAnimationFrame(F);
|
|
69
|
+
}, R = () => {
|
|
70
|
+
if (g) return !1;
|
|
71
|
+
const l = e.container.clientWidth, h = e.container.clientHeight;
|
|
72
|
+
if (l <= 0 || h <= 0) return !1;
|
|
73
|
+
const a = Math.min(globalThis.devicePixelRatio || 1, 2);
|
|
74
|
+
return i.setPixelRatio(a), i.setSize(l, h, !1), m.aspect = l / h, m.updateProjectionMatrix(), F(), !0;
|
|
75
|
+
}, T = () => {
|
|
76
|
+
if (g) return !1;
|
|
77
|
+
const l = D.getSize(new v()), h = D.getCenter(new v()), a = Math.max(l.x, l.y, l.z, 0.25), b = a * 3.15, A = new v(1.15, -1.65, 1.05).normalize();
|
|
78
|
+
return m.position.copy(h).addScaledVector(A, b), m.near = Math.max(b / 200, 5e-3), m.far = Math.max(b * 20, 50), m.updateProjectionMatrix(), c.target.copy(h), c.minDistance = Math.max(a * 1.2, 0.2), c.maxDistance = Math.max(a * 8, 10), c.update(), F(), !0;
|
|
79
|
+
}, W = (l) => {
|
|
80
|
+
if (g) return;
|
|
81
|
+
p = k(l.dimensions), x = fe(l.localUpDirection ?? [0, 0, 1]);
|
|
82
|
+
const h = xe(x);
|
|
83
|
+
u.textContent = h, d.dataset.studioBoundsUp = h, X(S), N(M), M = null, S = we(p, x), D = S.bounds, y.add(S.root), B && (M = be(D), f.add(M));
|
|
84
|
+
for (const a of P) a.label.remove();
|
|
85
|
+
P = ye(p, S, C, r, n), I(), R(), T();
|
|
86
|
+
}, I = () => {
|
|
87
|
+
r.style.display = C ? "block" : "none", d.style.display = $ ? "block" : "none", M && (M.visible = B);
|
|
88
|
+
for (const l of P) l.label.hidden = !C;
|
|
89
|
+
}, q = () => {
|
|
90
|
+
if (g) return;
|
|
91
|
+
const l = e.container.clientWidth, h = e.container.clientHeight;
|
|
92
|
+
if (!(l <= 0 || h <= 0))
|
|
93
|
+
for (const a of P) {
|
|
94
|
+
const b = U(a.start, m, l, h), A = U(a.end, m, l, h);
|
|
95
|
+
if (!b.visible || !A.visible) {
|
|
96
|
+
a.line.style.display = "none", a.label.hidden = !0;
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
a.line.style.display = "", a.line.setAttribute("x1", b.x.toFixed(2)), a.line.setAttribute("y1", b.y.toFixed(2)), a.line.setAttribute("x2", A.x.toFixed(2)), a.line.setAttribute("y2", A.y.toFixed(2)), a.label.hidden = !C;
|
|
100
|
+
const _ = a.axis === "Z" ? 34 : a.axis === "Y" ? -24 : 0, H = a.axis === "Z" ? 0 : 16;
|
|
101
|
+
a.label.style.left = `${(b.x + A.x) / 2 + _}px`, a.label.style.top = `${(b.y + A.y) / 2 + H}px`;
|
|
102
|
+
}
|
|
103
|
+
}, E = typeof ResizeObserver == "function" ? new ResizeObserver(() => {
|
|
104
|
+
R() && T();
|
|
105
|
+
}) : null;
|
|
106
|
+
E == null || E.observe(e.container), c.addEventListener("change", L);
|
|
107
|
+
const w = e.signal;
|
|
108
|
+
let j = null;
|
|
109
|
+
W({ dimensions: p, localUpDirection: x }), L();
|
|
110
|
+
const Y = {
|
|
111
|
+
update: W,
|
|
112
|
+
fit: T,
|
|
113
|
+
resize: R,
|
|
114
|
+
render: F,
|
|
115
|
+
dispose() {
|
|
116
|
+
if (!g) {
|
|
117
|
+
g = !0, j && (w == null || w.removeEventListener("abort", j)), E == null || E.disconnect(), c.removeEventListener("change", L), c.dispose(), X(S), N(M);
|
|
118
|
+
for (const l of P) l.label.remove();
|
|
119
|
+
i.dispose(), t.remove();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
return j = () => Y.dispose(), w != null && w.aborted ? j() : w == null || w.addEventListener("abort", j, { once: !0 }), Y;
|
|
124
|
+
}
|
|
125
|
+
function k(e) {
|
|
126
|
+
if ([e.length, e.width, e.height].some((t) => !Number.isFinite(t) || t <= 0))
|
|
127
|
+
throw new Error("Bounds preview dimensions must be positive finite values.");
|
|
128
|
+
return { length: e.length, width: e.width, height: e.height };
|
|
129
|
+
}
|
|
130
|
+
function fe(e) {
|
|
131
|
+
const n = new v().fromArray(e);
|
|
132
|
+
if (!e.every(Number.isFinite) || n.lengthSq() <= 1e-16)
|
|
133
|
+
throw new Error("Bounds preview local up direction must be a finite non-zero vector.");
|
|
134
|
+
return n.normalize(), [n.x, n.y, n.z];
|
|
135
|
+
}
|
|
136
|
+
function xe(e) {
|
|
137
|
+
const n = ["X", "Y", "Z"];
|
|
138
|
+
let t = 0;
|
|
139
|
+
for (let s = 1; s < e.length; s += 1)
|
|
140
|
+
Math.abs(e[s]) > Math.abs(e[t]) && (t = s);
|
|
141
|
+
const o = e[t];
|
|
142
|
+
return Math.abs(o) < 1 - 1e-9 ? "UP" : `${o < 0 ? "-" : "+"}${n[t]}`;
|
|
143
|
+
}
|
|
144
|
+
function we(e, n) {
|
|
145
|
+
const t = new V();
|
|
146
|
+
t.rotation.setFromQuaternion(new te().fromArray(de(n)));
|
|
147
|
+
const o = new ne(e.length, e.width, e.height), s = new oe({
|
|
148
|
+
color: new O("#102c2d"),
|
|
149
|
+
transparent: !0,
|
|
150
|
+
opacity: 0.045,
|
|
151
|
+
depthWrite: !1
|
|
152
|
+
}), r = new re(o, s);
|
|
153
|
+
r.name = "studio-bounds-preview:mesh";
|
|
154
|
+
const d = new se(
|
|
155
|
+
new ae(o),
|
|
156
|
+
new ie({
|
|
157
|
+
color: new O("#08ddd6"),
|
|
158
|
+
transparent: !0,
|
|
159
|
+
opacity: 0.95,
|
|
160
|
+
depthWrite: !1
|
|
161
|
+
})
|
|
162
|
+
);
|
|
163
|
+
d.name = "studio-bounds-preview:edges", t.add(r, d), t.updateMatrixWorld(!0);
|
|
164
|
+
const u = new G().setFromObject(t);
|
|
165
|
+
t.position.z = -u.min.z, t.updateMatrixWorld(!0);
|
|
166
|
+
const z = new G().setFromObject(t);
|
|
167
|
+
return {
|
|
168
|
+
root: t,
|
|
169
|
+
bounds: z,
|
|
170
|
+
rotation: t.quaternion.clone(),
|
|
171
|
+
translation: t.position.clone()
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
function be(e) {
|
|
175
|
+
const n = e.getSize(new v()), t = Math.max(n.x, n.y, n.z, 1), o = Math.max(4, Math.ceil(t * 4)), s = Math.min(60, Math.max(12, Math.round(o * 5))), r = new ce(o, s, 6713457, 3423036);
|
|
176
|
+
r.name = "studio-bounds-preview:grid", r.rotation.x = Math.PI / 2, r.position.z = -1e-3;
|
|
177
|
+
const d = Array.isArray(r.material) ? r.material : [r.material];
|
|
178
|
+
for (const u of d)
|
|
179
|
+
u.transparent = !0, u.opacity = 0.48, u.depthWrite = !1;
|
|
180
|
+
return r;
|
|
181
|
+
}
|
|
182
|
+
function ye(e, n, t, o, s) {
|
|
183
|
+
o.replaceChildren();
|
|
184
|
+
const r = e.length / 2, d = e.width / 2, u = e.height / 2, i = Math.max(e.length, e.width, e.height) * 0.12, f = (c, y, p) => new v(c, y, p).applyQuaternion(n.rotation).add(n.translation);
|
|
185
|
+
return [
|
|
186
|
+
{
|
|
187
|
+
axis: "X",
|
|
188
|
+
value: e.length,
|
|
189
|
+
start: f(-r, -d - i, -u - i),
|
|
190
|
+
end: f(r, -d - i, -u - i)
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
axis: "Y",
|
|
194
|
+
value: e.width,
|
|
195
|
+
start: f(-r - i, -d, -u - i),
|
|
196
|
+
end: f(-r - i, d, -u - i)
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
axis: "Z",
|
|
200
|
+
value: e.height,
|
|
201
|
+
start: f(r + i, -d - i, -u),
|
|
202
|
+
end: f(r + i, -d - i, u)
|
|
203
|
+
}
|
|
204
|
+
].map((c) => {
|
|
205
|
+
var B;
|
|
206
|
+
const y = ue[c.axis], p = s.createElementNS("http://www.w3.org/2000/svg", "line");
|
|
207
|
+
p.setAttribute("stroke", "#6d7778"), p.setAttribute("stroke-width", "0.8"), p.setAttribute("stroke-dasharray", "4 5"), p.setAttribute("opacity", t ? "0.9" : "0"), o.append(p);
|
|
208
|
+
const x = s.createElement("span");
|
|
209
|
+
return x.textContent = `${c.axis} ${c.value.toFixed(3)} m`, x.hidden = !t, x.style.cssText = [
|
|
210
|
+
"position:absolute",
|
|
211
|
+
"transform:translate(-50%,-50%)",
|
|
212
|
+
"color:" + y,
|
|
213
|
+
'font:12px/1.2 "JetBrains Mono",monospace',
|
|
214
|
+
"white-space:nowrap",
|
|
215
|
+
"text-shadow:0 1px 3px #000,0 0 6px rgba(0,0,0,.9)"
|
|
216
|
+
].join(";"), (B = o.parentElement) == null || B.append(x), { ...c, color: y, line: p, label: x };
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
function U(e, n, t, o) {
|
|
220
|
+
const s = e.clone().project(n);
|
|
221
|
+
return {
|
|
222
|
+
x: (s.x * 0.5 + 0.5) * t,
|
|
223
|
+
y: (-s.y * 0.5 + 0.5) * o,
|
|
224
|
+
visible: s.z >= -1 && s.z <= 1
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
function X(e) {
|
|
228
|
+
e && (e.root.removeFromParent(), Z(e.root));
|
|
229
|
+
}
|
|
230
|
+
function N(e) {
|
|
231
|
+
e && (e.removeFromParent(), Z(e));
|
|
232
|
+
}
|
|
233
|
+
function Z(e) {
|
|
234
|
+
e.traverse((n) => {
|
|
235
|
+
if ("geometry" in n && n.geometry instanceof Object && n.geometry.dispose(), "material" in n) {
|
|
236
|
+
const t = n.material, o = Array.isArray(t) ? t : t ? [t] : [];
|
|
237
|
+
for (const s of o) s.dispose();
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
export {
|
|
242
|
+
Ae as createStudioBoundsPreview,
|
|
243
|
+
ze as createStudioSceneSession
|
|
244
|
+
};
|