iwer 2.1.0 → 2.2.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/iwer.js +2121 -1399
- package/build/iwer.min.js +52 -11
- package/build/iwer.module.js +2114 -1400
- package/build/iwer.module.min.js +52 -11
- package/lib/action/ActionPlayer.d.ts.map +1 -1
- package/lib/action/ActionPlayer.js.map +1 -1
- package/lib/action/ActionRecorder.d.ts.map +1 -1
- package/lib/action/ActionRecorder.js +1 -1
- package/lib/action/ActionRecorder.js.map +1 -1
- package/lib/anchors/XRAnchor.d.ts.map +1 -1
- package/lib/anchors/XRAnchor.js.map +1 -1
- package/lib/device/XRController.d.ts +20 -0
- package/lib/device/XRController.d.ts.map +1 -1
- package/lib/device/XRController.js +56 -0
- package/lib/device/XRController.js.map +1 -1
- package/lib/device/XRDevice.d.ts +43 -1
- package/lib/device/XRDevice.d.ts.map +1 -1
- package/lib/device/XRDevice.js +96 -3
- package/lib/device/XRDevice.js.map +1 -1
- package/lib/device/XRHandInput.d.ts.map +1 -1
- package/lib/device/XRHandInput.js.map +1 -1
- package/lib/device/XRTrackedInput.d.ts.map +1 -1
- package/lib/device/XRTrackedInput.js.map +1 -1
- package/lib/device/configs/controller/meta.js.map +1 -1
- package/lib/device/configs/hand/pinch.js.map +1 -1
- package/lib/device/configs/hand/point.js.map +1 -1
- package/lib/device/configs/hand/relaxed.js.map +1 -1
- package/lib/device/configs/headset/meta.js.map +1 -1
- package/lib/events/XRInputSourceEvent.d.ts.map +1 -1
- package/lib/events/XRInputSourceEvent.js.map +1 -1
- package/lib/events/XRInputSourcesChangeEvent.d.ts.map +1 -1
- package/lib/events/XRInputSourcesChangeEvent.js.map +1 -1
- package/lib/events/XRReferenceSpaceEvent.d.ts.map +1 -1
- package/lib/events/XRReferenceSpaceEvent.js.map +1 -1
- package/lib/events/XRSessionEvent.d.ts.map +1 -1
- package/lib/events/XRSessionEvent.js.map +1 -1
- package/lib/frameloop/XRFrame.d.ts.map +1 -1
- package/lib/frameloop/XRFrame.js.map +1 -1
- package/lib/gamepad/Gamepad.d.ts.map +1 -1
- package/lib/gamepad/Gamepad.js.map +1 -1
- package/lib/hittest/XRHitTest.d.ts.map +1 -1
- package/lib/hittest/XRHitTest.js.map +1 -1
- package/lib/hittest/XRRay.d.ts.map +1 -1
- package/lib/hittest/XRRay.js.map +1 -1
- package/lib/index.d.ts +4 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -0
- package/lib/index.js.map +1 -1
- package/lib/initialization/XRSystem.d.ts.map +1 -1
- package/lib/initialization/XRSystem.js.map +1 -1
- package/lib/input/XRHand.d.ts.map +1 -1
- package/lib/input/XRHand.js.map +1 -1
- package/lib/input/XRInputSource.d.ts.map +1 -1
- package/lib/input/XRInputSource.js.map +1 -1
- package/lib/labels/labels.d.ts.map +1 -1
- package/lib/labels/labels.js.map +1 -1
- package/lib/layers/XRWebGLLayer.d.ts.map +1 -1
- package/lib/layers/XRWebGLLayer.js.map +1 -1
- package/lib/meshes/XRMesh.d.ts.map +1 -1
- package/lib/meshes/XRMesh.js.map +1 -1
- package/lib/planes/XRPlane.d.ts.map +1 -1
- package/lib/planes/XRPlane.js.map +1 -1
- package/lib/pose/XRJointPose.d.ts.map +1 -1
- package/lib/pose/XRJointPose.js.map +1 -1
- package/lib/pose/XRPose.d.ts.map +1 -1
- package/lib/pose/XRPose.js.map +1 -1
- package/lib/pose/XRViewerPose.d.ts.map +1 -1
- package/lib/pose/XRViewerPose.js.map +1 -1
- package/lib/primitives/XRRigidTransform.d.ts.map +1 -1
- package/lib/primitives/XRRigidTransform.js.map +1 -1
- package/lib/remote/RemoteControlInterface.d.ts +172 -0
- package/lib/remote/RemoteControlInterface.d.ts.map +1 -0
- package/lib/remote/RemoteControlInterface.js +1194 -0
- package/lib/remote/RemoteControlInterface.js.map +1 -0
- package/lib/remote/index.d.ts +9 -0
- package/lib/remote/index.d.ts.map +1 -0
- package/lib/remote/index.js +8 -0
- package/lib/remote/index.js.map +1 -0
- package/lib/remote/types.d.ts +348 -0
- package/lib/remote/types.d.ts.map +1 -0
- package/lib/remote/types.js +8 -0
- package/lib/remote/types.js.map +1 -0
- package/lib/session/XRRenderState.d.ts.map +1 -1
- package/lib/session/XRRenderState.js.map +1 -1
- package/lib/session/XRSession.d.ts.map +1 -1
- package/lib/session/XRSession.js.map +1 -1
- package/lib/spaces/XRJointSpace.d.ts.map +1 -1
- package/lib/spaces/XRJointSpace.js.map +1 -1
- package/lib/spaces/XRReferenceSpace.d.ts.map +1 -1
- package/lib/spaces/XRReferenceSpace.js.map +1 -1
- package/lib/spaces/XRSpace.d.ts.map +1 -1
- package/lib/spaces/XRSpace.js.map +1 -1
- package/lib/types/state.d.ts +46 -0
- package/lib/types/state.d.ts.map +1 -0
- package/lib/types/state.js +8 -0
- package/lib/types/state.js.map +1 -0
- package/lib/utils/Math.d.ts.map +1 -1
- package/lib/utils/Math.js.map +1 -1
- package/lib/utils/control-math.d.ts +64 -0
- package/lib/utils/control-math.d.ts.map +1 -0
- package/lib/utils/control-math.js +238 -0
- package/lib/utils/control-math.js.map +1 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/views/XRView.d.ts.map +1 -1
- package/lib/views/XRView.js.map +1 -1
- package/lib/views/XRViewport.d.ts.map +1 -1
- package/lib/views/XRViewport.js.map +1 -1
- package/package.json +66 -61
- package/lib/layers/XRWebGLBinding.d.ts +0 -92
- package/lib/layers/XRWebGLBinding.d.ts.map +0 -1
- package/lib/layers/XRWebGLBinding.js +0 -186
- package/lib/layers/XRWebGLBinding.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,63 +1,68 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
2
|
+
"name": "iwer",
|
|
3
|
+
"version": "2.2.0",
|
|
4
|
+
"description": "Javascript WebXR Runtime for Emulation",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"types": "lib/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"build",
|
|
10
|
+
"lib"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"prebuild": "node -p \"'export const VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > src/version.ts",
|
|
14
|
+
"build": "tsc && rollup -c",
|
|
15
|
+
"doc": "typedoc",
|
|
16
|
+
"format": "prettier --write ./src/**/*",
|
|
17
|
+
"test": "jest",
|
|
18
|
+
"prepublishOnly": "npm run build",
|
|
19
|
+
"docs:dev": "vitepress dev docs",
|
|
20
|
+
"docs:build": "vitepress build docs",
|
|
21
|
+
"docs:preview": "vitepress preview docs"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/meta-quest/immersive-web-emulation-runtime.git"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [],
|
|
28
|
+
"author": "Felix Zhang <fe1ix@meta.com>",
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/meta-quest/immersive-web-emulation-runtime/issues"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://github.com/meta-quest/immersive-web-emulation-runtime#readme",
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@rollup/plugin-commonjs": "^25.0.7",
|
|
36
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
37
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
38
|
+
"@types/gl-matrix": "^3.2.0",
|
|
39
|
+
"@types/jest": "^29.5.11",
|
|
40
|
+
"@types/node": "^18.7.13",
|
|
41
|
+
"@types/three": "^0.149.0",
|
|
42
|
+
"@types/uuid": "^9.0.8",
|
|
43
|
+
"@types/webxr": "^0.5.8",
|
|
44
|
+
"@typescript-eslint/eslint-plugin": "^8.56.0",
|
|
45
|
+
"@typescript-eslint/parser": "^8.56.0",
|
|
46
|
+
"eslint": "^9.39.3",
|
|
47
|
+
"eslint-config-prettier": "^10.1.8",
|
|
48
|
+
"eslint-plugin-import": "^2.32.0",
|
|
49
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
50
|
+
"jest": "^29.7.0",
|
|
51
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
52
|
+
"prettier": "^3.0.3",
|
|
53
|
+
"renamer": "^4.0.0",
|
|
54
|
+
"rimraf": "^5.0.5",
|
|
55
|
+
"rollup": "^2.79.1",
|
|
56
|
+
"ts-jest": "^29.1.1",
|
|
57
|
+
"typescript": "^4.9.5",
|
|
58
|
+
"vitepress": "^2.0.0-alpha.16"
|
|
59
|
+
},
|
|
60
|
+
"overrides": {
|
|
61
|
+
"ajv": "^8.18.0",
|
|
62
|
+
"minimatch": "^10.0.0"
|
|
63
|
+
},
|
|
64
|
+
"dependencies": {
|
|
65
|
+
"gl-matrix": "^3.4.3",
|
|
66
|
+
"webxr-layers-polyfill": "^1.1.0"
|
|
67
|
+
}
|
|
63
68
|
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
import { XRSession } from '../session/XRSession.js';
|
|
8
|
-
type XRWebGLBindingInit = {
|
|
9
|
-
antialias?: boolean;
|
|
10
|
-
depth?: boolean;
|
|
11
|
-
stencil?: boolean;
|
|
12
|
-
alpha?: boolean;
|
|
13
|
-
ignoreDepthValues?: boolean;
|
|
14
|
-
framebufferScaleFactor?: number;
|
|
15
|
-
};
|
|
16
|
-
type XRProjectionLayerInit = {
|
|
17
|
-
colorFormat?: number;
|
|
18
|
-
depthFormat?: number;
|
|
19
|
-
scaleFactor?: number;
|
|
20
|
-
textureType?: string;
|
|
21
|
-
layout?: string;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* XRProjectionLayer implementation that mimics the behavior of XRWebGLLayer
|
|
25
|
-
* but with the projection layer API surface.
|
|
26
|
-
*/
|
|
27
|
-
declare class XRProjectionLayer {
|
|
28
|
-
private context;
|
|
29
|
-
private _fixedFoveation;
|
|
30
|
-
constructor(_session: XRSession, context: WebGLRenderingContext | WebGL2RenderingContext, _init?: XRProjectionLayerInit);
|
|
31
|
-
/**
|
|
32
|
-
* Texture width - maps to XRWebGLLayer.framebufferWidth
|
|
33
|
-
*/
|
|
34
|
-
get textureWidth(): number;
|
|
35
|
-
/**
|
|
36
|
-
* Texture height - maps to XRWebGLLayer.framebufferHeight
|
|
37
|
-
*/
|
|
38
|
-
get textureHeight(): number;
|
|
39
|
-
/**
|
|
40
|
-
* Ignore depth values - matches XRWebGLLayer behavior
|
|
41
|
-
*/
|
|
42
|
-
get ignoreDepthValues(): boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Fixed foveation setting
|
|
45
|
-
*/
|
|
46
|
-
get fixedFoveation(): number;
|
|
47
|
-
set fixedFoveation(value: number);
|
|
48
|
-
/**
|
|
49
|
-
* Layout type for the projection layer
|
|
50
|
-
*/
|
|
51
|
-
get layout(): string;
|
|
52
|
-
/**
|
|
53
|
-
* Blend texture source alpha
|
|
54
|
-
*/
|
|
55
|
-
get blendTextureSourceAlpha(): boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Chromatic aberration correction
|
|
58
|
-
*/
|
|
59
|
-
get chromaticAberrationCorrection(): boolean;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* XRWebGLBinding provides methods to create WebGL resources
|
|
63
|
-
* that are compatible with WebXR rendering.
|
|
64
|
-
*
|
|
65
|
-
* This implementation provides a polyfill that ensures three.js r179+
|
|
66
|
-
* gets the same behavior as the XRWebGLLayer fallback path.
|
|
67
|
-
*/
|
|
68
|
-
export declare class XRWebGLBinding {
|
|
69
|
-
private session;
|
|
70
|
-
private context;
|
|
71
|
-
constructor(session: XRSession, context: WebGLRenderingContext | WebGL2RenderingContext, _layerInit?: XRWebGLBindingInit);
|
|
72
|
-
/**
|
|
73
|
-
* Creates a projection layer that behaves exactly like XRWebGLLayer
|
|
74
|
-
* but with the projection layer API surface that three.js r179+ expects.
|
|
75
|
-
*/
|
|
76
|
-
createProjectionLayer(init?: XRProjectionLayerInit): XRProjectionLayer;
|
|
77
|
-
/**
|
|
78
|
-
* Gets the viewport for a given view and layer.
|
|
79
|
-
* This is used by three.js for sub-image rendering.
|
|
80
|
-
*/
|
|
81
|
-
getViewSubImage(_layer: any, _view: any): any;
|
|
82
|
-
/**
|
|
83
|
-
* Gets a depth sub-image for the given layer and view.
|
|
84
|
-
*/
|
|
85
|
-
getDepthSubImage(_layer: any, _view: any): any;
|
|
86
|
-
/**
|
|
87
|
-
* Gets the native framebuffer scale factor.
|
|
88
|
-
*/
|
|
89
|
-
static getNativeFramebufferScaleFactor(session: XRSession): number;
|
|
90
|
-
}
|
|
91
|
-
export {};
|
|
92
|
-
//# sourceMappingURL=XRWebGLBinding.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"XRWebGLBinding.d.ts","sourceRoot":"","sources":["../../src/layers/XRWebGLBinding.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,KAAK,kBAAkB,GAAG;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,sBAAsB,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC;AAEF,KAAK,qBAAqB,GAAG;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;GAGG;AACH,cAAM,iBAAiB;IACtB,OAAO,CAAC,OAAO,CAAiD;IAChE,OAAO,CAAC,eAAe,CAAa;gBAGnC,QAAQ,EAAE,SAAS,EACnB,OAAO,EAAE,qBAAqB,GAAG,sBAAsB,EACvD,KAAK,GAAE,qBAA0B;IAYlC;;OAEG;IACH,IAAI,YAAY,IAAI,MAAM,CAIzB;IAED;;OAEG;IACH,IAAI,aAAa,IAAI,MAAM,CAI1B;IAED;;OAEG;IACH,IAAI,iBAAiB,IAAI,OAAO,CAG/B;IAED;;OAEG;IACH,IAAI,cAAc,IAAI,MAAM,CAG3B;IAED,IAAI,cAAc,CAAC,KAAK,EAAE,MAAM,EAG/B;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,CAGnB;IAED;;OAEG;IACH,IAAI,uBAAuB,IAAI,OAAO,CAGrC;IAED;;OAEG;IACH,IAAI,6BAA6B,IAAI,OAAO,CAG3C;CACD;AAED;;;;;;GAMG;AACH,qBAAa,cAAc;IAC1B,OAAO,CAAC,OAAO,CAAY;IAC3B,OAAO,CAAC,OAAO,CAAiD;gBAG/D,OAAO,EAAE,SAAS,EAClB,OAAO,EAAE,qBAAqB,GAAG,sBAAsB,EACvD,UAAU,GAAE,kBAAuB;IAqCpC;;;OAGG;IACH,qBAAqB,CAAC,IAAI,GAAE,qBAA0B,GAAG,iBAAiB;IAe1E;;;OAGG;IACH,eAAe,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,GAAG,GAAG;IAsB7C;;OAEG;IACH,gBAAgB,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,GAAG,GAAG;IAW9C;;OAEG;IACH,MAAM,CAAC,+BAA+B,CAAC,OAAO,EAAE,SAAS,GAAG,MAAM;CAiBlE"}
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
import { P_SESSION } from '../private.js';
|
|
8
|
-
import { XRSession } from '../session/XRSession.js';
|
|
9
|
-
/**
|
|
10
|
-
* XRProjectionLayer implementation that mimics the behavior of XRWebGLLayer
|
|
11
|
-
* but with the projection layer API surface.
|
|
12
|
-
*/
|
|
13
|
-
class XRProjectionLayer {
|
|
14
|
-
constructor(_session, context, _init = {}) {
|
|
15
|
-
this._fixedFoveation = 0;
|
|
16
|
-
console.log('[IWER] XRProjectionLayer constructor:', {
|
|
17
|
-
context: context.constructor.name,
|
|
18
|
-
canvas: context.canvas,
|
|
19
|
-
drawingBufferWidth: context.drawingBufferWidth,
|
|
20
|
-
drawingBufferHeight: context.drawingBufferHeight,
|
|
21
|
-
init: _init
|
|
22
|
-
});
|
|
23
|
-
this.context = context;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Texture width - maps to XRWebGLLayer.framebufferWidth
|
|
27
|
-
*/
|
|
28
|
-
get textureWidth() {
|
|
29
|
-
const width = this.context.drawingBufferWidth;
|
|
30
|
-
console.log('[IWER] XRProjectionLayer.textureWidth:', width);
|
|
31
|
-
return width;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Texture height - maps to XRWebGLLayer.framebufferHeight
|
|
35
|
-
*/
|
|
36
|
-
get textureHeight() {
|
|
37
|
-
const height = this.context.drawingBufferHeight;
|
|
38
|
-
console.log('[IWER] XRProjectionLayer.textureHeight:', height);
|
|
39
|
-
return height;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Ignore depth values - matches XRWebGLLayer behavior
|
|
43
|
-
*/
|
|
44
|
-
get ignoreDepthValues() {
|
|
45
|
-
console.log('[IWER] XRProjectionLayer.ignoreDepthValues: true');
|
|
46
|
-
return true;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Fixed foveation setting
|
|
50
|
-
*/
|
|
51
|
-
get fixedFoveation() {
|
|
52
|
-
console.log('[IWER] XRProjectionLayer.fixedFoveation get:', this._fixedFoveation);
|
|
53
|
-
return this._fixedFoveation;
|
|
54
|
-
}
|
|
55
|
-
set fixedFoveation(value) {
|
|
56
|
-
console.log('[IWER] XRProjectionLayer.fixedFoveation set:', value);
|
|
57
|
-
this._fixedFoveation = value;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Layout type for the projection layer
|
|
61
|
-
*/
|
|
62
|
-
get layout() {
|
|
63
|
-
console.log('[IWER] XRProjectionLayer.layout: mono');
|
|
64
|
-
return 'mono';
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Blend texture source alpha
|
|
68
|
-
*/
|
|
69
|
-
get blendTextureSourceAlpha() {
|
|
70
|
-
console.log('[IWER] XRProjectionLayer.blendTextureSourceAlpha: false');
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Chromatic aberration correction
|
|
75
|
-
*/
|
|
76
|
-
get chromaticAberrationCorrection() {
|
|
77
|
-
console.log('[IWER] XRProjectionLayer.chromaticAberrationCorrection: true');
|
|
78
|
-
return true;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* XRWebGLBinding provides methods to create WebGL resources
|
|
83
|
-
* that are compatible with WebXR rendering.
|
|
84
|
-
*
|
|
85
|
-
* This implementation provides a polyfill that ensures three.js r179+
|
|
86
|
-
* gets the same behavior as the XRWebGLLayer fallback path.
|
|
87
|
-
*/
|
|
88
|
-
export class XRWebGLBinding {
|
|
89
|
-
constructor(session, context, _layerInit = {}) {
|
|
90
|
-
console.log('[IWER] XRWebGLBinding constructor called:', {
|
|
91
|
-
session: session.constructor.name,
|
|
92
|
-
context: context.constructor.name,
|
|
93
|
-
canvas: context.canvas,
|
|
94
|
-
drawingBufferWidth: context.drawingBufferWidth,
|
|
95
|
-
drawingBufferHeight: context.drawingBufferHeight,
|
|
96
|
-
layerInit: _layerInit
|
|
97
|
-
});
|
|
98
|
-
// Validate session
|
|
99
|
-
if (!(session instanceof XRSession)) {
|
|
100
|
-
console.error('[IWER] XRWebGLBinding: Invalid session type');
|
|
101
|
-
throw new TypeError('XRWebGLBinding constructor argument 1 is not of type XRSession');
|
|
102
|
-
}
|
|
103
|
-
// Check if session has ended
|
|
104
|
-
if (session[P_SESSION].ended) {
|
|
105
|
-
console.error('[IWER] XRWebGLBinding: Session has ended');
|
|
106
|
-
throw new DOMException('Session has ended', 'InvalidStateError');
|
|
107
|
-
}
|
|
108
|
-
// Validate WebGL context
|
|
109
|
-
if (!context || (!(context instanceof WebGLRenderingContext) &&
|
|
110
|
-
!(context instanceof WebGL2RenderingContext))) {
|
|
111
|
-
console.error('[IWER] XRWebGLBinding: Invalid WebGL context');
|
|
112
|
-
throw new TypeError('XRWebGLBinding constructor argument 2 is not a valid WebGL context');
|
|
113
|
-
}
|
|
114
|
-
this.session = session;
|
|
115
|
-
this.context = context;
|
|
116
|
-
console.log('[IWER] XRWebGLBinding constructor completed successfully');
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Creates a projection layer that behaves exactly like XRWebGLLayer
|
|
120
|
-
* but with the projection layer API surface that three.js r179+ expects.
|
|
121
|
-
*/
|
|
122
|
-
createProjectionLayer(init = {}) {
|
|
123
|
-
console.log('[IWER] XRWebGLBinding.createProjectionLayer called with init:', init);
|
|
124
|
-
const projectionLayer = new XRProjectionLayer(this.session, this.context, init);
|
|
125
|
-
console.log('[IWER] XRWebGLBinding.createProjectionLayer created layer:', {
|
|
126
|
-
textureWidth: projectionLayer.textureWidth,
|
|
127
|
-
textureHeight: projectionLayer.textureHeight,
|
|
128
|
-
ignoreDepthValues: projectionLayer.ignoreDepthValues,
|
|
129
|
-
layout: projectionLayer.layout
|
|
130
|
-
});
|
|
131
|
-
return projectionLayer;
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Gets the viewport for a given view and layer.
|
|
135
|
-
* This is used by three.js for sub-image rendering.
|
|
136
|
-
*/
|
|
137
|
-
getViewSubImage(_layer, _view) {
|
|
138
|
-
console.log('[IWER] XRWebGLBinding.getViewSubImage called:', {
|
|
139
|
-
layer: _layer,
|
|
140
|
-
view: _view
|
|
141
|
-
});
|
|
142
|
-
// For emulation, return a basic sub-image that matches the canvas dimensions
|
|
143
|
-
const canvas = this.context.canvas;
|
|
144
|
-
const result = {
|
|
145
|
-
viewport: {
|
|
146
|
-
x: 0,
|
|
147
|
-
y: 0,
|
|
148
|
-
width: canvas.width || this.context.drawingBufferWidth,
|
|
149
|
-
height: canvas.height || this.context.drawingBufferHeight,
|
|
150
|
-
},
|
|
151
|
-
texture: null, // three.js will handle texture creation
|
|
152
|
-
};
|
|
153
|
-
console.log('[IWER] XRWebGLBinding.getViewSubImage returning:', result);
|
|
154
|
-
return result;
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Gets a depth sub-image for the given layer and view.
|
|
158
|
-
*/
|
|
159
|
-
getDepthSubImage(_layer, _view) {
|
|
160
|
-
console.log('[IWER] XRWebGLBinding.getDepthSubImage called:', {
|
|
161
|
-
layer: _layer,
|
|
162
|
-
view: _view
|
|
163
|
-
});
|
|
164
|
-
// Return null - depth rendering is handled by three.js WebGLRenderer
|
|
165
|
-
console.log('[IWER] XRWebGLBinding.getDepthSubImage returning: null');
|
|
166
|
-
return null;
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Gets the native framebuffer scale factor.
|
|
170
|
-
*/
|
|
171
|
-
static getNativeFramebufferScaleFactor(session) {
|
|
172
|
-
console.log('[IWER] XRWebGLBinding.getNativeFramebufferScaleFactor called:', session);
|
|
173
|
-
if (!(session instanceof XRSession)) {
|
|
174
|
-
console.error('[IWER] XRWebGLBinding.getNativeFramebufferScaleFactor: Invalid session');
|
|
175
|
-
throw new TypeError('getNativeFramebufferScaleFactor must be passed a session.');
|
|
176
|
-
}
|
|
177
|
-
if (session[P_SESSION].ended) {
|
|
178
|
-
console.log('[IWER] XRWebGLBinding.getNativeFramebufferScaleFactor: Session ended, returning 0.0');
|
|
179
|
-
return 0.0;
|
|
180
|
-
}
|
|
181
|
-
console.log('[IWER] XRWebGLBinding.getNativeFramebufferScaleFactor returning: 1.0');
|
|
182
|
-
// Return 1.0 for emulation - matches XRWebGLLayer implementation
|
|
183
|
-
return 1.0;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
//# sourceMappingURL=XRWebGLBinding.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"XRWebGLBinding.js","sourceRoot":"","sources":["../../src/layers/XRWebGLBinding.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,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