* The render loop. * * Updates animations. * Updates behaviors. * Renders with request animation frame.
(time, frame)
| 687 | * Renders with request animation frame. |
| 688 | */ |
| 689 | render (time, frame) { |
| 690 | var renderer = this.renderer; |
| 691 | |
| 692 | this.frame = frame; |
| 693 | this.timer.update(); |
| 694 | this.delta = this.timer.getDelta() * 1000; |
| 695 | this.time = this.timer.getElapsed() * 1000; |
| 696 | |
| 697 | if (this.isPlaying) { this.tick(this.time, this.delta); } |
| 698 | var savedBackground = null; |
| 699 | if (this.is('ar-mode')) { |
| 700 | // In AR mode, don't render the default background. Hide it, then |
| 701 | // restore it again after rendering. |
| 702 | savedBackground = this.object3D.background; |
| 703 | this.object3D.background = null; |
| 704 | } |
| 705 | renderer.render(this.object3D, this.camera); |
| 706 | if (savedBackground) { |
| 707 | this.object3D.background = savedBackground; |
| 708 | } |
| 709 | if (this.isPlaying) { |
| 710 | var renderCamera = renderer.xr.isPresenting ? renderer.xr.getCamera() : this.camera; |
| 711 | this.tock(this.time, this.delta, renderCamera); |
| 712 | } |
| 713 | } |
| 714 | |
| 715 | callComponentBehaviors (behavior, time, timeDelta) { |
| 716 | var i; |
no test coverage detected