mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-15 22:34:55 +08:00
add vrcontrols definition
This commit is contained in:
18
threejs/tests/examples/controls/vrcontrols.ts
Normal file
18
threejs/tests/examples/controls/vrcontrols.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
/// <reference path="../../../three.d.ts" />
|
||||
/// <reference path="../../../three-vrcontrols.d.ts" />
|
||||
|
||||
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();
|
||||
});
|
||||
@@ -59,3 +59,4 @@ THE SOFTWARE.
|
||||
|
||||
// examples test.
|
||||
/// <reference path="./tests/examples/detector.ts" />
|
||||
/// <reference path="./tests/examples/controls/vrcontrols.ts" />
|
||||
|
||||
20
threejs/three-vrcontrols.d.ts
vendored
Normal file
20
threejs/three-vrcontrols.d.ts
vendored
Normal file
@@ -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 <https://github.com/nakakura>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="./three.d.ts" />
|
||||
|
||||
declare module THREE {
|
||||
export class VRControls {
|
||||
constructor(camera: Camera, callback?: (param: string)=>void);
|
||||
|
||||
/**
|
||||
* Update VR Instance Tracking
|
||||
*/
|
||||
update(): void;
|
||||
zeroSensor(): void;
|
||||
|
||||
scale: number;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user