iwer 2.1.1 → 2.2.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/iwer.js +1760 -5
- package/build/iwer.min.js +12 -12
- package/build/iwer.module.js +1751 -6
- package/build/iwer.module.min.js +12 -12
- package/lib/depth/XRDepthInformation.d.ts +38 -0
- package/lib/depth/XRDepthInformation.d.ts.map +1 -0
- package/lib/depth/XRDepthInformation.js +55 -0
- package/lib/depth/XRDepthInformation.js.map +1 -0
- 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 +45 -1
- package/lib/device/XRDevice.d.ts.map +1 -1
- package/lib/device/XRDevice.js +88 -0
- package/lib/device/XRDevice.js.map +1 -1
- package/lib/frameloop/XRFrame.d.ts +4 -0
- package/lib/frameloop/XRFrame.d.ts.map +1 -1
- package/lib/frameloop/XRFrame.js +12 -1
- package/lib/frameloop/XRFrame.js.map +1 -1
- package/lib/index.d.ts +5 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +6 -0
- package/lib/index.js.map +1 -1
- package/lib/private.d.ts +1 -0
- package/lib/private.d.ts.map +1 -1
- package/lib/private.js +1 -0
- package/lib/private.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 +1240 -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/XRSession.d.ts +7 -0
- package/lib/session/XRSession.d.ts.map +1 -1
- package/lib/session/XRSession.js +42 -0
- package/lib/session/XRSession.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/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/package.json +10 -5
- 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
|
@@ -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,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAmBpD;;;GAGG;AACH,MAAM,iBAAiB;IAItB,YACC,QAAmB,EACnB,OAAuD,EACvD,QAA+B,EAAE;QAL1B,oBAAe,GAAW,CAAC,CAAC;QAOnC,OAAO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