@covas-labs/electron-vr 0.3.2 → 0.4.3
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/README.md +3 -2
- package/dist/VROverlay.d.ts +4 -0
- package/dist/VROverlay.js +18 -1
- package/dist/bridge.d.ts +2 -0
- package/dist/bridge.js +3 -0
- package/dist/overlayOptions.d.ts +1 -0
- package/dist/overlayOptions.js +5 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -53,6 +53,7 @@ app.on("ready", async () => {
|
|
|
53
53
|
overlay = await VROverlay.openWindow(window, {
|
|
54
54
|
name: "Status_HUD",
|
|
55
55
|
sizeMeters: 1,
|
|
56
|
+
curvature: 0,
|
|
56
57
|
placement: {
|
|
57
58
|
mode: "head",
|
|
58
59
|
position: { x: 0, y: 0, z: -1.2 },
|
|
@@ -62,9 +63,9 @@ app.on("ready", async () => {
|
|
|
62
63
|
});
|
|
63
64
|
```
|
|
64
65
|
|
|
65
|
-
You can also reposition the overlay later with `overlay.setPlacement(...)`, toggle it with `overlay.setVisible(...)`,
|
|
66
|
+
You can also reposition the overlay later with `overlay.setPlacement(...)`, toggle it with `overlay.setVisible(...)`, resize it in meters with `overlay.setSizeMeters(...)`, and curve it with `overlay.setCurvature(...)`.
|
|
66
67
|
|
|
67
|
-
`sizeMeters` must be greater than zero, and placement values should be finite numbers.
|
|
68
|
+
`sizeMeters` must be greater than zero, `curvature` must be between `0` and `1`, and placement values should be finite numbers. `curvature: 0` keeps the overlay flat. Positive curvature uses OpenVR overlay curvature on OpenVR and `XR_KHR_composition_layer_cylinder` cylinder layers on OpenXR.
|
|
68
69
|
|
|
69
70
|
On Linux, runtime selection prefers `openxr`, then falls back to `openvr`, then to `mock`. Linux OpenVR is treated as a best-effort alternate backend when a compatible OpenVR runtime is installed but the OpenXR overlay path is unavailable or disabled. It is not currently validated end to end on the main development machine or in CI.
|
|
70
71
|
|
package/dist/VROverlay.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export interface VROverlayOptions {
|
|
|
12
12
|
frameRate?: number;
|
|
13
13
|
windowOptions?: OverlayWindowOptions;
|
|
14
14
|
sizeMeters?: number;
|
|
15
|
+
curvature?: number;
|
|
15
16
|
visible?: boolean;
|
|
16
17
|
placement?: {
|
|
17
18
|
mode: "head" | "world";
|
|
@@ -23,6 +24,7 @@ export interface ExistingWindowVROverlayOptions {
|
|
|
23
24
|
name?: string;
|
|
24
25
|
frameRate?: number;
|
|
25
26
|
sizeMeters?: number;
|
|
27
|
+
curvature?: number;
|
|
26
28
|
visible?: boolean;
|
|
27
29
|
placement?: VROverlayOptions["placement"];
|
|
28
30
|
}
|
|
@@ -34,6 +36,7 @@ export declare class VROverlay {
|
|
|
34
36
|
readonly frameRate: number;
|
|
35
37
|
readonly windowOptions?: VROverlayOptions["windowOptions"];
|
|
36
38
|
private sizeMeters;
|
|
39
|
+
private curvature;
|
|
37
40
|
private visible;
|
|
38
41
|
private placement;
|
|
39
42
|
private readonly vrBridge;
|
|
@@ -54,6 +57,7 @@ export declare class VROverlay {
|
|
|
54
57
|
setPlacement(placement: VROverlayOptions["placement"]): boolean;
|
|
55
58
|
setVisible(visible: boolean): boolean;
|
|
56
59
|
setSizeMeters(sizeMeters: number): boolean;
|
|
60
|
+
setCurvature(curvature: number): boolean;
|
|
57
61
|
private initializeBridgeForWindow;
|
|
58
62
|
private readonly onWindowClosed;
|
|
59
63
|
}
|
package/dist/VROverlay.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { app, BrowserWindow } from "electron";
|
|
2
2
|
import { createVrBridge } from "./bridge.js";
|
|
3
|
-
import { assertSizeMeters, normalizePlacement } from "./overlayOptions.js";
|
|
3
|
+
import { assertCurvature, assertSizeMeters, normalizePlacement } from "./overlayOptions.js";
|
|
4
4
|
function mergeWindowOptions(width, height, windowOptions) {
|
|
5
5
|
const requestedOffscreen = windowOptions?.webPreferences?.offscreen;
|
|
6
6
|
const normalizedOffscreen = typeof requestedOffscreen === "object"
|
|
@@ -35,6 +35,7 @@ export class VROverlay {
|
|
|
35
35
|
frameRate;
|
|
36
36
|
windowOptions;
|
|
37
37
|
sizeMeters;
|
|
38
|
+
curvature;
|
|
38
39
|
visible;
|
|
39
40
|
placement;
|
|
40
41
|
vrBridge = createVrBridge();
|
|
@@ -50,6 +51,8 @@ export class VROverlay {
|
|
|
50
51
|
this.windowOptions = options.windowOptions;
|
|
51
52
|
this.sizeMeters = options.sizeMeters ?? 1.0;
|
|
52
53
|
assertSizeMeters(this.sizeMeters);
|
|
54
|
+
this.curvature = options.curvature ?? 0.0;
|
|
55
|
+
assertCurvature(this.curvature);
|
|
53
56
|
this.visible = options.visible ?? true;
|
|
54
57
|
this.placement = normalizePlacement(options.placement);
|
|
55
58
|
}
|
|
@@ -70,6 +73,7 @@ export class VROverlay {
|
|
|
70
73
|
height,
|
|
71
74
|
frameRate: options.frameRate,
|
|
72
75
|
sizeMeters: options.sizeMeters,
|
|
76
|
+
curvature: options.curvature,
|
|
73
77
|
visible: options.visible,
|
|
74
78
|
placement: options.placement
|
|
75
79
|
});
|
|
@@ -174,12 +178,25 @@ export class VROverlay {
|
|
|
174
178
|
}
|
|
175
179
|
return success;
|
|
176
180
|
}
|
|
181
|
+
setCurvature(curvature) {
|
|
182
|
+
assertCurvature(curvature);
|
|
183
|
+
this.curvature = curvature;
|
|
184
|
+
if (!this.isInitialized()) {
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
const success = this.vrBridge.setOverlayCurvature(curvature);
|
|
188
|
+
if (!success) {
|
|
189
|
+
console.error("Failed to update VR overlay curvature:", this.vrBridge.getLastError());
|
|
190
|
+
}
|
|
191
|
+
return success;
|
|
192
|
+
}
|
|
177
193
|
initializeBridgeForWindow(window, width, height) {
|
|
178
194
|
const initialized = this.vrBridge.initialize({
|
|
179
195
|
name: this.overlayName,
|
|
180
196
|
width,
|
|
181
197
|
height,
|
|
182
198
|
sizeMeters: this.sizeMeters,
|
|
199
|
+
curvature: this.curvature,
|
|
183
200
|
visible: this.visible,
|
|
184
201
|
placement: this.placement
|
|
185
202
|
});
|
package/dist/bridge.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ export interface InitializeVROptions {
|
|
|
45
45
|
width: number;
|
|
46
46
|
height: number;
|
|
47
47
|
sizeMeters: number;
|
|
48
|
+
curvature?: number;
|
|
48
49
|
visible: boolean;
|
|
49
50
|
placement: OverlayPlacement;
|
|
50
51
|
}
|
|
@@ -105,6 +106,7 @@ export declare class VrBridge {
|
|
|
105
106
|
setOverlayPlacement(placement: OverlayPlacement): boolean;
|
|
106
107
|
setOverlayVisible(visible: boolean): boolean;
|
|
107
108
|
setOverlaySizeMeters(sizeMeters: number): boolean;
|
|
109
|
+
setOverlayCurvature(curvature: number): boolean;
|
|
108
110
|
shutdown(): void;
|
|
109
111
|
isInitialized(): boolean;
|
|
110
112
|
getLastError(): string | null;
|
package/dist/bridge.js
CHANGED
|
@@ -209,6 +209,9 @@ export class VrBridge {
|
|
|
209
209
|
setOverlaySizeMeters(sizeMeters) {
|
|
210
210
|
return this.addon.setOverlaySizeMeters(sizeMeters);
|
|
211
211
|
}
|
|
212
|
+
setOverlayCurvature(curvature) {
|
|
213
|
+
return this.addon.setOverlayCurvature(curvature);
|
|
214
|
+
}
|
|
212
215
|
shutdown() {
|
|
213
216
|
this.detachWindow();
|
|
214
217
|
this.addon.shutdownVR();
|
package/dist/overlayOptions.d.ts
CHANGED
|
@@ -8,4 +8,5 @@ export declare function isFiniteNumber(value: number): boolean;
|
|
|
8
8
|
export declare function assertVec3(value: Vec3, context: string): void;
|
|
9
9
|
export declare function assertQuat(value: Quat, context: string): void;
|
|
10
10
|
export declare function assertSizeMeters(sizeMeters: number): void;
|
|
11
|
+
export declare function assertCurvature(curvature: number): void;
|
|
11
12
|
export declare function normalizePlacement(placement?: OverlayPlacementInput): OverlayPlacement;
|
package/dist/overlayOptions.js
CHANGED
|
@@ -16,6 +16,11 @@ export function assertSizeMeters(sizeMeters) {
|
|
|
16
16
|
throw new RangeError("sizeMeters must be a finite number greater than zero.");
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
+
export function assertCurvature(curvature) {
|
|
20
|
+
if (!isFiniteNumber(curvature) || curvature < 0 || curvature > 1) {
|
|
21
|
+
throw new RangeError("curvature must be a finite number between 0 and 1.");
|
|
22
|
+
}
|
|
23
|
+
}
|
|
19
24
|
export function normalizePlacement(placement) {
|
|
20
25
|
const mode = placement?.mode ?? "head";
|
|
21
26
|
if (mode !== "head" && mode !== "world") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@covas-labs/electron-vr",
|
|
3
|
-
"version": "0.3
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "Electron VR overlay bridge with OpenXR, OpenVR, and mock fallback backends.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"electron": ">=37"
|
|
23
23
|
},
|
|
24
24
|
"optionalDependencies": {
|
|
25
|
-
"@covas-labs/electron-vr-prebuilt-linux-x64": "0.3
|
|
26
|
-
"@covas-labs/electron-vr-prebuilt-win32-x64": "0.3
|
|
25
|
+
"@covas-labs/electron-vr-prebuilt-linux-x64": "0.4.3",
|
|
26
|
+
"@covas-labs/electron-vr-prebuilt-win32-x64": "0.4.3"
|
|
27
27
|
},
|
|
28
28
|
"publishConfig": {
|
|
29
29
|
"registry": "https://registry.npmjs.org",
|