xrblocks 0.3.0 → 0.3.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/build/core/Options.d.ts +1 -3
- package/build/core/components/XRButton.d.ts +1 -1
- package/build/depth/Depth.d.ts +1 -1
- package/build/xrblocks.d.ts +0 -1
- package/build/xrblocks.js +18 -25
- package/build/xrblocks.js.map +1 -1
- package/build/xrblocks.min.js +1 -1
- package/build/xrblocks.min.js.map +1 -1
- package/package.json +1 -1
- package/build/utils/BrowserUtils.d.ts +0 -1
package/build/core/Options.d.ts
CHANGED
|
@@ -105,9 +105,7 @@ export declare class Options {
|
|
|
105
105
|
invalidText: string;
|
|
106
106
|
startSimulatorText: string;
|
|
107
107
|
enableSimulator: boolean;
|
|
108
|
-
|
|
109
|
-
autostartSimulatorOnDesktop: boolean;
|
|
110
|
-
autostartSimulator: boolean;
|
|
108
|
+
alwaysAutostartSimulator: boolean;
|
|
111
109
|
};
|
|
112
110
|
/**
|
|
113
111
|
* Constructs the Options object by merging default values with provided
|
|
@@ -9,7 +9,7 @@ export declare class XRButton {
|
|
|
9
9
|
domElement: HTMLDivElement;
|
|
10
10
|
simulatorButtonElement: HTMLButtonElement;
|
|
11
11
|
xrButtonElement: HTMLButtonElement;
|
|
12
|
-
constructor(sessionManager: WebXRSessionManager, startText?: string, endText?: string, invalidText?: string, startSimulatorText?: string, enableSimulator?: boolean,
|
|
12
|
+
constructor(sessionManager: WebXRSessionManager, startText?: string, endText?: string, invalidText?: string, startSimulatorText?: string, enableSimulator?: boolean, startSimulator?: () => void);
|
|
13
13
|
private createSimulatorButton;
|
|
14
14
|
private createXRButtonElement;
|
|
15
15
|
private onSessionReady;
|
package/build/depth/Depth.d.ts
CHANGED
|
@@ -57,7 +57,7 @@ export declare class Depth {
|
|
|
57
57
|
updateCPUDepthData(depthData: XRCPUDepthInformation, view_id?: number): void;
|
|
58
58
|
updateGPUDepthData(depthData: XRWebGLDepthInformation, view_id?: number): void;
|
|
59
59
|
getTexture(view_id: number): THREE.DataTexture | THREE.ExternalTexture | undefined;
|
|
60
|
-
update(frame
|
|
60
|
+
update(frame?: XRFrame): void;
|
|
61
61
|
updateLocalDepth(frame: XRFrame): void;
|
|
62
62
|
renderOcclusionPass(): void;
|
|
63
63
|
debugLog(): void;
|
package/build/xrblocks.d.ts
CHANGED
|
@@ -99,7 +99,6 @@ export * from './ui/layouts/SpatialPanel';
|
|
|
99
99
|
export * from './ui/layouts/TextScrollerState';
|
|
100
100
|
export * from './ui/layouts/VerticalPager';
|
|
101
101
|
export * from './ui/UI';
|
|
102
|
-
export * from './utils/BrowserUtils';
|
|
103
102
|
export * from './utils/DependencyInjection';
|
|
104
103
|
export * from './utils/HelperConstants';
|
|
105
104
|
export * from './utils/Keycodes';
|
package/build/xrblocks.js
CHANGED
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*
|
|
16
16
|
* @file xrblocks.js
|
|
17
|
-
* @version v0.3.
|
|
18
|
-
* @commitid
|
|
19
|
-
* @builddate 2025-11-
|
|
17
|
+
* @version v0.3.1
|
|
18
|
+
* @commitid 8945d46
|
|
19
|
+
* @builddate 2025-11-04T06:32:35.799Z
|
|
20
20
|
* @description XR Blocks SDK, built from source with the above commit ID.
|
|
21
21
|
* @agent When using with Gemini to create XR apps, use **Gemini Canvas** mode,
|
|
22
22
|
* and follow rules below:
|
|
@@ -1890,10 +1890,6 @@ const xrDeviceCameraUserContinuousOptions = deepFreeze(new DeviceCameraOptions({
|
|
|
1890
1890
|
willCaptureFrequently: true,
|
|
1891
1891
|
}));
|
|
1892
1892
|
|
|
1893
|
-
function onDesktopUserAgent() {
|
|
1894
|
-
return !/Mobi|Android|iPhone/i.test(navigator.userAgent);
|
|
1895
|
-
}
|
|
1896
|
-
|
|
1897
1893
|
const DepthMeshTexturedShader = {
|
|
1898
1894
|
vertexShader: /* glsl */ `
|
|
1899
1895
|
varying vec3 vNormal;
|
|
@@ -3212,22 +3208,19 @@ class Depth {
|
|
|
3212
3208
|
update(frame) {
|
|
3213
3209
|
if (!this.options.enabled)
|
|
3214
3210
|
return;
|
|
3211
|
+
if (!frame)
|
|
3212
|
+
return;
|
|
3215
3213
|
this.updateLocalDepth(frame);
|
|
3216
3214
|
if (this.options.occlusion.enabled) {
|
|
3217
3215
|
this.renderOcclusionPass();
|
|
3218
3216
|
}
|
|
3219
3217
|
}
|
|
3220
3218
|
updateLocalDepth(frame) {
|
|
3221
|
-
if (onDesktopUserAgent()) {
|
|
3222
|
-
return;
|
|
3223
|
-
}
|
|
3224
3219
|
const leftCamera = this.renderer.xr?.getCamera?.()?.cameras?.[0];
|
|
3225
3220
|
if (leftCamera && this.depthMesh && this.depthMesh.parent != leftCamera) {
|
|
3226
3221
|
leftCamera.add(this.depthMesh);
|
|
3227
3222
|
this.scene.add(leftCamera);
|
|
3228
3223
|
}
|
|
3229
|
-
if (!frame)
|
|
3230
|
-
return;
|
|
3231
3224
|
const session = frame.session;
|
|
3232
3225
|
const binding = this.renderer.xr.getBinding();
|
|
3233
3226
|
// Enable or disable depth based on the number of clients.
|
|
@@ -4401,7 +4394,7 @@ class WebXRSessionManager extends THREE.EventDispatcher {
|
|
|
4401
4394
|
const XRBUTTON_WRAPPER_ID = 'XRButtonWrapper';
|
|
4402
4395
|
const XRBUTTON_CLASS = 'XRButton';
|
|
4403
4396
|
class XRButton {
|
|
4404
|
-
constructor(sessionManager, startText = 'ENTER XR', endText = 'END XR', invalidText = 'XR NOT SUPPORTED', startSimulatorText = 'START SIMULATOR', enableSimulator = false,
|
|
4397
|
+
constructor(sessionManager, startText = 'ENTER XR', endText = 'END XR', invalidText = 'XR NOT SUPPORTED', startSimulatorText = 'START SIMULATOR', enableSimulator = false, startSimulator = () => { }) {
|
|
4405
4398
|
this.sessionManager = sessionManager;
|
|
4406
4399
|
this.startText = startText;
|
|
4407
4400
|
this.endText = endText;
|
|
@@ -4413,8 +4406,7 @@ class XRButton {
|
|
|
4413
4406
|
this.xrButtonElement = document.createElement('button');
|
|
4414
4407
|
this.domElement.id = XRBUTTON_WRAPPER_ID;
|
|
4415
4408
|
this.createXRButtonElement();
|
|
4416
|
-
if (enableSimulator
|
|
4417
|
-
(onDesktopUserAgent() || showSimulatorButtonOnMobile)) {
|
|
4409
|
+
if (enableSimulator) {
|
|
4418
4410
|
this.createSimulatorButton();
|
|
4419
4411
|
}
|
|
4420
4412
|
this.sessionManager.addEventListener(WebXRSessionEventType.UNSUPPORTED, this.showXRNotSupported.bind(this));
|
|
@@ -7432,10 +7424,8 @@ class Options {
|
|
|
7432
7424
|
invalidText: 'XR Not Supported',
|
|
7433
7425
|
startSimulatorText: 'Enter Simulator',
|
|
7434
7426
|
enableSimulator: true,
|
|
7435
|
-
|
|
7436
|
-
|
|
7437
|
-
// Whether to always autostart the simulator.
|
|
7438
|
-
autostartSimulator: false,
|
|
7427
|
+
// Whether to autostart the simulator even if WebXR is available.
|
|
7428
|
+
alwaysAutostartSimulator: false,
|
|
7439
7429
|
};
|
|
7440
7430
|
deepMerge(this, options);
|
|
7441
7431
|
}
|
|
@@ -14597,14 +14587,17 @@ class Core {
|
|
|
14597
14587
|
this.webXRSessionManager.addEventListener(WebXRSessionEventType.SESSION_START, (event) => this.onXRSessionStarted(event.session));
|
|
14598
14588
|
this.webXRSessionManager.addEventListener(WebXRSessionEventType.SESSION_END, this.onXRSessionEnded.bind(this));
|
|
14599
14589
|
// Sets up xrButton.
|
|
14600
|
-
|
|
14601
|
-
(this.options.xrButton.autostartSimulatorOnDesktop &&
|
|
14602
|
-
this.options.xrButton.enableSimulator &&
|
|
14603
|
-
onDesktopUserAgent());
|
|
14590
|
+
let shouldAutostartSimulator = this.options.xrButton.alwaysAutostartSimulator;
|
|
14604
14591
|
if (!shouldAutostartSimulator && options.xrButton.enabled) {
|
|
14605
|
-
this.xrButton = new XRButton(this.webXRSessionManager, options.xrButton?.startText, options.xrButton?.endText, options.xrButton?.invalidText, options.xrButton?.startSimulatorText, options.xrButton?.enableSimulator,
|
|
14592
|
+
this.xrButton = new XRButton(this.webXRSessionManager, options.xrButton?.startText, options.xrButton?.endText, options.xrButton?.invalidText, options.xrButton?.startSimulatorText, options.xrButton?.enableSimulator, this.startSimulator.bind(this));
|
|
14606
14593
|
document.body.appendChild(this.xrButton.domElement);
|
|
14607
14594
|
}
|
|
14595
|
+
this.webXRSessionManager.addEventListener(WebXRSessionEventType.UNSUPPORTED, () => {
|
|
14596
|
+
if (this.options.xrButton.enableSimulator) {
|
|
14597
|
+
this.xrButton?.domElement.remove();
|
|
14598
|
+
shouldAutostartSimulator = true;
|
|
14599
|
+
}
|
|
14600
|
+
});
|
|
14608
14601
|
await this.webXRSessionManager.initialize();
|
|
14609
14602
|
// Sets up postprocessing effects.
|
|
14610
14603
|
if (options.usePostprocessing) {
|
|
@@ -16825,5 +16818,5 @@ class VideoFileStream extends VideoStream {
|
|
|
16825
16818
|
}
|
|
16826
16819
|
}
|
|
16827
16820
|
|
|
16828
|
-
export { AI, AIOptions, AVERAGE_IPD_METERS, ActiveControllers, Agent, AnimatableNumber, AudioListener, AudioPlayer, BACK, BackgroundMusic, CategoryVolumes, Col, Core, CoreSound, DEFAULT_DEVICE_CAMERA_HEIGHT, DEFAULT_DEVICE_CAMERA_WIDTH, DOWN, Depth, DepthMesh, DepthMeshOptions, DepthOptions, DepthTextures, DetectedObject, DetectedPlane, DeviceCameraOptions, DragManager, DragMode, ExitButton, FORWARD, FreestandingSlider, GazeController, Gemini, GeminiOptions, GenerateSkyboxTool, GestureRecognition, GestureRecognitionOptions, GetWeatherTool, Grid, HAND_BONE_IDX_CONNECTION_MAP, HAND_JOINT_COUNT, HAND_JOINT_IDX_CONNECTION_MAP, HAND_JOINT_NAMES, Handedness, Hands, HandsOptions, HorizontalPager, IconButton, IconView, ImageView, Input, InputOptions, Keycodes, LEFT, LEFT_VIEW_ONLY_LAYER, LabelView, Lighting, LightingOptions, LoadingSpinnerManager, MaterialSymbolsView, MeshScript, ModelLoader, ModelViewer, MouseController, NEXT_SIMULATOR_MODE, NUM_HANDS, OCCLUDABLE_ITEMS_LAYER, ObjectDetector, ObjectsOptions, OcclusionPass, OcclusionUtils, OpenAI, OpenAIOptions, Options, PageIndicator, Pager, PagerState, Panel, PanelMesh, Physics, PhysicsOptions, PinchOnButtonAction, PlaneDetector, PlanesOptions, RIGHT, RIGHT_VIEW_ONLY_LAYER, Registry, Reticle, ReticleOptions, RotationRaycastMesh, Row, SIMULATOR_HAND_POSE_NAMES, SIMULATOR_HAND_POSE_TO_JOINTS_LEFT, SIMULATOR_HAND_POSE_TO_JOINTS_RIGHT, SOUND_PRESETS, ScreenshotSynthesizer, Script, ScriptMixin, ScriptsManager, ScrollingTroikaTextView, SetSimulatorModeEvent, ShowHandsAction, Simulator, SimulatorCamera, SimulatorControlMode, SimulatorControllerState, SimulatorControls, SimulatorDepth, SimulatorDepthMaterial, SimulatorHandPose, SimulatorHandPoseChangeRequestEvent, SimulatorHands, SimulatorInterface, SimulatorMediaDeviceInfo, SimulatorMode, SimulatorOptions, SimulatorRenderMode, SimulatorScene, SimulatorUser, SimulatorUserAction, SketchPanel, SkyboxAgent, SoundOptions, SoundSynthesizer, SpatialAudio, SpatialPanel, SpeechRecognizer, SpeechRecognizerOptions, SpeechSynthesizer, SpeechSynthesizerOptions, SplatAnchor, StreamState, TextButton, TextScrollerState, TextView, Tool, UI, UI_OVERLAY_LAYER, UP, UX, User, VIEW_DEPTH_GAP, VerticalPager, VideoFileStream, VideoStream, VideoView, View, VolumeCategory, WaitFrame, WalkTowardsPanelAction, World, WorldOptions, XRButton, XRDeviceCamera, XREffects, XRPass, XRTransitionOptions, XR_BLOCKS_ASSETS_PATH, ZERO_VECTOR3, add, ai, aspectRatios, callInitWithDependencyInjection, clamp, clampRotationToAngle, core, cropImage, extractYaw, getColorHex, getDeltaTime, getUrlParamBool, getUrlParamFloat, getUrlParamInt, getUrlParameter, getVec4ByColorString, getXrCameraLeft, getXrCameraRight, init, initScript, lerp, loadStereoImageAsTextures, loadingSpinnerManager, lookAtRotation, objectIsDescendantOf,
|
|
16821
|
+
export { AI, AIOptions, AVERAGE_IPD_METERS, ActiveControllers, Agent, AnimatableNumber, AudioListener, AudioPlayer, BACK, BackgroundMusic, CategoryVolumes, Col, Core, CoreSound, DEFAULT_DEVICE_CAMERA_HEIGHT, DEFAULT_DEVICE_CAMERA_WIDTH, DOWN, Depth, DepthMesh, DepthMeshOptions, DepthOptions, DepthTextures, DetectedObject, DetectedPlane, DeviceCameraOptions, DragManager, DragMode, ExitButton, FORWARD, FreestandingSlider, GazeController, Gemini, GeminiOptions, GenerateSkyboxTool, GestureRecognition, GestureRecognitionOptions, GetWeatherTool, Grid, HAND_BONE_IDX_CONNECTION_MAP, HAND_JOINT_COUNT, HAND_JOINT_IDX_CONNECTION_MAP, HAND_JOINT_NAMES, Handedness, Hands, HandsOptions, HorizontalPager, IconButton, IconView, ImageView, Input, InputOptions, Keycodes, LEFT, LEFT_VIEW_ONLY_LAYER, LabelView, Lighting, LightingOptions, LoadingSpinnerManager, MaterialSymbolsView, MeshScript, ModelLoader, ModelViewer, MouseController, NEXT_SIMULATOR_MODE, NUM_HANDS, OCCLUDABLE_ITEMS_LAYER, ObjectDetector, ObjectsOptions, OcclusionPass, OcclusionUtils, OpenAI, OpenAIOptions, Options, PageIndicator, Pager, PagerState, Panel, PanelMesh, Physics, PhysicsOptions, PinchOnButtonAction, PlaneDetector, PlanesOptions, RIGHT, RIGHT_VIEW_ONLY_LAYER, Registry, Reticle, ReticleOptions, RotationRaycastMesh, Row, SIMULATOR_HAND_POSE_NAMES, SIMULATOR_HAND_POSE_TO_JOINTS_LEFT, SIMULATOR_HAND_POSE_TO_JOINTS_RIGHT, SOUND_PRESETS, ScreenshotSynthesizer, Script, ScriptMixin, ScriptsManager, ScrollingTroikaTextView, SetSimulatorModeEvent, ShowHandsAction, Simulator, SimulatorCamera, SimulatorControlMode, SimulatorControllerState, SimulatorControls, SimulatorDepth, SimulatorDepthMaterial, SimulatorHandPose, SimulatorHandPoseChangeRequestEvent, SimulatorHands, SimulatorInterface, SimulatorMediaDeviceInfo, SimulatorMode, SimulatorOptions, SimulatorRenderMode, SimulatorScene, SimulatorUser, SimulatorUserAction, SketchPanel, SkyboxAgent, SoundOptions, SoundSynthesizer, SpatialAudio, SpatialPanel, SpeechRecognizer, SpeechRecognizerOptions, SpeechSynthesizer, SpeechSynthesizerOptions, SplatAnchor, StreamState, TextButton, TextScrollerState, TextView, Tool, UI, UI_OVERLAY_LAYER, UP, UX, User, VIEW_DEPTH_GAP, VerticalPager, VideoFileStream, VideoStream, VideoView, View, VolumeCategory, WaitFrame, WalkTowardsPanelAction, World, WorldOptions, XRButton, XRDeviceCamera, XREffects, XRPass, XRTransitionOptions, XR_BLOCKS_ASSETS_PATH, ZERO_VECTOR3, add, ai, aspectRatios, callInitWithDependencyInjection, clamp, clampRotationToAngle, core, cropImage, extractYaw, getColorHex, getDeltaTime, getUrlParamBool, getUrlParamFloat, getUrlParamInt, getUrlParameter, getVec4ByColorString, getXrCameraLeft, getXrCameraRight, init, initScript, lerp, loadStereoImageAsTextures, loadingSpinnerManager, lookAtRotation, objectIsDescendantOf, parseBase64DataURL, placeObjectAtIntersectionFacingTarget, print, rgbToDepthParams, scene, showOnlyInLeftEye, showOnlyInRightEye, showReticleOnDepthMesh, transformRgbToDepthUv, transformRgbUvToWorld, traverseUtil, uninitScript, urlParams, user, world, xrDepthMeshOptions, xrDepthMeshPhysicsOptions, xrDepthMeshVisualizationOptions, xrDeviceCameraEnvironmentContinuousOptions, xrDeviceCameraEnvironmentOptions, xrDeviceCameraUserContinuousOptions, xrDeviceCameraUserOptions };
|
|
16829
16822
|
//# sourceMappingURL=xrblocks.js.map
|