ovrjs
Version:
OpenVR bindings for NodeJS
81 lines (80 loc) • 4.01 kB
JavaScript
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.bindings = exports.VR_Init = exports.VRSystem = exports.VROverlay = void 0;
var ovr = require('bindings')('openvr');
var VROverlay = /** @class */ (function () {
function VROverlay(name, key) {
this.ivroverlay = new ovr.IVROverlay();
this.handle = this.ivroverlay.CreateOverlay(name, key);
}
VROverlay.prototype.ShowOverlay = function () {
return this.ivroverlay.ShowOverlay(this.handle);
};
VROverlay.prototype.SetOverlayWidthInMetres = function (width) {
return this.ivroverlay.SetOverlayWidthInMetres(this.handle, width);
};
VROverlay.prototype.SetOverlayTextureFromBuffer = function (buffer, width, height) {
return this.ivroverlay.SetOverlayTextureFromBuffer(this.handle, buffer, width, height);
};
/** Sets the color tint of the overlay quad. Use 0.0 to 1.0 per channel. */
VROverlay.prototype.SetOverlayColor = function (red, green, blue) {
return this.ivroverlay.SetOverlayColor(this.handle, red, green, blue);
};
VROverlay.prototype.SetOverlayTransformTrackedDeviceRelative = function (device_index, transform) {
return this.ivroverlay.SetOverlayTransformTrackedDeviceRelative(this.handle, device_index, transform);
};
VROverlay.prototype.SetOverlayTransformAbsolute = function (origin, transform) {
return this.ivroverlay.SetOverlayTransformAbsolute(this.handle, origin, transform);
};
VROverlay.prototype.SetOverlayInputMethod = function (method) {
return this.ivroverlay.SetOverlayInputMethod(this.handle, method);
};
VROverlay.prototype.SetOverlayFlag = function (flag) {
return this.ivroverlay.SetOverlayFlag(this.handle, flag);
};
VROverlay.prototype.PollNextOverlayEvent = function () {
return this.ivroverlay.PollNextOverlayEvent(this.handle);
};
return VROverlay;
}());
exports.VROverlay = VROverlay;
var VRSystem = /** @class */ (function () {
function VRSystem() {
this.ivrsystem = new ovr.IVRSystem();
}
VRSystem.prototype.GetControllerRoleForTrackedDeviceIndex = function (device_index) {
return this.ivrsystem.GetControllerRoleForTrackedDeviceIndex(device_index);
};
VRSystem.prototype.GetBoolTrackedDeviceProperty = function (device_index, property) {
return this.ivrsystem.GetBoolTrackedDeviceProperty(device_index, property);
};
VRSystem.prototype.GetInt32TrackedDeviceProperty = function (device_index, property) {
return this.ivrsystem.GetInt32TrackedDeviceProperty(device_index, property);
};
VRSystem.prototype.GetFloatTrackedDeviceProperty = function (device_index, property) {
return this.ivrsystem.GetFloatTrackedDeviceProperty(device_index, property);
};
VRSystem.prototype.GetStringTrackedDeviceProperty = function (device_index, property) {
return this.ivrsystem.GetStringTrackedDeviceProperty(device_index, property);
};
return VRSystem;
}());
exports.VRSystem = VRSystem;
var VR_Init = function (application_type) { return ovr.VR_Init(application_type); };
exports.VR_Init = VR_Init;
__exportStar(require("./headers"), exports);
exports.bindings = ovr;