From 0dc13ea95bb147a5a481cf7ac35c256dac7d4d59 Mon Sep 17 00:00:00 2001 From: Toshiya Nakakura Date: Sun, 5 Jul 2015 13:52:33 +0900 Subject: [PATCH] add vrcontrols definition --- threejs/tests/examples/controls/vrcontrols.ts | 18 +++++++++++++++++ threejs/three-tests.ts | 1 + threejs/three-vrcontrols.d.ts | 20 +++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 threejs/tests/examples/controls/vrcontrols.ts create mode 100644 threejs/three-vrcontrols.d.ts diff --git a/threejs/tests/examples/controls/vrcontrols.ts b/threejs/tests/examples/controls/vrcontrols.ts new file mode 100644 index 0000000000..2576e14e8b --- /dev/null +++ b/threejs/tests/examples/controls/vrcontrols.ts @@ -0,0 +1,18 @@ +/// +/// + +var _vrControls = new THREE.VRControls(new THREE.Camera()); + +_vrControls.update(); + +_vrControls.scale = 25; + +window.addEventListener("keydown", (ev) => { + if (ev.keyCode == "R".charCodeAt(0)) { + _vrControls.zeroSensor(); + } +}); + +window.addEventListener("touchstart", (ev) => { + _vrControls.zeroSensor(); +}); diff --git a/threejs/three-tests.ts b/threejs/three-tests.ts index 0693d40bd1..229f0563b0 100644 --- a/threejs/three-tests.ts +++ b/threejs/three-tests.ts @@ -59,3 +59,4 @@ THE SOFTWARE. // examples test. /// +/// diff --git a/threejs/three-vrcontrols.d.ts b/threejs/three-vrcontrols.d.ts new file mode 100644 index 0000000000..d0e47b63a6 --- /dev/null +++ b/threejs/three-vrcontrols.d.ts @@ -0,0 +1,20 @@ +// Type definitions for three.js (VRControls.js) +// Project: https://github.com/mrdoob/three.js/blob/master/examples/js/controls/VRControls.js +// Definitions by: Toshiya Nakakura +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module THREE { + export class VRControls { + constructor(camera: Camera, callback?: (param: string)=>void); + + /** + * Update VR Instance Tracking + */ + update(): void; + zeroSensor(): void; + + scale: number; + } +}