1 module libwasm.bindings.VRServiceTest;
2 
3 import libwasm.types;
4 
5 import memutils.ct: tuple;
6 import libwasm.bindings.VRDisplay;
7 
8 @safe:
9 nothrow:
10 
11 struct VRMockController {
12   nothrow:
13   JsHandle handle;
14   alias handle this;
15   this(Handle h) {
16     this.handle = JsHandle(h);
17   }
18   void newButtonEvent()(uint button, bool pressed) {
19     Serialize_Object_VarArgCall!void(this.handle, "newButtonEvent", "uint;bool", tuple(button, pressed));
20   }
21   void newAxisMoveEvent()(uint axis, double value) {
22     Serialize_Object_VarArgCall!void(this.handle, "newAxisMoveEvent", "uint;double", tuple(axis, value));
23   }
24   void newPoseMove(T0, T1, T2, T3, T4, T5)(scope auto ref Optional!(T0) position, scope auto ref Optional!(T1) linearVelocity, scope auto ref Optional!(T2) linearAcceleration, scope auto ref Optional!(T3) orientation, scope auto ref Optional!(T4) angularVelocity, scope auto ref Optional!(T5) angularAcceleration) if (isTOrPointer!(T0, Float32Array) && isTOrPointer!(T1, Float32Array) && isTOrPointer!(T2, Float32Array) && isTOrPointer!(T3, Float32Array) && isTOrPointer!(T4, Float32Array) && isTOrPointer!(T5, Float32Array)) {
25     Serialize_Object_VarArgCall!void(this.handle, "newPoseMove", "Optional!Handle;Optional!Handle;Optional!Handle;Optional!Handle;Optional!Handle;Optional!Handle", tuple(!position.empty, cast(Handle)position.front.handle, !linearVelocity.empty, cast(Handle)linearVelocity.front.handle, !linearAcceleration.empty, cast(Handle)linearAcceleration.front.handle, !orientation.empty, cast(Handle)orientation.front.handle, !angularVelocity.empty, cast(Handle)angularVelocity.front.handle, !angularAcceleration.empty, cast(Handle)angularAcceleration.front.handle));
26   }
27 }
28 struct VRMockDisplay {
29   nothrow:
30   JsHandle handle;
31   alias handle this;
32   this(Handle h) {
33     this.handle = JsHandle(h);
34   }
35   void setEyeResolution()(uint aRenderWidth, uint aRenderHeight) {
36     Serialize_Object_VarArgCall!void(this.handle, "setEyeResolution", "uint;uint", tuple(aRenderWidth, aRenderHeight));
37   }
38   void setEyeParameter()(VREye eye, double offsetX, double offsetY, double offsetZ, double upDegree, double rightDegree, double downDegree, double leftDegree) {
39     Serialize_Object_VarArgCall!void(this.handle, "setEyeParameter", "Enum;double;double;double;double;double;double;double", tuple(eye, offsetX, offsetY, offsetZ, upDegree, rightDegree, downDegree, leftDegree));
40   }
41   void setPose(T0, T1, T2, T3, T4, T5)(scope auto ref Optional!(T0) position, scope auto ref Optional!(T1) linearVelocity, scope auto ref Optional!(T2) linearAcceleration, scope auto ref Optional!(T3) orientation, scope auto ref Optional!(T4) angularVelocity, scope auto ref Optional!(T5) angularAcceleration) if (isTOrPointer!(T0, Float32Array) && isTOrPointer!(T1, Float32Array) && isTOrPointer!(T2, Float32Array) && isTOrPointer!(T3, Float32Array) && isTOrPointer!(T4, Float32Array) && isTOrPointer!(T5, Float32Array)) {
42     Serialize_Object_VarArgCall!void(this.handle, "setPose", "Optional!Handle;Optional!Handle;Optional!Handle;Optional!Handle;Optional!Handle;Optional!Handle", tuple(!position.empty, cast(Handle)position.front.handle, !linearVelocity.empty, cast(Handle)linearVelocity.front.handle, !linearAcceleration.empty, cast(Handle)linearAcceleration.front.handle, !orientation.empty, cast(Handle)orientation.front.handle, !angularVelocity.empty, cast(Handle)angularVelocity.front.handle, !angularAcceleration.empty, cast(Handle)angularAcceleration.front.handle));
43   }
44   void setMountState()(bool isMounted) {
45     Object_Call_bool__void(this.handle, "setMountState", isMounted);
46   }
47   void update()() {
48     Object_Call__void(this.handle, "update");
49   }
50 }
51 struct VRServiceTest {
52   nothrow:
53   JsHandle handle;
54   alias handle this;
55   this(Handle h) {
56     this.handle = JsHandle(h);
57   }
58   auto attachVRDisplay()(string id) {
59     return JsPromise!(VRMockDisplay)(Object_Call_string__Handle(this.handle, "attachVRDisplay", id));
60   }
61   auto attachVRController()(string id) {
62     return JsPromise!(VRMockController)(Object_Call_string__Handle(this.handle, "attachVRController", id));
63   }
64 }
65 
66