Merge pull request #26540 from izmhr/master

three: add .animate() function to WebGLRenderer (for WebVR)
This commit is contained in:
Nathan Shively-Sanders
2018-06-20 14:28:54 -07:00
committed by GitHub
2 changed files with 12 additions and 0 deletions

View File

@@ -10,4 +10,10 @@
const obj = new THREE.Object3D();
renderer.vr.setPoseTarget(obj);
renderer.vr.dispose();
const scene = new THREE.Scene();
const render = function() {
renderer.render(scene, camera);
}
renderer.animate(render);
}

View File

@@ -5519,6 +5519,12 @@ export class WebGLRenderer implements Renderer {
renderBufferDirect(camera: Camera, fog: Fog, material: Material, geometryGroup: any, object: Object3D): void;
/**
* A build in function that can be used instead of requestAnimationFrame. For WebVR projects this function must be used.
* @param callback The function will be called every available frame. If `null` is passed it will stop any already ongoing animation.
*/
animate(callback: Function): void;
/**
* Render a scene using a camera.
* The render is done to the renderTarget (if specified) or to the canvas as usual.