xrblocks 0.1.0 → 0.3.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.
Files changed (77) hide show
  1. package/README.md +131 -30
  2. package/build/addons/ai/AudioCaptureProcessorCode.d.ts +1 -0
  3. package/build/addons/ai/AudioCaptureProcessorCode.js +27 -0
  4. package/build/addons/ai/GeminiManager.d.ts +11 -4
  5. package/build/addons/ai/GeminiManager.js +80 -34
  6. package/build/addons/objects/SimpleDecalGeometry.js +9 -5
  7. package/build/addons/simulator/instructions/CustomInstruction.js +8 -9
  8. package/build/addons/simulator/instructions/HandsInstructions.js +17 -10
  9. package/build/addons/simulator/instructions/NavigationInstructions.js +10 -9
  10. package/build/addons/simulator/instructions/SimulatorInstructions.js +17 -18
  11. package/build/addons/simulator/instructions/SimulatorInstructionsCard.js +69 -75
  12. package/build/addons/simulator/instructions/SimulatorInstructionsEvents.js +4 -1
  13. package/build/addons/simulator/instructions/UserInstructions.js +18 -15
  14. package/build/addons/simulator/ui/EnterXRButton.js +17 -17
  15. package/build/addons/simulator/ui/GeminiLiveApiKeyInput.js +45 -39
  16. package/build/addons/simulator/ui/HandPosePanel.js +20 -10
  17. package/build/addons/simulator/ui/MicButton.js +23 -18
  18. package/build/addons/simulator/ui/ModeIndicator.js +17 -17
  19. package/build/addons/ui/TextBillboard.js +1 -1
  20. package/build/addons/utils/Palette.js +3 -15
  21. package/build/addons/virtualkeyboard/Keyboard.js +24 -21
  22. package/build/addons/volumes/VolumetricCloud.glsl.js +1 -1
  23. package/build/addons/volumes/VolumetricCloud.js +8 -5
  24. package/build/agent/Agent.d.ts +25 -1
  25. package/build/agent/SkyboxAgent.d.ts +119 -3
  26. package/build/agent/Tool.d.ts +21 -5
  27. package/build/agent/index.d.ts +1 -0
  28. package/build/agent/tools/GenerateSkyboxTool.d.ts +3 -3
  29. package/build/agent/tools/GetWeatherTool.d.ts +7 -8
  30. package/build/ai/AI.d.ts +1 -1
  31. package/build/ai/Gemini.d.ts +1 -4
  32. package/build/camera/XRDeviceCamera.d.ts +1 -1
  33. package/build/core/Core.d.ts +4 -1
  34. package/build/core/Options.d.ts +17 -0
  35. package/build/core/components/ScreenshotSynthesizer.d.ts +6 -4
  36. package/build/core/components/XRTransition.d.ts +1 -1
  37. package/build/depth/Depth.d.ts +5 -3
  38. package/build/depth/DepthMesh.d.ts +8 -1
  39. package/build/depth/DepthTextures.d.ts +6 -4
  40. package/build/depth/occlusion/OcclusionPass.d.ts +6 -5
  41. package/build/input/Hands.d.ts +1 -1
  42. package/build/input/Input.d.ts +1 -1
  43. package/build/input/gestures/GestureEvents.d.ts +23 -0
  44. package/build/input/gestures/GestureRecognition.d.ts +43 -0
  45. package/build/input/gestures/GestureRecognitionOptions.d.ts +43 -0
  46. package/build/input/gestures/GestureTypes.d.ts +16 -0
  47. package/build/input/gestures/providers/HeuristicGestureDetectors.d.ts +2 -0
  48. package/build/simulator/Simulator.d.ts +2 -0
  49. package/build/simulator/SimulatorControls.d.ts +1 -1
  50. package/build/simulator/SimulatorOptions.d.ts +1 -0
  51. package/build/simulator/controlModes/SimulatorControlMode.d.ts +1 -1
  52. package/build/simulator/handPoses/HandPoseJoints.d.ts +2 -2
  53. package/build/simulator/userActions/PinchOnButtonAction.d.ts +2 -2
  54. package/build/simulator/userActions/WalkTowardsPanelAction.d.ts +1 -1
  55. package/build/singletons.d.ts +2 -2
  56. package/build/sound/AudioListener.d.ts +16 -1
  57. package/build/sound/AudioPlayer.d.ts +21 -2
  58. package/build/sound/CoreSound.d.ts +26 -1
  59. package/build/stereo/utils.d.ts +1 -1
  60. package/build/ui/components/IconButton.d.ts +6 -2
  61. package/build/ui/components/MaterialSymbolsView.d.ts +1 -1
  62. package/build/ui/components/ScrollingTroikaTextView.d.ts +1 -1
  63. package/build/ui/components/TextButton.d.ts +0 -1
  64. package/build/ui/interaction/ModelViewer.d.ts +6 -2
  65. package/build/utils/ModelLoader.d.ts +1 -1
  66. package/build/utils/SparkRendererHolder.d.ts +5 -0
  67. package/build/utils/Types.d.ts +2 -2
  68. package/build/video/VideoStream.d.ts +1 -1
  69. package/build/world/World.d.ts +1 -1
  70. package/build/world/objects/ObjectDetector.d.ts +1 -1
  71. package/build/world/planes/PlaneDetector.d.ts +1 -1
  72. package/build/xrblocks.d.ts +3 -0
  73. package/build/xrblocks.js +7268 -5884
  74. package/build/xrblocks.js.map +1 -1
  75. package/build/xrblocks.min.js +1 -1
  76. package/build/xrblocks.min.js.map +1 -1
  77. package/package.json +14 -9
@@ -4,10 +4,12 @@ export declare class DepthTextures {
4
4
  private options;
5
5
  private uint16Arrays;
6
6
  private uint8Arrays;
7
- private textures;
7
+ private dataTextures;
8
+ private nativeTextures;
8
9
  depthData: XRCPUDepthInformation[];
9
10
  constructor(options: DepthOptions);
10
- private createDepthTextures;
11
- update(depthData: XRCPUDepthInformation, view_id: number): void;
12
- get(view_id: number): THREE.DataTexture;
11
+ private createDataDepthTextures;
12
+ updateData(depthData: XRCPUDepthInformation, view_id: number): void;
13
+ updateNativeTexture(depthData: XRWebGLDepthInformation, renderer: THREE.WebGLRenderer, view_id: number): void;
14
+ get(view_id: number): THREE.DataTexture | THREE.ExternalTexture;
13
15
  }
@@ -26,19 +26,20 @@ export declare class OcclusionPass extends Pass {
26
26
  private kawaseBlurTargets;
27
27
  private occlusionUniforms;
28
28
  private occlusionQuad;
29
+ private depthNear;
29
30
  constructor(scene: THREE.Scene, camera: THREE.PerspectiveCamera, useFloatDepth?: boolean, renderToScreen?: boolean, occludableItemsLayer?: number);
30
31
  private setupKawaseBlur;
31
- setDepthTexture(depthTexture: THREE.Texture, rawValueToMeters: number, view_id: number): void;
32
+ setDepthTexture(depthTexture: THREE.Texture, rawValueToMeters: number, viewId: number, depthNear?: number): void;
32
33
  /**
33
34
  * Render the occlusion map.
34
35
  * @param renderer - The three.js renderer.
35
36
  * @param writeBuffer - The buffer to write the final result.
36
37
  * @param readBuffer - The buffer for the current of virtual depth.
37
- * @param view_id - The view to render.
38
+ * @param viewId - The view to render.
38
39
  */
39
- render(renderer: THREE.WebGLRenderer, writeBuffer?: THREE.WebGLRenderTarget, readBuffer?: THREE.WebGLRenderTarget, view_id?: number): void;
40
- renderOcclusionMapFromScene(renderer: THREE.WebGLRenderer, dimensions: THREE.Vector2, view_id: number): void;
41
- renderOcclusionMapFromReadBuffer(renderer: THREE.WebGLRenderer, readBuffer: THREE.RenderTarget, dimensions: THREE.Vector2, view_id: number): void;
40
+ render(renderer: THREE.WebGLRenderer, writeBuffer?: THREE.WebGLRenderTarget, readBuffer?: THREE.WebGLRenderTarget, viewId?: number): void;
41
+ renderOcclusionMapFromScene(renderer: THREE.WebGLRenderer, dimensions: THREE.Vector2, viewId: number): void;
42
+ renderOcclusionMapFromReadBuffer(renderer: THREE.WebGLRenderer, readBuffer: THREE.RenderTarget, dimensions: THREE.Vector2, viewId: number): void;
42
43
  blurOcclusionMap(renderer: THREE.WebGLRenderer, dimensions: THREE.Vector2): void;
43
44
  applyOcclusionMapToRenderedImage(renderer: THREE.WebGLRenderer, readBuffer?: THREE.WebGLRenderTarget, writeBuffer?: THREE.WebGLRenderTarget): void;
44
45
  dispose(): void;
@@ -1,6 +1,6 @@
1
1
  import * as THREE from 'three';
2
2
  import { HAND_JOINT_NAMES } from './components/HandJointNames.js';
3
- type JointName = typeof HAND_JOINT_NAMES[number];
3
+ type JointName = (typeof HAND_JOINT_NAMES)[number];
4
4
  /**
5
5
  * Utility class for managing WebXR hand tracking data based on
6
6
  * reported Handedness.
@@ -36,7 +36,7 @@ export declare class Input {
36
36
  * Initializes an instance with XR controllers, grips, hands, raycaster, and
37
37
  * default options. Only called by Core.
38
38
  */
39
- init({ scene, options, renderer }: {
39
+ init({ scene, options, renderer, }: {
40
40
  scene: THREE.Scene;
41
41
  options: Options;
42
42
  renderer: THREE.WebGLRenderer;
@@ -0,0 +1,23 @@
1
+ import type { BuiltInGestureName } from './GestureRecognitionOptions';
2
+ export type GestureEventType = 'gesturestart' | 'gestureupdate' | 'gestureend';
3
+ export type GestureHandedness = 'left' | 'right';
4
+ export interface GestureEventDetail {
5
+ /**
6
+ * The canonical gesture identifier. Built-in gestures map to
7
+ * `BuiltInGestureName` while custom providers may surface arbitrary strings.
8
+ */
9
+ name: BuiltInGestureName | string;
10
+ /** Which hand triggered the gesture. */
11
+ hand: GestureHandedness;
12
+ /** Provider specific confidence score, normalized to [0, 1]. */
13
+ confidence: number;
14
+ /**
15
+ * Optional payload for provider specific values (e.g. pinch distance,
16
+ * velocity vectors).
17
+ */
18
+ data?: Record<string, unknown>;
19
+ }
20
+ export interface GestureEvent {
21
+ type: GestureEventType;
22
+ detail: GestureEventDetail;
23
+ }
@@ -0,0 +1,43 @@
1
+ import * as THREE from 'three';
2
+ import { Input } from '../Input';
3
+ import { User } from '../../core/User';
4
+ import { Script } from '../../core/Script';
5
+ import { GestureEventDetail, GestureEventType } from './GestureEvents';
6
+ import { GestureRecognitionOptions } from './GestureRecognitionOptions';
7
+ type GestureScriptEvent = THREE.Event & {
8
+ type: GestureEventType;
9
+ target: GestureRecognition;
10
+ detail: GestureEventDetail;
11
+ };
12
+ interface GestureRecognitionEventMap extends THREE.Object3DEventMap {
13
+ gesturestart: GestureScriptEvent;
14
+ gestureupdate: GestureScriptEvent;
15
+ gestureend: GestureScriptEvent;
16
+ }
17
+ export declare class GestureRecognition extends Script<GestureRecognitionEventMap> {
18
+ static dependencies: {
19
+ input: typeof Input;
20
+ user: typeof User;
21
+ options: typeof GestureRecognitionOptions;
22
+ };
23
+ private options;
24
+ private user;
25
+ private input;
26
+ private activeGestures;
27
+ private lastEvaluation;
28
+ private detectors;
29
+ private activeProvider;
30
+ private providerWarned;
31
+ init({ options, user, input, }: {
32
+ options: GestureRecognitionOptions;
33
+ user: User;
34
+ input: Input;
35
+ }): Promise<void>;
36
+ update(): void;
37
+ private configureProvider;
38
+ private assignDetectors;
39
+ private evaluateHand;
40
+ private buildHandContext;
41
+ private emitGesture;
42
+ }
43
+ export {};
@@ -0,0 +1,43 @@
1
+ import { DeepPartial, DeepReadonly } from '../../utils/Types';
2
+ export type GestureProvider = 'heuristics' | 'mediapipe' | 'tfjs';
3
+ export type BuiltInGestureName = 'pinch' | 'open-palm' | 'fist' | 'thumbs-up' | 'point' | 'spread';
4
+ export type GestureConfiguration = {
5
+ enabled: boolean;
6
+ /**
7
+ * Optional override for gesture-specific score thresholds. For distance based
8
+ * gestures this is treated as a maximum distance; for confidence based
9
+ * gestures it is treated as a minimum score.
10
+ */
11
+ threshold?: number;
12
+ };
13
+ export type GestureConfigurations = Partial<Record<BuiltInGestureName, Partial<GestureConfiguration>>>;
14
+ export declare class GestureRecognitionOptions {
15
+ /** Master switch for the gesture recognition block. */
16
+ enabled: boolean;
17
+ /**
18
+ * Backing provider that extracts gesture information.
19
+ * - 'heuristics': WebXR joint heuristics only (no external ML dependency).
20
+ * - 'mediapipe': MediaPipe Hands running via Web APIs / wasm.
21
+ * - 'tfjs': TensorFlow.js hand-pose-detection models.
22
+ */
23
+ provider: GestureProvider;
24
+ /**
25
+ * Minimum confidence score to emit gesture events. Different providers map to
26
+ * different score domains so this value is normalised to [0-1].
27
+ */
28
+ minimumConfidence: number;
29
+ /**
30
+ * Optional throttle window for expensive providers.
31
+ */
32
+ updateIntervalMs: number;
33
+ /**
34
+ * Default gesture catalogue.
35
+ */
36
+ gestures: Record<BuiltInGestureName, GestureConfiguration>;
37
+ constructor(options?: DeepReadonly<DeepPartial<GestureRecognitionOptions>>);
38
+ enable(): this;
39
+ /**
40
+ * Convenience helper to toggle specific gestures.
41
+ */
42
+ setGestureEnabled(name: BuiltInGestureName, enabled: boolean): this;
43
+ }
@@ -0,0 +1,16 @@
1
+ import * as THREE from 'three';
2
+ import { Handedness } from '../Hands';
3
+ import { BuiltInGestureName, GestureConfiguration } from './GestureRecognitionOptions';
4
+ export type HandLabel = 'left' | 'right';
5
+ export type JointPositions = Map<string, THREE.Vector3>;
6
+ export type HandContext = {
7
+ handedness: Handedness;
8
+ handLabel: HandLabel;
9
+ joints: JointPositions;
10
+ };
11
+ export type GestureDetectionResult = {
12
+ confidence: number;
13
+ data?: Record<string, unknown>;
14
+ };
15
+ export type GestureDetector = (context: HandContext, config: GestureConfiguration) => GestureDetectionResult | undefined;
16
+ export type GestureDetectorMap = Partial<Record<BuiltInGestureName, GestureDetector>>;
@@ -0,0 +1,2 @@
1
+ import { GestureDetectorMap } from '../GestureTypes';
2
+ export declare const heuristicDetectors: GestureDetectorMap;
@@ -49,6 +49,8 @@ export declare class Simulator extends Script {
49
49
  mainScene: THREE.Scene;
50
50
  private initialized;
51
51
  private renderSimulatorSceneToCanvasBound;
52
+ private sparkRenderer?;
53
+ private registry?;
52
54
  constructor(renderMainScene: (cameraOverride?: THREE.Camera) => void);
53
55
  init({ simulatorOptions, input, timer, camera, renderer, scene, registry, options, depth, }: {
54
56
  simulatorOptions: SimulatorOptions;
@@ -38,7 +38,7 @@ export declare class SimulatorControls {
38
38
  /**
39
39
  * Initialize the simulator controls.
40
40
  */
41
- init({ camera, input, timer, renderer, simulatorOptions }: {
41
+ init({ camera, input, timer, renderer, simulatorOptions, }: {
42
42
  camera: THREE.Camera;
43
43
  input: Input;
44
44
  timer: THREE.Timer;
@@ -48,5 +48,6 @@ export declare class SimulatorOptions {
48
48
  enabled: boolean;
49
49
  };
50
50
  renderToRenderTexture: boolean;
51
+ blendingMode: 'normal' | 'screen';
51
52
  constructor(options?: DeepReadonly<DeepPartial<SimulatorOptions>>);
52
53
  }
@@ -20,7 +20,7 @@ export declare class SimulatorControlMode {
20
20
  /**
21
21
  * Initialize the simulator control mode.
22
22
  */
23
- init({ camera, input, timer }: {
23
+ init({ camera, input, timer, }: {
24
24
  camera: THREE.Camera;
25
25
  input: Input;
26
26
  timer: THREE.Timer;
@@ -1,5 +1,5 @@
1
- export type SimulatorHandPoseJoints = ({
1
+ export type SimulatorHandPoseJoints = {
2
2
  t: number[];
3
3
  r: number[];
4
4
  s?: number[];
5
- })[];
5
+ }[];
@@ -18,7 +18,7 @@ export declare class PinchOnButtonAction extends SimulatorUserAction {
18
18
  private timer;
19
19
  private input;
20
20
  constructor(target: THREE.Object3D);
21
- init({ simulator, camera, timer, input }: {
21
+ init({ simulator, camera, timer, input, }: {
22
22
  simulator: Simulator;
23
23
  camera: THREE.Camera;
24
24
  timer: THREE.Timer;
@@ -27,7 +27,7 @@ export declare class PinchOnButtonAction extends SimulatorUserAction {
27
27
  controllerIsPointingAtButton(controls: SimulatorControls, camera: THREE.Camera): boolean;
28
28
  rotateControllerTowardsButton(controls: SimulatorControls, camera: THREE.Camera, deltaTime: number): void;
29
29
  pinchController(): void;
30
- play({ simulatorUser, journeyId, waitFrame }: {
30
+ play({ simulatorUser, journeyId, waitFrame, }: {
31
31
  simulatorUser: SimulatorUser;
32
32
  journeyId: number;
33
33
  waitFrame: WaitFrame;
@@ -23,7 +23,7 @@ export declare class WalkTowardsPanelAction extends SimulatorUserAction {
23
23
  lookAtTarget(): void;
24
24
  lookTowardsTarget(): void;
25
25
  moveTowardsTarget(): void;
26
- play({ simulatorUser, journeyId, waitFrame }: {
26
+ play({ simulatorUser, journeyId, waitFrame, }: {
27
27
  simulatorUser: SimulatorUser;
28
28
  journeyId: number;
29
29
  waitFrame: WaitFrame;
@@ -16,7 +16,7 @@ export declare const core: Core;
16
16
  * scene.add(myObject);
17
17
  * ```
18
18
  */
19
- export declare const scene: THREE.Scene;
19
+ export declare const scene: THREE.Scene<THREE.Object3DEventMap>;
20
20
  /**
21
21
  * A direct alias to the `User` instance, which represents the user in the XR
22
22
  * scene and manages inputs like controllers and hands.
@@ -43,7 +43,7 @@ export declare const ai: import("./xrblocks").AI;
43
43
  * @param object - The object(s) to add.
44
44
  * @see {@link three#Object3D.add}
45
45
  */
46
- export declare function add(...object: THREE.Object3D[]): THREE.Scene;
46
+ export declare function add(...object: THREE.Object3D[]): THREE.Scene<THREE.Object3DEventMap>;
47
47
  /**
48
48
  * A shortcut for `core.init()`. Initializes the XR Blocks system and starts
49
49
  * the render loop. This is the main entry point for any application.
@@ -14,11 +14,13 @@ export declare class AudioListener extends Script {
14
14
  };
15
15
  private options;
16
16
  private audioStream?;
17
- private audioContext?;
17
+ audioContext?: AudioContext;
18
18
  private sourceNode?;
19
19
  private processorNode?;
20
20
  private isCapturing;
21
21
  private latestAudioBuffer;
22
+ private accumulatedChunks;
23
+ private isAccumulating;
22
24
  private registry;
23
25
  aiService?: AI;
24
26
  private onAudioData?;
@@ -33,6 +35,7 @@ export declare class AudioListener extends Script {
33
35
  startCapture(callbacks?: {
34
36
  onAudioData?: (audioBuffer: ArrayBuffer) => void;
35
37
  onError?: (error: Error) => void;
38
+ accumulate?: boolean;
36
39
  }): Promise<void>;
37
40
  stopCapture(): void;
38
41
  setupAudioCapture(): Promise<void>;
@@ -44,5 +47,17 @@ export declare class AudioListener extends Script {
44
47
  getIsCapturing(): boolean;
45
48
  getLatestAudioBuffer(): ArrayBuffer | null;
46
49
  clearLatestAudioBuffer(): void;
50
+ /**
51
+ * Gets all accumulated audio chunks as a single combined buffer
52
+ */
53
+ getAccumulatedBuffer(): ArrayBuffer | null;
54
+ /**
55
+ * Clears accumulated chunks
56
+ */
57
+ clearAccumulatedBuffer(): void;
58
+ /**
59
+ * Gets the number of accumulated chunks
60
+ */
61
+ getAccumulatedChunkCount(): number;
47
62
  dispose(): void;
48
63
  }
@@ -1,18 +1,37 @@
1
1
  import { Script } from '../core/Script.js';
2
+ import { CategoryVolumes } from './CategoryVolumes';
2
3
  export interface AudioPlayerOptions {
3
4
  sampleRate?: number;
4
5
  channelCount?: number;
6
+ category?: string;
5
7
  }
6
8
  export declare class AudioPlayer extends Script {
7
9
  private options;
8
10
  private audioContext?;
9
11
  private audioQueue;
10
- private isPlaying;
11
12
  private nextStartTime;
13
+ private gainNode?;
14
+ private categoryVolumes?;
15
+ private volume;
16
+ private category;
12
17
  constructor(options?: AudioPlayerOptions);
18
+ /**
19
+ * Sets the CategoryVolumes instance for this player to respect
20
+ * master/category volumes
21
+ */
22
+ setCategoryVolumes(categoryVolumes: CategoryVolumes): void;
23
+ /**
24
+ * Sets the specific volume for this player (0.0 to 1.0)
25
+ */
26
+ setVolume(level: number): void;
27
+ /**
28
+ * Updates the gain node volume based on category volumes
29
+ * Public so CoreSound can update it when master volume changes
30
+ */
31
+ updateGainNodeVolume(): void;
13
32
  initializeAudioContext(): Promise<void>;
14
33
  playAudioChunk(base64AudioData: string): Promise<void>;
15
- playNextAudioBuffer(): void;
34
+ private scheduleAudioBuffers;
16
35
  clearQueue(): void;
17
36
  getIsPlaying(): boolean;
18
37
  getQueueLength(): number;
@@ -24,7 +24,7 @@ export declare class CoreSound extends Script {
24
24
  audioListener: AudioListener;
25
25
  audioPlayer: AudioPlayer;
26
26
  options: SoundOptions;
27
- init({ camera, soundOptions }: {
27
+ init({ camera, soundOptions, }: {
28
28
  camera: THREE.Camera;
29
29
  soundOptions: SoundOptions;
30
30
  }): void;
@@ -35,13 +35,38 @@ export declare class CoreSound extends Script {
35
35
  getCategoryVolume(category: VolumeCategory): number;
36
36
  enableAudio(options?: {
37
37
  streamToAI?: boolean;
38
+ accumulate?: boolean;
38
39
  }): Promise<void>;
39
40
  disableAudio(): void;
41
+ /**
42
+ * Starts recording audio with chunk accumulation
43
+ */
44
+ startRecording(): Promise<void>;
45
+ /**
46
+ * Stops recording and returns the accumulated audio buffer
47
+ */
48
+ stopRecording(): ArrayBuffer | null;
49
+ /**
50
+ * Gets the accumulated recording buffer without stopping
51
+ */
52
+ getRecordedBuffer(): ArrayBuffer | null;
53
+ /**
54
+ * Clears the accumulated recording buffer
55
+ */
56
+ clearRecordedBuffer(): void;
57
+ /**
58
+ * Gets the sample rate being used for recording
59
+ */
60
+ getRecordingSampleRate(): number;
40
61
  setAIStreaming(enabled: boolean): void;
41
62
  isAIStreamingEnabled(): boolean;
42
63
  playAIAudio(base64AudioData: string): Promise<void>;
43
64
  stopAIAudio(): void;
44
65
  isAIAudioPlaying(): boolean;
66
+ /**
67
+ * Plays a raw audio buffer (Int16 PCM data) with proper sample rate
68
+ */
69
+ playRecordedAudio(audioBuffer: ArrayBuffer, sampleRate?: number): Promise<void>;
45
70
  isAudioEnabled(): boolean;
46
71
  getLatestAudioBuffer(): ArrayBuffer | null;
47
72
  clearLatestAudioBuffer(): void;
@@ -20,4 +20,4 @@ export declare function showOnlyInRightEye<T extends THREE.Object3D>(obj: T): T;
20
20
  * @returns A promise that resolves to an array containing the left and right
21
21
  * eye textures.
22
22
  */
23
- export declare function loadStereoImageAsTextures(url: string): Promise<THREE.Texture[]>;
23
+ export declare function loadStereoImageAsTextures(url: string): Promise<THREE.Texture<unknown>[]>;
@@ -44,14 +44,18 @@ export declare class IconButton extends TextView {
44
44
  * @param options - The options for the IconButton.
45
45
  */
46
46
  constructor(options?: IconButtonOptions);
47
+ /**
48
+ * Initializes the component and sets the render order.
49
+ */
50
+ init(_?: object): Promise<void>;
51
+ /**
52
+
47
53
  /**
48
54
  * Handles behavior when the cursor hovers over the button.
49
- * @override
50
55
  */
51
56
  onHoverOver(): void;
52
57
  /**
53
58
  * Handles behavior when the cursor moves off the button.
54
- * @override
55
59
  */
56
60
  onHoverOut(): void;
57
61
  /**
@@ -34,7 +34,7 @@ export declare class MaterialSymbolsView extends View {
34
34
  * Construct a Material Symbol view.
35
35
  * @param options - Options for the icon.
36
36
  */
37
- constructor({ icon, iconWeight, iconStyle, iconScale, iconColor }: MaterialSymbolsViewOptions);
37
+ constructor({ icon, iconWeight, iconStyle, iconScale, iconColor, }: MaterialSymbolsViewOptions);
38
38
  init(): Promise<void>;
39
39
  /**
40
40
  * Updates the icon displayed by loading the appropriate SVG from the Material
@@ -27,7 +27,7 @@ export declare class ScrollingTroikaTextView extends View {
27
27
  private textView;
28
28
  private onTextSyncCompleteBound;
29
29
  private currentText;
30
- constructor({ text, textAlign, scrollerState, fontSize }?: ScrollingTroikaTextViewOptions);
30
+ constructor({ text, textAlign, scrollerState, fontSize, }?: ScrollingTroikaTextViewOptions);
31
31
  update(): void;
32
32
  addText(text: string): void;
33
33
  setText(text: string): void;
@@ -46,7 +46,6 @@ export declare class TextButton extends TextView {
46
46
  constructor(options?: TextButtonOptions);
47
47
  /**
48
48
  * Initializes the text object after async dependencies are loaded.
49
- * @override
50
49
  */
51
50
  init(): Promise<void>;
52
51
  update(): void;
@@ -2,6 +2,7 @@ import * as THREE from 'three';
2
2
  import { Script } from '../../core/Script';
3
3
  import { Depth } from '../../depth/Depth';
4
4
  import { Draggable, DragMode, HasDraggingMode } from '../../ux/DragManager';
5
+ import { Registry } from '../../core/components/Registry';
5
6
  export interface GLTFData {
6
7
  model: string;
7
8
  path: string;
@@ -38,6 +39,7 @@ export declare class ModelViewer extends Script implements Draggable {
38
39
  depth: typeof Depth;
39
40
  scene: typeof THREE.Scene;
40
41
  renderer: typeof THREE.WebGLRenderer;
42
+ registry: typeof Registry;
41
43
  };
42
44
  draggable: boolean;
43
45
  rotatable: boolean;
@@ -65,16 +67,18 @@ export declare class ModelViewer extends Script implements Draggable {
65
67
  private platform?;
66
68
  private controlBar?;
67
69
  private rotationRaycastMesh?;
70
+ private registry?;
68
71
  constructor({ castShadow, receiveShadow, raycastToChildren, }: {
69
72
  castShadow?: boolean | undefined;
70
73
  receiveShadow?: boolean | undefined;
71
74
  raycastToChildren?: boolean | undefined;
72
75
  });
73
- init({ camera, depth, scene, renderer }: {
76
+ init({ camera, depth, scene, renderer, registry, }: {
74
77
  camera: THREE.Camera;
75
78
  depth: Depth;
76
79
  scene: THREE.Scene;
77
80
  renderer: THREE.WebGLRenderer;
81
+ registry: Registry;
78
82
  }): Promise<void>;
79
83
  loadSplatModel({ data, onSceneLoaded, platformMargin, setupRaycastCylinder, setupRaycastBox, setupPlatform, }: {
80
84
  data: SplatData;
@@ -84,7 +88,7 @@ export declare class ModelViewer extends Script implements Draggable {
84
88
  setupRaycastBox?: boolean;
85
89
  setupPlatform?: boolean;
86
90
  }): Promise<void | SplatAnchor>;
87
- loadGLTFModel({ data, onSceneLoaded, platformMargin, setupRaycastCylinder, setupRaycastBox, setupPlatform, renderer, addOcclusionToShader }: {
91
+ loadGLTFModel({ data, onSceneLoaded, platformMargin, setupRaycastCylinder, setupRaycastBox, setupPlatform, renderer, addOcclusionToShader, }: {
88
92
  data: GLTFData;
89
93
  onSceneLoaded?: (scene: THREE.Object3D) => void;
90
94
  platformMargin?: THREE.Vector2;
@@ -34,7 +34,7 @@ export declare class ModelLoader {
34
34
  * @returns A promise that resolves with the loaded model data (e.g., a glTF
35
35
  * scene or a SplatMesh).
36
36
  */
37
- load({ path, url, renderer, onProgress }: ModelLoaderLoadOptions): Promise<GLTF | import("@sparkjsdev/spark").SplatMesh | null>;
37
+ load({ path, url, renderer, onProgress, }: ModelLoaderLoadOptions): Promise<GLTF | import("@sparkjsdev/spark").SplatMesh | null>;
38
38
  /**
39
39
  * Loads a 3DGS model (.ply, .spz, .splat, .ksplat).
40
40
  * @param url - The URL of the model file.
@@ -0,0 +1,5 @@
1
+ import type { SparkRenderer } from '@sparkjsdev/spark';
2
+ export declare class SparkRendererHolder {
3
+ renderer: SparkRenderer;
4
+ constructor(renderer: SparkRenderer);
5
+ }
@@ -21,12 +21,12 @@ export interface Shader {
21
21
  /**
22
22
  * A recursive readonly type.
23
23
  */
24
- export type DeepReadonly<T> = T extends ((...args: any[]) => any) ? T : T extends object ? {
24
+ export type DeepReadonly<T> = T extends (...args: any[]) => any ? T : T extends object ? {
25
25
  readonly [P in keyof T]: DeepReadonly<T[P]>;
26
26
  } : T;
27
27
  /**
28
28
  * A recursive partial type.
29
29
  */
30
- export type DeepPartial<T> = T extends ((...args: any[]) => any) ? T : T extends object ? {
30
+ export type DeepPartial<T> = T extends (...args: any[]) => any ? T : T extends object ? {
31
31
  [P in keyof T]?: DeepPartial<T[P]>;
32
32
  } : T;
@@ -75,7 +75,7 @@ export declare class VideoStream<T extends VideoStreamDetails = VideoStreamDetai
75
75
  * @param options - The options for the snapshot.
76
76
  * @returns The captured data.
77
77
  */
78
- getSnapshot({ width, height, outputFormat, mimeType, quality }?: VideoStreamGetSnapshotOptions): string | THREE.Texture | ImageData | null;
78
+ getSnapshot({ width, height, outputFormat, mimeType, quality, }?: VideoStreamGetSnapshotOptions): string | THREE.Texture<unknown> | ImageData | null;
79
79
  /**
80
80
  * Stops the current video stream tracks.
81
81
  */
@@ -46,7 +46,7 @@ export declare class World extends Script {
46
46
  * Initializes the world-sensing modules based on the provided configuration.
47
47
  * This method is called automatically by the XRCore.
48
48
  */
49
- init({ options, camera }: {
49
+ init({ options, camera, }: {
50
50
  options: WorldOptions;
51
51
  camera: THREE.Camera;
52
52
  }): Promise<void>;
@@ -39,7 +39,7 @@ export declare class ObjectDetector extends Script {
39
39
  * Initializes the ObjectDetector.
40
40
  * @override
41
41
  */
42
- init({ options, ai, aiOptions, deviceCamera, depth, camera }: {
42
+ init({ options, ai, aiOptions, deviceCamera, depth, camera, }: {
43
43
  options: WorldOptions;
44
44
  ai: AI;
45
45
  aiOptions: AIOptions;
@@ -27,7 +27,7 @@ export declare class PlaneDetector extends Script {
27
27
  /**
28
28
  * Initializes the PlaneDetector.
29
29
  */
30
- init({ options, renderer }: {
30
+ init({ options, renderer, }: {
31
31
  options: WorldOptions;
32
32
  renderer: THREE.WebGLRenderer;
33
33
  }): void;
@@ -31,6 +31,9 @@ export * from './input/components/HandJointNames';
31
31
  export * from './input/GazeController';
32
32
  export * from './input/Hands';
33
33
  export * from './input/HandsOptions';
34
+ export * from './input/gestures/GestureRecognition';
35
+ export * from './input/gestures/GestureRecognitionOptions';
36
+ export * from './input/gestures/GestureEvents';
34
37
  export * from './input/Input';
35
38
  export * from './input/MouseController';
36
39
  export * from './lighting/Lighting';