@omnidotdev/rdk 0.12.1 → 0.13.0
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/build/engine/useXRStore.d.ts +1 -1
- package/build/engine/useXRStore.d.ts.map +1 -1
- package/build/engine-BBW4dx9u.cjs +1 -0
- package/build/engine-DQC0zTpL.js +11 -0
- package/build/engine.cjs +1 -0
- package/build/engine.d.ts +2 -0
- package/build/engine.js +3 -0
- package/build/fiducial/FiducialSession.d.ts.map +1 -1
- package/build/fiducial/fiducialBackend.d.ts +1 -1
- package/build/fiducial/fiducialBackend.d.ts.map +1 -1
- package/build/{fiducial-DdfnVsvF.cjs → fiducial-Ccrn4lFL.cjs} +1 -1
- package/build/{fiducial-Bi9lhbyN.js → fiducial-DpJVvX22.js} +1 -1
- package/build/fiducial.cjs +1 -1
- package/build/fiducial.js +1 -2
- package/build/geolocation/GeoLine.d.ts +19 -1
- package/build/geolocation/GeoLine.d.ts.map +1 -1
- package/build/geolocation/GeoPolygon.d.ts +14 -1
- package/build/geolocation/GeoPolygon.d.ts.map +1 -1
- package/build/geolocation/GeolocationSession.d.ts.map +1 -1
- package/build/geolocation/geolocationBackend.d.ts +1 -1
- package/build/geolocation/geolocationBackend.d.ts.map +1 -1
- package/build/geolocation-D9FbCT8T.cjs +1 -0
- package/build/{geolocation-Dl910ZC5.js → geolocation-DCMGm6Xo.js} +81 -74
- package/build/geolocation.cjs +1 -1
- package/build/geolocation.js +1 -2
- package/build/immersive/ImmersiveSession.d.ts.map +1 -1
- package/build/{immersive-BTwiipnT.js → immersive-CR4YCvJ0.js} +1 -1
- package/build/{immersive-DKHCJlkN.cjs → immersive-YdcOrh6T.cjs} +1 -1
- package/build/immersive.cjs +1 -1
- package/build/immersive.js +1 -2
- package/build/index.cjs +1 -1
- package/build/index.js +9 -16
- package/build/magic/MagicSession.d.ts.map +1 -1
- package/build/magic/WorldAnchor.d.ts.map +1 -1
- package/build/magic/magicBackend.d.ts +1 -1
- package/build/magic/magicBackend.d.ts.map +1 -1
- package/build/{magic-CPIBm_8-.js → magic-DQmRfsb_.js} +34 -40
- package/build/magic-Dzl9O3jU.cjs +1 -0
- package/build/magic.cjs +1 -1
- package/build/magic.js +1 -2
- package/build/{useXRStore-Dsm1C1fI.js → useXRStore-CousLTRl.js} +42 -42
- package/build/useXRStore-XWI97jRe.cjs +1 -0
- package/build/vision/VisionSession.d.ts.map +1 -1
- package/build/vision/visionBackend.d.ts +1 -1
- package/build/vision/visionBackend.d.ts.map +1 -1
- package/build/{vision-sMKG7-na.cjs → vision-Ci0b3-oF.cjs} +1 -1
- package/build/{vision-Bdhf3N-w.js → vision-DPLI9maM.js} +1 -1
- package/build/vision.cjs +1 -1
- package/build/vision.js +1 -2
- package/package.json +12 -6
- package/build/geolocation-CT1kLdSh.cjs +0 -1
- package/build/magic-CWhj_WTi.cjs +0 -1
- package/build/useXRStore-8Vl3wsP5.cjs +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { XRStore as ReactThreeXRStore } from '@react-three/xr';
|
|
2
|
-
import { Backend, BackendType } from 'lib/types/engine';
|
|
3
2
|
import { Camera, Scene, WebGLRenderer } from 'three';
|
|
3
|
+
import { Backend, BackendType } from '../lib/types/engine';
|
|
4
4
|
interface BaseXRStoreState {
|
|
5
5
|
/** Shared video element. */
|
|
6
6
|
video?: HTMLVideoElement | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useXRStore.d.ts","sourceRoot":"","sources":["../../src/engine/useXRStore.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useXRStore.d.ts","sourceRoot":"","sources":["../../src/engine/useXRStore.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE/D,UAAU,gBAAgB;IACxB,4BAA4B;IAC5B,KAAK,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAChC,8CAA8C;IAC9C,QAAQ,EAAE,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IACpC,6CAA6C;IAC7C,cAAc,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;CAC3C;AAED,UAAU,kBAAkB;IAC1B,+CAA+C;IAC/C,eAAe,EAAE,CACf,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,aAAa,CAAA;KAAE,KACjE,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,iDAAiD;IACjD,iBAAiB,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC9C,gCAAgC;IAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,KAAK,IAAI,CAAC;IACnD,yDAAyD;IACzD,cAAc,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,oCAAoC;IACpC,iBAAiB,EAAE,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,KAAK,IAAI,CAAC;CAC9D;AAED,KAAK,WAAW,GAAG,gBAAgB,GAAG,kBAAkB,CAAC;AAEzD,MAAM,MAAM,OAAO,GAAG,WAAW,GAAG;IAClC,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,iBAAiB,GAAG,IAAI,CAAC;CACrC,CAAC;AA0FF,eAAO,MAAM,UAAU,mBAAkC,CAAC;AAC1D,eAAO,MAAM,kBAAkB;;;;;;CAA2B,CAAC;AAE3D;;GAEG;AACH,QAAA,MAAM,UAAU,GAAI,CAAC,GAAG,OAAO,EAAE,WAAW,CAAC,KAAK,EAAE,OAAO,KAAK,CAAC,KAc5C,CACpB,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./useXRStore-XWI97jRe.cjs`);let t=require(`@react-three/fiber`);var n=({children:n})=>{let{updateBackends:r}=e.r();return(0,t.useFrame)((e,t)=>{r(t)}),n};Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return n}});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { r as e } from "./useXRStore-CousLTRl.js";
|
|
2
|
+
import { useFrame as t } from "@react-three/fiber";
|
|
3
|
+
//#region src/engine/XR.tsx
|
|
4
|
+
var n = ({ children: n }) => {
|
|
5
|
+
let { updateBackends: r } = e();
|
|
6
|
+
return t((e, t) => {
|
|
7
|
+
r(t);
|
|
8
|
+
}), n;
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { n as t };
|
package/build/engine.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./useXRStore-XWI97jRe.cjs`),t=require(`./engine-BBW4dx9u.cjs`);exports.XR=t.t,exports.getXRStore=e.t,exports.subscribeToXRStore=e.n,exports.useXRStore=e.r;
|
package/build/engine.js
ADDED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FiducialSession.d.ts","sourceRoot":"","sources":["../../src/fiducial/FiducialSession.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"FiducialSession.d.ts","sourceRoot":"","sources":["../../src/fiducial/FiducialSession.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG/C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAEhE,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC7D,gCAAgC;IAChC,OAAO,CAAC,EAAE,sBAAsB,CAAC;CAClC;AAED;;;GAGG;AACH,QAAA,MAAM,eAAe,GAAI,uBAA4B,oBAAoB,8BA4CxE,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fiducialBackend.d.ts","sourceRoot":"","sources":["../../src/fiducial/fiducialBackend.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,eAAe,EAChB,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"fiducialBackend.d.ts","sourceRoot":"","sources":["../../src/fiducial/fiducialBackend.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,eAAe,EAChB,MAAM,2CAA2C,CAAC;AAMnD,OAAO,KAAK,EAAE,OAAO,EAAmB,MAAM,oBAAoB,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,eAAe,GAAG,IAAI,CAAC;IACjC,SAAS,EAAE,gBAAgB,GAAG,IAAI,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAC5D,iEAAiE;IACjE,SAAS,EAAE,OAAO,CAAC;IACnB,2DAA2D;IAC3D,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,sBAAsB;IACrC,yBAAyB;IACzB,UAAU,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC;IAC1C,6BAA6B;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,sBAAsB;IACtB,aAAa,CAAC,EAAE,OAAO,GAAG,kBAAkB,GAAG,MAAM,GAAG,iBAAiB,CAAC;IAC1E,qBAAqB;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wBAAwB;IACxB,cAAc,CAAC,EACX,KAAK,GACL,eAAe,GACf,cAAc,GACd,KAAK,GACL,gBAAgB,GAChB,gBAAgB,CAAC;CACtB;AAED;;GAEG;AACH,QAAA,MAAM,qBAAqB,GACzB,UAAU,sBAAsB,KAC/B,OAAO,CAAC,gBAAgB,CA+I1B,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./useXRStore-
|
|
1
|
+
const e=require(`./useXRStore-XWI97jRe.cjs`);let t=require(`react`),n=require(`@react-three/fiber`),r=require(`@ar-js-org/ar.js/three.js/build/ar-threex`),i=require(`react/jsx-runtime`);var a={isPending:!0,isSuccess:!1,arSource:null,arContext:null},o=()=>{let t=e.r(e=>e.backends).get(e.i.FIDUCIAL);return t?{...t.getInternal(),isPending:!1,isSuccess:!0}:a},s=({patternUrl:e,barcodeValue:a,params:s,onMarkerFound:c,onMarkerLost:l,children:u})=>{let d=(0,t.useRef)(null),f=o(),p=(0,t.useRef)(!1),m=(0,t.useRef)(!1),h=(0,t.useRef)(null);return(0,t.useEffect)(()=>{if(!f.isSuccess)return;let t=!1;return(()=>{try{let{arContext:n}=f,i=d.current;if(!n||!i||t)return;if(i.visible=!1,m.current=!1,!n.arController){requestAnimationFrame(()=>{!d.current||t||!f.arContext?.arController||(h.current=new r.ArMarkerControls(f.arContext,d.current,{type:e?`pattern`:a?`barcode`:`unknown`,patternUrl:e,barcodeValue:a,...s}),m.current=!0)});return}h.current=new r.ArMarkerControls(n,i,{type:e?`pattern`:a?`barcode`:`unknown`,patternUrl:e,barcodeValue:a,...s}),m.current=!0}catch(e){console.error(`Failed to initialize fiducial anchor:`,e)}})(),()=>{t=!0;let e=h.current;typeof e?.dispose==`function`&&e.dispose(),m.current=!1}},[f.isSuccess,f.arContext,e,a,s,f]),(0,n.useFrame)(()=>{let e=d.current;if(!e||!m.current){e&&(e.visible=!1);return}let t=e.visible;t&&!p.current?(p.current=!0,c?.()):!t&&p.current&&(p.current=!1,l?.())}),(0,i.jsx)(`group`,{ref:d,visible:!1,children:u})},c=({options:r={},children:i})=>{let{scene:a,camera:o,gl:s}=(0,n.useThree)(),{registerBackend:c,unregisterBackend:u}=e.r(),d=(0,t.useRef)(null),f=(0,t.useRef)(r);return f.current=r,(0,t.useEffect)(()=>{if(d.current)return;let e=!1;return(async()=>{try{let t=l(f.current);if(e)return;await c(t,{scene:a,camera:o,renderer:s}),d.current=t}catch(e){console.error(`[FiducialSession] Failed to initialize:`,e)}})(),()=>{e=!0,d.current&&=(u(d.current),null)}},[a,o,s,c,u]),i},l=t=>{let n=null,i=null,a=null,o;return{type:e.i.FIDUCIAL,async init({camera:e,renderer:s}){n=new r.ArToolkitSource({sourceType:t?.sourceType??`webcam`}),await new Promise((e,t)=>{let r=setTimeout(()=>{t(Error(`AR source initialization timeout`))},1e4);n?.init(()=>{clearTimeout(r);let t=n?.domElement;t&&(t.style.position=`fixed`,t.style.top=`0`,t.style.left=`0`,t.style.width=`100vw`,t.style.height=`100vh`,t.style.objectFit=`cover`,t.style.zIndex=`-1`,t.style.pointerEvents=`none`),e()})}),i=new r.ArToolkitContext({cameraParametersUrl:t?.cameraParametersUrl??new URL(`data:application/octet-stream;base64,AAACgAAAAeBAgwrsW6bUSwAAAAAAAAAAQHQ3KqAAAAAAAAAAAAAAAAAAAAAAAAAAQIL0K3dHyf9AbbNowAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/wAAAAAAAAAAAAAAAAAAA/uWNa4AAAAL+3lTLAAAAAv17YFWAAAAA/VYLXIAAAAECCe0YgAAAAQIJlMOAAAABAdDcqoAAAAEBts2jAAAAAP+8OmzqkDy4=`,``+{}.url).toString(),detectionMode:t?.detectionMode??`mono`,patternRatio:t?.patternRatio??.5,matrixCodeType:t?.matrixCodeType??`3x3`}),a=e;let c=()=>{n?.onResizeElement();let e=window.innerWidth,t=window.innerHeight;s.setSize(e,t,!1),n?.copyElementSizeTo(s.domElement),i?.arController&&n?.copyElementSizeTo(i.arController.canvas)};await new Promise((t,n)=>{let r=setTimeout(()=>{n(Error(`AR context initialization timeout`))},1e4);i?.init(()=>{clearTimeout(r);try{let n=i?.getProjectionMatrix();n&&e.projectionMatrix.copy(n),c(),t()}catch(e){n(e)}})}),window.addEventListener(`resize`,c),o=c},update(){if(!(!n||!i)&&!(!n.ready||!n.domElement))try{i.update(n.domElement);let e=i.getProjectionMatrix?.();a&&e&&a.projectionMatrix.copy(e)}catch(e){console.warn(`AR.js update error:`,e)}},dispose(){if(o&&=(window.removeEventListener(`resize`,o),void 0),i&&typeof i.dispose==`function`&&i.dispose(),n?.domElement){let e=n.domElement.parentNode;e&&e.removeChild(n.domElement)}n=null,i=null,a=null},getInternal:()=>({arSource:n,arContext:i})}};Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return l}});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as e, r as t } from "./useXRStore-
|
|
1
|
+
import { i as e, r as t } from "./useXRStore-CousLTRl.js";
|
|
2
2
|
import { useEffect as n, useRef as r } from "react";
|
|
3
3
|
import { useFrame as i, useThree as a } from "@react-three/fiber";
|
|
4
4
|
import { ArMarkerControls as o, ArToolkitContext as s, ArToolkitSource as c } from "@ar-js-org/ar.js/three.js/build/ar-threex";
|
package/build/fiducial.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`})
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./fiducial-Ccrn4lFL.cjs`);exports.FiducialAnchor=e.r,exports.FiducialSession=e.n,exports.createFiducialBackend=e.t,exports.useFiducialBackend=e.i;
|
package/build/fiducial.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import { i as e, n as t, r as n, t as r } from "./fiducial-Bi9lhbyN.js";
|
|
1
|
+
import { i as e, n as t, r as n, t as r } from "./fiducial-DpJVvX22.js";
|
|
3
2
|
export { n as FiducialAnchor, t as FiducialSession, r as createFiducialBackend, e as useFiducialBackend };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ThreeEvent } from '@react-three/fiber';
|
|
1
2
|
import { ColorRepresentation } from 'three';
|
|
2
3
|
export interface GeoLineProps {
|
|
3
4
|
/** Array of coordinates forming the line. GeoJSON-style: [lon, lat, elevation?] */
|
|
@@ -27,12 +28,29 @@ export interface GeoLineProps {
|
|
|
27
28
|
* @default 1
|
|
28
29
|
*/
|
|
29
30
|
gapSize?: number;
|
|
31
|
+
/**
|
|
32
|
+
* Click event handler. When omitted, the line is not registered for pointer raycasting.
|
|
33
|
+
*/
|
|
34
|
+
onClick?: (e: ThreeEvent<MouseEvent>) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Pointer out event handler. When omitted, the line is not registered for pointer raycasting.
|
|
37
|
+
*/
|
|
38
|
+
onPointerOut?: (e: ThreeEvent<PointerEvent>) => void;
|
|
39
|
+
/**
|
|
40
|
+
* Pointer over event handler. When omitted, the line is not registered for pointer raycasting.
|
|
41
|
+
*/
|
|
42
|
+
onPointerOver?: (e: ThreeEvent<PointerEvent>) => void;
|
|
43
|
+
/**
|
|
44
|
+
* Opacity
|
|
45
|
+
* @default 1
|
|
46
|
+
*/
|
|
47
|
+
opacity?: number;
|
|
30
48
|
}
|
|
31
49
|
/**
|
|
32
50
|
* Geolocation line component for rendering lines in AR space. Useful for e.g. roads, paths, and routes.
|
|
33
51
|
* Uses triangle-strip meshes for smooth rendering. Falls back to Line2 when dashing is enabled.
|
|
34
52
|
* Accepts an array of lon/lat coordinates in GeoJSON-style format.
|
|
35
53
|
*/
|
|
36
|
-
declare const GeoLine: ({ coordinates, color, isDashed, dashSize, gapSize, lineWidth, }: GeoLineProps) => import("react").JSX.Element;
|
|
54
|
+
declare const GeoLine: ({ coordinates, color, isDashed, dashSize, gapSize, lineWidth, onClick, onPointerOut, onPointerOver, opacity, }: GeoLineProps) => import("react").JSX.Element;
|
|
37
55
|
export default GeoLine;
|
|
38
56
|
//# sourceMappingURL=GeoLine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeoLine.d.ts","sourceRoot":"","sources":["../../src/geolocation/GeoLine.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GeoLine.d.ts","sourceRoot":"","sources":["../../src/geolocation/GeoLine.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAEjD,MAAM,WAAW,YAAY;IAC3B,mFAAmF;IACnF,WAAW,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IAC9C;;;OAGG;IACH,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IAC9C;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;IACrD;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;IACtD;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AA+DD;;;;GAIG;AACH,QAAA,MAAM,OAAO,GAAI,gHAWd,YAAY,gCAuGd,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ThreeEvent } from '@react-three/fiber';
|
|
1
2
|
export interface GeoPolygonProps {
|
|
2
3
|
/** Outer ring coordinates. GeoJSON-style: [lon, lat, elevation?] */
|
|
3
4
|
coordinates: Array<[number, number, number?]>;
|
|
@@ -20,6 +21,18 @@ export interface GeoPolygonProps {
|
|
|
20
21
|
* @default false
|
|
21
22
|
*/
|
|
22
23
|
isWireframe?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Click event handler. When omitted, the polygon is not registered for pointer raycasting.
|
|
26
|
+
*/
|
|
27
|
+
onClick?: (e: ThreeEvent<MouseEvent>) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Pointer out event handler. When omitted, the polygon is not registered for pointer raycasting.
|
|
30
|
+
*/
|
|
31
|
+
onPointerOut?: (e: ThreeEvent<PointerEvent>) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Pointer over event handler. When omitted, the polygon is not registered for pointer raycasting.
|
|
34
|
+
*/
|
|
35
|
+
onPointerOver?: (e: ThreeEvent<PointerEvent>) => void;
|
|
23
36
|
/**
|
|
24
37
|
* Side to render: front, back, or double.
|
|
25
38
|
* @default "double"
|
|
@@ -30,6 +43,6 @@ export interface GeoPolygonProps {
|
|
|
30
43
|
* Geolocation polygon component for rendering filled areas in AR space.
|
|
31
44
|
* Accepts an array of lon/lat coordinates in GeoJSON-style format.
|
|
32
45
|
*/
|
|
33
|
-
declare const GeoPolygon: ({ coordinates, holes, color, opacity, isWireframe, side, }: GeoPolygonProps) => import("react").JSX.Element;
|
|
46
|
+
declare const GeoPolygon: ({ coordinates, holes, color, opacity, isWireframe, onClick, onPointerOut, onPointerOver, side, }: GeoPolygonProps) => import("react").JSX.Element;
|
|
34
47
|
export default GeoPolygon;
|
|
35
48
|
//# sourceMappingURL=GeoPolygon.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeoPolygon.d.ts","sourceRoot":"","sources":["../../src/geolocation/GeoPolygon.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GeoPolygon.d.ts","sourceRoot":"","sources":["../../src/geolocation/GeoPolygon.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIrD,MAAM,WAAW,eAAe;IAC9B,oEAAoE;IACpE,WAAW,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IAC9C;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAChD;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IAC9C;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;IACrD;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;IACtD;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;CACpC;AAQD;;;GAGG;AACH,QAAA,MAAM,UAAU,GAAI,kGAUjB,eAAe,gCAmIjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeolocationSession.d.ts","sourceRoot":"","sources":["../../src/geolocation/GeolocationSession.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"GeolocationSession.d.ts","sourceRoot":"","sources":["../../src/geolocation/GeolocationSession.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG/C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEtE,MAAM,WAAW,uBAAwB,SAAQ,iBAAiB;IAChE,mCAAmC;IACnC,OAAO,CAAC,EAAE,yBAAyB,CAAC;CACrC;AAED;;;GAGG;AACH,QAAA,MAAM,kBAAkB,GAAI,wBAGzB,uBAAuB,8BA4CzB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Backend } from 'lib/types/engine';
|
|
2
1
|
import { DeviceOrientationControls, LocAR, Webcam } from 'locar';
|
|
3
2
|
import { Camera, Group, Scene } from 'three';
|
|
3
|
+
import { Backend } from '../lib/types/engine';
|
|
4
4
|
/**
|
|
5
5
|
* GPS update event structure emitted by LocAR.
|
|
6
6
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geolocationBackend.d.ts","sourceRoot":"","sources":["../../src/geolocation/geolocationBackend.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"geolocationBackend.d.ts","sourceRoot":"","sources":["../../src/geolocation/geolocationBackend.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,yBAAyB,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,KAAK,EACV,MAAM,EACN,KAAK,EAEL,KAAK,EAEN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,OAAO,EAAmB,MAAM,oBAAoB,CAAC;AAEnE;;GAEG;AAEH,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,KAAK,CAAC;IACd,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,8FAA8F;IAC9F,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAClC,WAAW,CAAC,EAAE,CAAC,QAAQ,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1E;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,iBAAiB,EAAE,yBAAyB,GAAG,IAAI,CAAC;IACpD,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,+BAA+B;IAC/B,YAAY,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACzC,2CAA2C;IAC3C,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IACzD,6CAA6C;IAC7C,gBAAgB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,iCAAiC;IACjC,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,WAAW,GAAG,SAAS,CAAC;CACpD;AAED;;GAEG;AACH,MAAM,WAAW,uBAAwB,SAAQ,mBAAmB;IAClE,iEAAiE;IACjE,SAAS,EAAE,OAAO,CAAC;IACnB,2DAA2D;IAC3D,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,2EAA2E;IAC3E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iCAAiC;IACjC,iBAAiB,CAAC,EAAE,sBAAsB,CAAC;IAC3C;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,QAAQ,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9E;AAED;;GAEG;AACH,QAAA,MAAM,wBAAwB,GAC5B,UAAU,yBAAyB,KAClC,OAAO,CAAC,mBAAmB,CA0O7B,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./useXRStore-XWI97jRe.cjs`);let t=require(`react`),n=require(`@react-three/fiber`),r=require(`react/jsx-runtime`),i=require(`three`),a=require(`three/addons/lines/Line2.js`),o=require(`three/addons/lines/LineGeometry.js`),s=require(`three/addons/lines/LineMaterial.js`),c=require(`locar`);var l={isPending:!0,isSuccess:!1,locar:null,webcam:null,deviceOrientation:null,scene:null,camera:null,lastPosition:null,registerAnchor:()=>{},unregisterAnchor:()=>{},getAnchor:()=>void 0},u=()=>{let t=e.r(e=>e.backends).get(e.i.GEOLOCATION);return t?{...t.getInternal(),isPending:!1,isSuccess:!0}:l},d=(e,t)=>{let n=e.length-1,r=[],a=0,o=0;for(let i=0;i<n;i++){let n=e[i+1].x-e[i].x,s=e[i+1].y-e[i].y,c=e[i+1].z-e[i].z,l=Math.sqrt(n*n+s*s+c*c),u=t/2,d=-(c*u)/l,f=n*u/l,p=i>0?(d+a)/2:d,m=i>0?(f+o)/2:f;r.push(e[i].x-p,e[i].y,e[i].z-m,e[i].x+p,e[i].y,e[i].z+m),a=d,o=f}r.push(e[n].x-a,e[n].y,e[n].z-o,e[n].x+a,e[n].y,e[n].z+o);let s=[];for(let e=0;e<n;e++)s.push(e*2,e*2+1,e*2+2),s.push(e*2+1,e*2+3,e*2+2);let c=new i.BufferGeometry;return c.setIndex(s),c.setAttribute(`position`,new i.BufferAttribute(new Float32Array(r),3)),c.computeBoundingBox(),c},f=({coordinates:e,color:c=`#ff0000`,isDashed:l=!1,dashSize:f=3,gapSize:p=1,lineWidth:m=1,onClick:h,onPointerOut:g,onPointerOver:_,opacity:v=1})=>{let y=u(),b=(0,t.useRef)(y);b.current=y;let[x]=(0,t.useState)(()=>new i.Group),S=(0,t.useMemo)(()=>Math.random().toString(36).slice(2,11),[]),[C,w]=(0,t.useState)(null);return(0,t.useEffect)(()=>{if(!y.isSuccess||e.length<2)return;let[t,n,r=0]=e[0];return b.current.registerAnchor(S,{anchor:x,isAttached:!1,latitude:n,longitude:t,altitude:r,onAttach:t=>{let[n,r,u=0]=e[0],[h,g]=t.lonLatToWorldCoords(n,r),_=e.map(([e,n,r=0])=>{let[a,o]=t.lonLatToWorldCoords(e,n);return new i.Vector3(a-h,r-u,o-g)});if(l){let e=new a.Line2(new o.LineGeometry().setFromPoints(_),new s.LineMaterial({color:c,dashSize:f,gapSize:p,dashed:!0,worldUnits:!0,linewidth:m,transparent:v<1,opacity:v}));e.computeLineDistances(),w(e)}else w(new i.Mesh(d(_,m),new i.MeshBasicMaterial({color:c,transparent:v<1,opacity:v,side:i.DoubleSide})))}}),()=>{b.current.unregisterAnchor(S),w(e=>(e&&(e.geometry.dispose(),e.material.dispose()),null))}},[S,x,e,c,l,f,p,m,v,y.isSuccess]),(0,n.createPortal)((0,r.jsx)(`group`,{onClick:h,onPointerOut:g,onPointerOver:_,children:C&&(0,r.jsx)(`primitive`,{object:C})}),x)},p=({latitude:e,longitude:a,altitude:o=0,isBillboard:s=!0,onAttach:c,onGpsUpdate:l,children:d})=>{let f=u(),p=(0,t.useRef)(f);p.current=f;let{camera:m}=(0,n.useThree)(),[h]=(0,t.useState)(()=>new i.Group),g=(0,t.useMemo)(()=>Math.random().toString(36).slice(2,11),[]),_=(0,t.useCallback)(()=>{c?.()},[c]),v=(0,t.useCallback)((e,t)=>{l?.(e,t)},[l]);return(0,t.useEffect)(()=>{if(f.isSuccess)return p.current.registerAnchor(g,{anchor:h,isAttached:!1,latitude:e,longitude:a,altitude:o,onAttach:_,onGpsUpdate:v}),()=>{p.current.unregisterAnchor(g)}},[h,g,e,a,o,_,v,f.isSuccess]),(0,n.useFrame)(()=>{!s||!m||!f.isSuccess||f.getAnchor(g)?.isAttached&&h.lookAt(m.position)}),(0,n.createPortal)((0,r.jsx)(`group`,{children:d}),h)},m=({options:r={},children:i})=>{let{scene:a,camera:o,gl:s}=(0,n.useThree)(),{registerBackend:c,unregisterBackend:l}=e.r(),u=(0,t.useRef)(null),d=(0,t.useRef)(r);return d.current=r,(0,t.useEffect)(()=>{if(u.current)return;let e=!1;return(async()=>{try{let t=_(d.current);if(e)return;await c(t,{scene:a,camera:o,renderer:s}),u.current=t}catch(e){console.error(`[GeolocationSession] Failed to initialize:`,e)}})(),()=>{e=!0,u.current&&=(l(u.current),null)}},[a,o,s,c,l]),i},h={front:i.FrontSide,back:i.BackSide,double:i.DoubleSide},g=({coordinates:e,holes:a,color:o=`#ff0000`,opacity:s=1,isWireframe:c=!1,onClick:l,onPointerOut:d,onPointerOver:f,side:p=`double`})=>{let m=u(),g=(0,t.useRef)(m);g.current=m;let[_]=(0,t.useState)(()=>new i.Group),v=(0,t.useMemo)(()=>Math.random().toString(36).slice(2,11),[]),[y,b]=(0,t.useState)(null);return(0,t.useEffect)(()=>{if(!m.isSuccess||e.length<3)return;let[t,n,r=0]=e[0];return g.current.registerAnchor(v,{anchor:_,isAttached:!1,latitude:n,longitude:t,altitude:r,onAttach:t=>{let[n,r,o=0]=e[0],[s,c]=t.lonLatToWorldCoords(n,r),l=[];for(let[n,r,i=0]of e){let[e,a]=t.lonLatToWorldCoords(n,r);l.push({x:e-s,z:a-c,elev:i-o})}let u=new i.Shape;u.moveTo(l[0].x,l[0].z);for(let e=1;e<l.length;e++)u.lineTo(l[e].x,l[e].z);if(u.closePath(),a&&a.length>0)for(let e of a){if(e.length<3)continue;let n=new i.Path,[r,a]=e[0],[o,l]=t.lonLatToWorldCoords(r,a);n.moveTo(o-s,l-c);for(let r=1;r<e.length;r++){let[i,a]=e[r],[o,l]=t.lonLatToWorldCoords(i,a);n.lineTo(o-s,l-c)}n.closePath(),u.holes.push(n)}let d=new i.ShapeGeometry(u),f=l.reduce((e,t)=>e+t.elev,0)/l.length;d.rotateX(-Math.PI/2),b({geometry:d,avgElevation:f})}}),()=>{g.current.unregisterAnchor(v),b(e=>(e&&e.geometry.dispose(),null))}},[v,_,e,a,m.isSuccess]),(0,n.createPortal)((0,r.jsx)(`group`,{children:y&&(0,r.jsx)(`group`,{position:[0,y.avgElevation,0],children:(0,r.jsx)(`mesh`,{geometry:y.geometry,onClick:l,onPointerOut:d,onPointerOver:f,children:(0,r.jsx)(`meshBasicMaterial`,{color:o,opacity:s,transparent:s<1,wireframe:c,side:h[p]})})})}),_)},_=t=>{let n=null,r=null,i=null,a=null,o=null,s=null,l=new Map,u=null,d=e=>{if(!(!r||e.isAttached))try{r.add(e.anchor,e.longitude,e.latitude,e.altitude),e.isAttached=!0,e.onAttach?.(r)}catch(e){console.error(`❌ Failed to attach anchor:`,e)}},f=(e,t)=>{l.set(e,t),u!==null&&!t.isAttached&&(d(t),t.onGpsUpdate?.(u,0))},p=e=>{let t=l.get(e);if(t?.isAttached)try{t.anchor.removeFromParent()}catch(t){console.error(`⚠️ Error removing anchor ${e}:`,t)}l.delete(e)},m=e=>l.get(e);return{type:e.i.GEOLOCATION,async init(e){let{camera:f,renderer:p,scene:m}=e;if(!m)throw Error(`[geolocationBackend] A THREE.Scene is required for location-based AR`);a=f,o=p,s=m,n=new c.App({threeObjects:{camera:f,renderer:p,scene:m},videoConstraints:t?.webcamConstraints??{video:{facingMode:`environment`}},deviceOrientationOptions:{enabled:!0}}),p.setClearAlpha?.(0),i=e=>{u=e.position;for(let t of l.values())t.isAttached||d(t),t.onGpsUpdate?.(e.position,e.distMoved);t?.onGpsUpdate?.(e.position,e.distMoved)},r=await n.start();let h=n.deviceOrientationControls;if(h&&h.orientationChangeEventName!==`deviceorientation`)try{h.disconnect(),h.orientationChangeEventName=`deviceorientation`,h.connect()}catch(e){console.error(`[geolocationBackend] failed to rebind device orientation event:`,e)}r.on(`gpsupdate`,i),n.webcam?.on?.(`webcamerror`,e=>{console.error(`[geolocationBackend] webcam error:`,e)}),n.deviceOrientationControls?.on?.(`deviceorientationerror`,e=>{console.error(`[geolocationBackend] Device orientation error:`,e)}),r.on(`gpserror`,e=>{console.error(`[geolocationBackend] gps error:`,e)}),r.startGps(),typeof t?.fakeLat==`number`&&typeof t?.fakeLon==`number`&&r.fakeGps(t.fakeLon,t.fakeLat);let g=r.getLastKnownLocation();g!==null&&(u={coords:{longitude:g.longitude,latitude:g.latitude,accuracy:0,altitude:null,altitudeAccuracy:null,heading:null,speed:null,toJSON:()=>g},timestamp:Date.now(),toJSON:()=>g})},update(){n?.deviceOrientationControls?.update?.()},dispose(){r&&i&&r.off(`gpsupdate`,i),r?.stopGps?.(),n?.webcam?.dispose?.(),o?.setClearAlpha?.(1),n?.deviceOrientationControls?.dispose?.();for(let e of l.values())if(e.isAttached)try{e.anchor.removeFromParent()}catch(e){console.error(`⚠️ Error removing anchor:`,e)}l.clear(),n=null,r=null,a=null,o=null,s=null,i=null,u=null},getInternal:()=>({locar:r,webcam:n?.webcam??null,deviceOrientation:n?.deviceOrientationControls??null,scene:s,camera:a,lastPosition:u,registerAnchor:f,unregisterAnchor:p,getAnchor:m})}};Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return _}});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as e, r as t } from "./useXRStore-
|
|
1
|
+
import { i as e, r as t } from "./useXRStore-CousLTRl.js";
|
|
2
2
|
import { useCallback as n, useEffect as r, useMemo as i, useRef as a, useState as o } from "react";
|
|
3
3
|
import { createPortal as s, useFrame as c, useThree as l } from "@react-three/fiber";
|
|
4
4
|
import { jsx as u } from "react/jsx-runtime";
|
|
@@ -38,15 +38,15 @@ var D = {
|
|
|
38
38
|
for (let e = 0; e < n; e++) o.push(e * 2, e * 2 + 1, e * 2 + 2), o.push(e * 2 + 1, e * 2 + 3, e * 2 + 2);
|
|
39
39
|
let s = new p();
|
|
40
40
|
return s.setIndex(o), s.setAttribute("position", new f(new Float32Array(r), 3)), s.computeBoundingBox(), s;
|
|
41
|
-
}, A = ({ coordinates: e, color: t = "#ff0000", isDashed: n = !1, dashSize: c = 3, gapSize: l = 1, lineWidth: d = 1 }) => {
|
|
42
|
-
let
|
|
43
|
-
|
|
44
|
-
let [
|
|
41
|
+
}, A = ({ coordinates: e, color: t = "#ff0000", isDashed: n = !1, dashSize: c = 3, gapSize: l = 1, lineWidth: d = 1, onClick: f, onPointerOut: p, onPointerOver: h, opacity: y = 1 }) => {
|
|
42
|
+
let b = O(), x = a(b);
|
|
43
|
+
x.current = b;
|
|
44
|
+
let [E] = o(() => new g()), D = i(() => Math.random().toString(36).slice(2, 11), []), [A, j] = o(null);
|
|
45
45
|
return r(() => {
|
|
46
|
-
if (!
|
|
46
|
+
if (!b.isSuccess || e.length < 2) return;
|
|
47
47
|
let [r, i, a = 0] = e[0];
|
|
48
|
-
return
|
|
49
|
-
anchor:
|
|
48
|
+
return x.current.registerAnchor(D, {
|
|
49
|
+
anchor: E,
|
|
50
50
|
isAttached: !1,
|
|
51
51
|
latitude: i,
|
|
52
52
|
longitude: r,
|
|
@@ -63,28 +63,38 @@ var D = {
|
|
|
63
63
|
gapSize: l,
|
|
64
64
|
dashed: !0,
|
|
65
65
|
worldUnits: !0,
|
|
66
|
-
linewidth: d
|
|
66
|
+
linewidth: d,
|
|
67
|
+
transparent: y < 1,
|
|
68
|
+
opacity: y
|
|
67
69
|
}));
|
|
68
|
-
e.computeLineDistances(),
|
|
69
|
-
} else
|
|
70
|
+
e.computeLineDistances(), j(e);
|
|
71
|
+
} else j(new _(k(f, d), new v({
|
|
70
72
|
color: t,
|
|
73
|
+
transparent: y < 1,
|
|
74
|
+
opacity: y,
|
|
71
75
|
side: m
|
|
72
76
|
})));
|
|
73
77
|
}
|
|
74
78
|
}), () => {
|
|
75
|
-
|
|
79
|
+
x.current.unregisterAnchor(D), j((e) => (e && (e.geometry.dispose(), e.material.dispose()), null));
|
|
76
80
|
};
|
|
77
81
|
}, [
|
|
78
|
-
|
|
79
|
-
|
|
82
|
+
D,
|
|
83
|
+
E,
|
|
80
84
|
e,
|
|
81
85
|
t,
|
|
82
86
|
n,
|
|
83
87
|
c,
|
|
84
88
|
l,
|
|
85
89
|
d,
|
|
86
|
-
|
|
87
|
-
|
|
90
|
+
y,
|
|
91
|
+
b.isSuccess
|
|
92
|
+
]), s(/* @__PURE__ */ u("group", {
|
|
93
|
+
onClick: f,
|
|
94
|
+
onPointerOut: p,
|
|
95
|
+
onPointerOver: h,
|
|
96
|
+
children: A && /* @__PURE__ */ u("primitive", { object: A })
|
|
97
|
+
}), E);
|
|
88
98
|
}, j = ({ latitude: e, longitude: t, altitude: d = 0, isBillboard: f = !0, onAttach: p, onGpsUpdate: m, children: h }) => {
|
|
89
99
|
let _ = O(), v = a(_);
|
|
90
100
|
v.current = _;
|
|
@@ -148,15 +158,15 @@ var D = {
|
|
|
148
158
|
front: h,
|
|
149
159
|
back: d,
|
|
150
160
|
double: m
|
|
151
|
-
}, P = ({ coordinates: e, holes: t, color: n = "#ff0000", opacity: c = 1, isWireframe: l = !1,
|
|
152
|
-
let
|
|
153
|
-
|
|
154
|
-
let [
|
|
161
|
+
}, P = ({ coordinates: e, holes: t, color: n = "#ff0000", opacity: c = 1, isWireframe: l = !1, onClick: d, onPointerOut: f, onPointerOver: p, side: m = "double" }) => {
|
|
162
|
+
let h = O(), _ = a(h);
|
|
163
|
+
_.current = h;
|
|
164
|
+
let [v] = o(() => new g()), S = i(() => Math.random().toString(36).slice(2, 11), []), [C, w] = o(null);
|
|
155
165
|
return r(() => {
|
|
156
|
-
if (!
|
|
166
|
+
if (!h.isSuccess || e.length < 3) return;
|
|
157
167
|
let [n, r, i = 0] = e[0];
|
|
158
|
-
return
|
|
159
|
-
anchor:
|
|
168
|
+
return _.current.registerAnchor(S, {
|
|
169
|
+
anchor: v,
|
|
160
170
|
isAttached: !1,
|
|
161
171
|
latitude: r,
|
|
162
172
|
longitude: n,
|
|
@@ -185,130 +195,127 @@ var D = {
|
|
|
185
195
|
t.closePath(), l.holes.push(t);
|
|
186
196
|
}
|
|
187
197
|
let u = new x(l), d = c.reduce((e, t) => e + t.elev, 0) / c.length;
|
|
188
|
-
u.rotateX(-Math.PI / 2),
|
|
198
|
+
u.rotateX(-Math.PI / 2), w({
|
|
189
199
|
geometry: u,
|
|
190
200
|
avgElevation: d
|
|
191
201
|
});
|
|
192
202
|
}
|
|
193
203
|
}), () => {
|
|
194
|
-
|
|
204
|
+
_.current.unregisterAnchor(S), w((e) => (e && e.geometry.dispose(), null));
|
|
195
205
|
};
|
|
196
206
|
}, [
|
|
197
|
-
|
|
198
|
-
|
|
207
|
+
S,
|
|
208
|
+
v,
|
|
199
209
|
e,
|
|
200
210
|
t,
|
|
201
|
-
|
|
202
|
-
]), s(/* @__PURE__ */ u("group", { children:
|
|
211
|
+
h.isSuccess
|
|
212
|
+
]), s(/* @__PURE__ */ u("group", { children: C && /* @__PURE__ */ u("group", {
|
|
203
213
|
position: [
|
|
204
214
|
0,
|
|
205
|
-
|
|
215
|
+
C.avgElevation,
|
|
206
216
|
0
|
|
207
217
|
],
|
|
208
218
|
children: /* @__PURE__ */ u("mesh", {
|
|
209
|
-
geometry:
|
|
219
|
+
geometry: C.geometry,
|
|
220
|
+
onClick: d,
|
|
221
|
+
onPointerOut: f,
|
|
222
|
+
onPointerOver: p,
|
|
210
223
|
children: /* @__PURE__ */ u("meshBasicMaterial", {
|
|
211
224
|
color: n,
|
|
212
225
|
opacity: c,
|
|
213
226
|
transparent: c < 1,
|
|
214
227
|
wireframe: l,
|
|
215
|
-
side: N[
|
|
228
|
+
side: N[m]
|
|
216
229
|
})
|
|
217
230
|
})
|
|
218
|
-
}) }),
|
|
231
|
+
}) }), v);
|
|
219
232
|
}, F = (t) => {
|
|
220
|
-
let n = null, r = null, i, a = null, o = null, s = null, c =
|
|
233
|
+
let n = null, r = null, i = null, a = null, o = null, s = null, c = /* @__PURE__ */ new Map(), l = null, u = (e) => {
|
|
221
234
|
if (!(!r || e.isAttached)) try {
|
|
222
235
|
r.add(e.anchor, e.longitude, e.latitude, e.altitude), e.isAttached = !0, e.onAttach?.(r);
|
|
223
236
|
} catch (e) {
|
|
224
237
|
console.error("❌ Failed to attach anchor:", e);
|
|
225
238
|
}
|
|
226
|
-
},
|
|
227
|
-
|
|
228
|
-
},
|
|
229
|
-
let t =
|
|
239
|
+
}, d = (e, t) => {
|
|
240
|
+
c.set(e, t), l !== null && !t.isAttached && (u(t), t.onGpsUpdate?.(l, 0));
|
|
241
|
+
}, f = (e) => {
|
|
242
|
+
let t = c.get(e);
|
|
230
243
|
if (t?.isAttached) try {
|
|
231
244
|
t.anchor.removeFromParent();
|
|
232
245
|
} catch (t) {
|
|
233
246
|
console.error(`⚠️ Error removing anchor ${e}:`, t);
|
|
234
247
|
}
|
|
235
|
-
|
|
236
|
-
},
|
|
248
|
+
c.delete(e);
|
|
249
|
+
}, p = (e) => c.get(e);
|
|
237
250
|
return {
|
|
238
251
|
type: e.GEOLOCATION,
|
|
239
252
|
async init(e) {
|
|
240
|
-
let { camera:
|
|
241
|
-
if (!
|
|
242
|
-
|
|
253
|
+
let { camera: d, renderer: f, scene: p } = e;
|
|
254
|
+
if (!p) throw Error("[geolocationBackend] A THREE.Scene is required for location-based AR");
|
|
255
|
+
a = d, o = f, s = p, n = new E({
|
|
243
256
|
threeObjects: {
|
|
244
|
-
camera:
|
|
245
|
-
renderer:
|
|
246
|
-
scene:
|
|
257
|
+
camera: d,
|
|
258
|
+
renderer: f,
|
|
259
|
+
scene: p
|
|
247
260
|
},
|
|
248
261
|
videoConstraints: t?.webcamConstraints ?? { video: { facingMode: "environment" } },
|
|
249
262
|
deviceOrientationOptions: { enabled: !0 }
|
|
250
|
-
}),
|
|
251
|
-
|
|
252
|
-
for (let t of
|
|
263
|
+
}), f.setClearAlpha?.(0), i = (e) => {
|
|
264
|
+
l = e.position;
|
|
265
|
+
for (let t of c.values()) t.isAttached || u(t), t.onGpsUpdate?.(e.position, e.distMoved);
|
|
253
266
|
t?.onGpsUpdate?.(e.position, e.distMoved);
|
|
254
267
|
}, r = await n.start();
|
|
255
|
-
let
|
|
256
|
-
if (
|
|
257
|
-
|
|
268
|
+
let m = n.deviceOrientationControls;
|
|
269
|
+
if (m && m.orientationChangeEventName !== "deviceorientation") try {
|
|
270
|
+
m.disconnect(), m.orientationChangeEventName = "deviceorientation", m.connect();
|
|
258
271
|
} catch (e) {
|
|
259
272
|
console.error("[geolocationBackend] failed to rebind device orientation event:", e);
|
|
260
273
|
}
|
|
261
|
-
r.on("gpsupdate",
|
|
274
|
+
r.on("gpsupdate", i), n.webcam?.on?.("webcamerror", (e) => {
|
|
262
275
|
console.error("[geolocationBackend] webcam error:", e);
|
|
263
276
|
}), n.deviceOrientationControls?.on?.("deviceorientationerror", (e) => {
|
|
264
277
|
console.error("[geolocationBackend] Device orientation error:", e);
|
|
265
278
|
}), r.on("gpserror", (e) => {
|
|
266
279
|
console.error("[geolocationBackend] gps error:", e);
|
|
267
280
|
}), r.startGps(), typeof t?.fakeLat == "number" && typeof t?.fakeLon == "number" && r.fakeGps(t.fakeLon, t.fakeLat);
|
|
268
|
-
let
|
|
269
|
-
|
|
281
|
+
let h = r.getLastKnownLocation();
|
|
282
|
+
h !== null && (l = {
|
|
270
283
|
coords: {
|
|
271
|
-
longitude:
|
|
272
|
-
latitude:
|
|
284
|
+
longitude: h.longitude,
|
|
285
|
+
latitude: h.latitude,
|
|
273
286
|
accuracy: 0,
|
|
274
287
|
altitude: null,
|
|
275
288
|
altitudeAccuracy: null,
|
|
276
289
|
heading: null,
|
|
277
290
|
speed: null,
|
|
278
|
-
toJSON: () =>
|
|
291
|
+
toJSON: () => h
|
|
279
292
|
},
|
|
280
293
|
timestamp: Date.now(),
|
|
281
|
-
toJSON: () =>
|
|
294
|
+
toJSON: () => h
|
|
282
295
|
});
|
|
283
|
-
let _ = () => {
|
|
284
|
-
if (!s || !o) return;
|
|
285
|
-
let e = window.innerWidth, t = window.innerHeight;
|
|
286
|
-
s.setSize(e, t, !1), o.aspect = e / t, o.updateProjectionMatrix?.();
|
|
287
|
-
};
|
|
288
|
-
_(), window.addEventListener("resize", _), i = _;
|
|
289
296
|
},
|
|
290
297
|
update() {
|
|
291
298
|
n?.deviceOrientationControls?.update?.();
|
|
292
299
|
},
|
|
293
300
|
dispose() {
|
|
294
|
-
r &&
|
|
295
|
-
for (let e of
|
|
301
|
+
r && i && r.off("gpsupdate", i), r?.stopGps?.(), n?.webcam?.dispose?.(), o?.setClearAlpha?.(1), n?.deviceOrientationControls?.dispose?.();
|
|
302
|
+
for (let e of c.values()) if (e.isAttached) try {
|
|
296
303
|
e.anchor.removeFromParent();
|
|
297
304
|
} catch (e) {
|
|
298
305
|
console.error("⚠️ Error removing anchor:", e);
|
|
299
306
|
}
|
|
300
|
-
|
|
307
|
+
c.clear(), n = null, r = null, a = null, o = null, s = null, i = null, l = null;
|
|
301
308
|
},
|
|
302
309
|
getInternal: () => ({
|
|
303
310
|
locar: r,
|
|
304
311
|
webcam: n?.webcam ?? null,
|
|
305
312
|
deviceOrientation: n?.deviceOrientationControls ?? null,
|
|
306
|
-
scene:
|
|
307
|
-
camera:
|
|
308
|
-
lastPosition:
|
|
309
|
-
registerAnchor:
|
|
310
|
-
unregisterAnchor:
|
|
311
|
-
getAnchor:
|
|
313
|
+
scene: s,
|
|
314
|
+
camera: a,
|
|
315
|
+
lastPosition: l,
|
|
316
|
+
registerAnchor: d,
|
|
317
|
+
unregisterAnchor: f,
|
|
318
|
+
getAnchor: p
|
|
312
319
|
})
|
|
313
320
|
};
|
|
314
321
|
};
|
package/build/geolocation.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`})
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./geolocation-D9FbCT8T.cjs`);exports.GeoLine=e.a,exports.GeoPolygon=e.n,exports.GeolocationAnchor=e.i,exports.GeolocationSession=e.r,exports.createGeolocationBackend=e.t,exports.useGeolocationBackend=e.o;
|
package/build/geolocation.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import { a as e, i as t, n, o as r, r as i, t as a } from "./geolocation-Dl910ZC5.js";
|
|
1
|
+
import { a as e, i as t, n, o as r, r as i, t as a } from "./geolocation-DCMGm6Xo.js";
|
|
3
2
|
export { e as GeoLine, n as GeoPolygon, t as GeolocationAnchor, i as GeolocationSession, a as createGeolocationBackend, r as useGeolocationBackend };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImmersiveSession.d.ts","sourceRoot":"","sources":["../../src/immersive/ImmersiveSession.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ImmersiveSession.d.ts","sourceRoot":"","sources":["../../src/immersive/ImmersiveSession.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAa/C;;GAEG;AACH,QAAA,MAAM,gBAAgB,GAAI,cAAc,iBAAiB,4CAqBxD,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as e, t } from "./useXRStore-
|
|
1
|
+
import { i as e, t } from "./useXRStore-CousLTRl.js";
|
|
2
2
|
import { useEffect as n, useMemo as r } from "react";
|
|
3
3
|
import { jsx as i } from "react/jsx-runtime";
|
|
4
4
|
import { XR as a, createXRStore as o } from "@react-three/xr";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./useXRStore-
|
|
1
|
+
const e=require(`./useXRStore-XWI97jRe.cjs`);let t=require(`react`),n=require(`react/jsx-runtime`),r=require(`@react-three/xr`);var i=()=>({type:e.i.IMMERSIVE,init:()=>{},getInternal:()=>null}),a=({children:a})=>{let o=(0,t.useMemo)(()=>(0,r.createXRStore)(),[]);return(0,t.useEffect)(()=>{let t=e.t(),n=i();return t.backends.set(e.i.IMMERSIVE,n),t.setImmersiveStore(o),()=>{t.backends.delete(e.i.IMMERSIVE),t.setImmersiveStore(null)}},[o]),(0,n.jsx)(r.XR,{store:o,children:a})};Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return a}});
|
package/build/immersive.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`})
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./immersive-YdcOrh6T.cjs`);exports.ImmersiveSession=e.t;
|
package/build/immersive.js
CHANGED
package/build/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./useXRStore-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./useXRStore-XWI97jRe.cjs`),t=require(`./engine-BBW4dx9u.cjs`),n=require(`./fiducial-Ccrn4lFL.cjs`),r=require(`./geolocation-D9FbCT8T.cjs`),i=require(`./immersive-YdcOrh6T.cjs`),a=require(`./magic-Dzl9O3jU.cjs`),o=require(`./vision-Ci0b3-oF.cjs`);require(`@react-three/fiber`),exports.BACKEND_TYPES=e.i,exports.COCO_LABELS=o.c,exports.CameraBackground=o.C,exports.DEFAULT_GESTURES=o._,exports.FiducialAnchor=n.r,exports.FiducialSession=n.n,exports.GeoLine=r.a,exports.GeoPolygon=r.n,exports.GeolocationAnchor=r.i,exports.GeolocationSession=r.r,exports.HandTracker=o.f,exports.ImmersiveSession=i.t,exports.MagicSession=a.n,exports.VisionAnchor=o.o,exports.VisionDebug=o.a,exports.VisionOverlay=o.t,exports.VisionSession=o.r,exports.VisionStatus=o.n,exports.WorldAnchor=a.t,exports.XR=t.t,exports.createFiducialBackend=n.t,exports.createGeolocationBackend=r.t,exports.createMagicBackend=a.r,exports.createVisionBackend=o.i,exports.detectGesture=o.g,exports.fist=o.v,exports.getXRStore=e.t,exports.landmarkToWorld=o.m,exports.landmarksCentroid=o.h,exports.ok=o.y,exports.openHand=o.b,exports.peace=o.x,exports.rfDetr=o.l,exports.subscribeToXRStore=e.n,exports.thumbsUp=o.S,exports.useFiducialBackend=n.i,exports.useGeolocationBackend=r.o,exports.useVisionBackend=o.p,exports.useVisionFrame=o.s,exports.useXRStore=e.r,exports.yolo=o.u,exports.yoloSeg=o.d;
|
package/build/index.js
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
import { i as e, n as t, r as n, t as r } from "./useXRStore-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { t as m } from "./
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
let { updateBackends: t } = n();
|
|
11
|
-
return V((e, n) => {
|
|
12
|
-
t(n);
|
|
13
|
-
}), e;
|
|
14
|
-
};
|
|
15
|
-
//#endregion
|
|
16
|
-
export { e as BACKEND_TYPES, C as COCO_LABELS, v as CameraBackground, b as DEFAULT_GESTURES, o as FiducialAnchor, a as FiducialSession, c as GeoLine, u as GeoPolygon, l as GeolocationAnchor, f as GeolocationSession, T as HandTracker, m as ImmersiveSession, h as MagicSession, M as VisionAnchor, x as VisionDebug, I as VisionOverlay, P as VisionSession, j as VisionStatus, _ as WorldAnchor, H as XR, s as createFiducialBackend, p as createGeolocationBackend, g as createMagicBackend, O as createVisionBackend, E as detectGesture, R as fist, r as getXRStore, A as landmarkToWorld, D as landmarksCentroid, B as ok, S as openHand, z as peace, k as rfDetr, t as subscribeToXRStore, y as thumbsUp, i as useFiducialBackend, d as useGeolocationBackend, N as useVisionBackend, F as useVisionFrame, n as useXRStore, L as yolo, w as yoloSeg };
|
|
1
|
+
import { i as e, n as t, r as n, t as r } from "./useXRStore-CousLTRl.js";
|
|
2
|
+
import { t as i } from "./engine-DQC0zTpL.js";
|
|
3
|
+
import { i as a, n as o, r as s, t as c } from "./fiducial-DpJVvX22.js";
|
|
4
|
+
import { a as l, i as u, n as d, o as f, r as p, t as m } from "./geolocation-DCMGm6Xo.js";
|
|
5
|
+
import { t as h } from "./immersive-CR4YCvJ0.js";
|
|
6
|
+
import { n as g, r as _, t as v } from "./magic-DQmRfsb_.js";
|
|
7
|
+
import { C as y, S as b, _ as x, a as S, b as C, c as w, d as T, f as E, g as D, h as O, i as k, l as A, m as j, n as M, o as N, p as P, r as F, s as I, t as L, u as R, v as z, x as B, y as V } from "./vision-DPLI9maM.js";
|
|
8
|
+
import "@react-three/fiber";
|
|
9
|
+
export { e as BACKEND_TYPES, w as COCO_LABELS, y as CameraBackground, x as DEFAULT_GESTURES, s as FiducialAnchor, o as FiducialSession, l as GeoLine, d as GeoPolygon, u as GeolocationAnchor, p as GeolocationSession, E as HandTracker, h as ImmersiveSession, g as MagicSession, N as VisionAnchor, S as VisionDebug, L as VisionOverlay, F as VisionSession, M as VisionStatus, v as WorldAnchor, i as XR, c as createFiducialBackend, m as createGeolocationBackend, _ as createMagicBackend, k as createVisionBackend, D as detectGesture, z as fist, r as getXRStore, j as landmarkToWorld, O as landmarksCentroid, V as ok, C as openHand, B as peace, A as rfDetr, t as subscribeToXRStore, b as thumbsUp, a as useFiducialBackend, f as useGeolocationBackend, P as useVisionBackend, I as useVisionFrame, n as useXRStore, R as yolo, T as yoloSeg };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MagicSession.d.ts","sourceRoot":"","sources":["../../src/magic/MagicSession.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MagicSession.d.ts","sourceRoot":"","sources":["../../src/magic/MagicSession.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG/C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IAC1D,oCAAoC;IACpC,OAAO,CAAC,EAAE,mBAAmB,CAAC;CAC/B;AAED;;;;GAIG;AACH,QAAA,MAAM,YAAY,GAAI,uBAA4B,iBAAiB,8BA4ClE,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorldAnchor.d.ts","sourceRoot":"","sources":["../../src/magic/WorldAnchor.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"WorldAnchor.d.ts","sourceRoot":"","sources":["../../src/magic/WorldAnchor.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAK/C,MAAM,WAAW,gBAAiB,SAAQ,iBAAiB;IACzD,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,kCAAkC;IAClC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;GAGG;AACH,QAAA,MAAM,WAAW,GAAI,uDAMlB,gBAAgB,4CA0ClB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|