@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
137 lines (136 loc) • 5.04 kB
JavaScript
"use strict";
import { NamedFunction0, NamedFunction1, ObjectNamedFunction1, ObjectNamedFunction2 } from "./_Base";
import { Poly } from "../Poly";
import { dummyReadRefVal } from "../../core/reactivity/CoreReactivity";
import { getOrCreateWebXRTrackerRef } from "../../core/reactivity/WebXRTrackedMarker";
export class getWebXRARHitDetected extends NamedFunction0 {
static type() {
return "getWebXRARHitDetected";
}
func() {
dummyReadRefVal(this.timeController.timeUniform().value);
const arController = this.scene.webXR.activeARController();
return (arController == null ? void 0 : arController.hitDetected()) || false;
}
}
export class getWebXRARHitMatrix extends NamedFunction1 {
static type() {
return "getWebXRARHitMatrix";
}
func(target) {
dummyReadRefVal(this.timeController.timeUniform().value);
const arController = this.scene.webXR.activeARController();
arController == null ? void 0 : arController.hitMatrix(target);
return target;
}
}
export class getWebXRARHitPosition extends NamedFunction1 {
static type() {
return "getWebXRARHitPosition";
}
func(target) {
dummyReadRefVal(this.timeController.timeUniform().value);
const arController = this.scene.webXR.activeARController();
arController == null ? void 0 : arController.hitPosition(target);
return target;
}
}
export class getWebXRARHitQuaternion extends NamedFunction1 {
static type() {
return "getWebXRARHitQuaternion";
}
func(target) {
dummyReadRefVal(this.timeController.timeUniform().value);
const arController = this.scene.webXR.activeARController();
arController == null ? void 0 : arController.hitQuaternion(target);
return target;
}
}
export class getWebXRControllerObject extends ObjectNamedFunction1 {
static type() {
return "getWebXRControllerObject";
}
func(object3D, controllerIndex) {
dummyReadRefVal(this.timeController.timeUniform().value);
const xrController = this.scene.webXR.activeXRController();
return (xrController == null ? void 0 : xrController.getController(controllerIndex).controller) || object3D;
}
}
export class getWebXRControllerRay extends ObjectNamedFunction2 {
static type() {
return "getWebXRControllerRay";
}
func(object3D, controllerIndex, target) {
dummyReadRefVal(this.timeController.timeUniform().value);
const xrController = this.scene.webXR.activeXRController();
const ray = xrController == null ? void 0 : xrController.getController(controllerIndex).ray;
if (ray) {
target.copy(ray);
}
return target;
}
}
export class getWebXRControllerHasAngularVelocity extends ObjectNamedFunction1 {
static type() {
return "getWebXRControllerHasAngularVelocity";
}
func(object3D, controllerIndex) {
dummyReadRefVal(this.timeController.timeUniform().value);
const xrController = this.scene.webXR.activeXRController();
return (xrController == null ? void 0 : xrController.getController(controllerIndex).controller.hasAngularVelocity) || false;
}
}
export class getWebXRControllerAngularVelocity extends ObjectNamedFunction2 {
static type() {
return "getWebXRControllerAngularVelocity";
}
func(object3D, controllerIndex, target) {
dummyReadRefVal(this.timeController.timeUniform().value);
const xrController = this.scene.webXR.activeXRController();
const angularVelocity = xrController == null ? void 0 : xrController.getController(controllerIndex).controller.angularVelocity;
if (angularVelocity) {
target.copy(angularVelocity);
}
return target;
}
}
export class getWebXRControllerHasLinearVelocity extends ObjectNamedFunction1 {
static type() {
return "getWebXRControllerHasLinearVelocity";
}
func(object3D, controllerIndex) {
dummyReadRefVal(this.timeController.timeUniform().value);
const xrController = this.scene.webXR.activeXRController();
return (xrController == null ? void 0 : xrController.getController(controllerIndex).controller.hasLinearVelocity) || false;
}
}
export class getWebXRControllerLinearVelocity extends ObjectNamedFunction2 {
static type() {
return "getWebXRControllerLinearVelocity";
}
func(object3D, controllerIndex, target) {
dummyReadRefVal(this.timeController.timeUniform().value);
const xrController = this.scene.webXR.activeXRController();
const linearVelocity = xrController == null ? void 0 : xrController.getController(controllerIndex).controller.linearVelocity;
if (linearVelocity) {
target.copy(linearVelocity);
}
return target;
}
}
export class getWebXRTrackedMarkerMatrix extends NamedFunction1 {
static type() {
return "getWebXRTrackedMarkerMatrix";
}
func(target) {
dummyReadRefVal(this.timeController.timeUniform().value);
const controller = Poly.thirdParty.markerTracking().controller();
if (controller) {
dummyReadRefVal(getOrCreateWebXRTrackerRef(0).value);
controller.trackedMatrix(target);
} else {
target.identity();
}
return target;
}
}