Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fixes #2470 Added timer
  • Loading branch information
SupermediumBot authored and fernandojsg committed Mar 8, 2017
commit 9d6c0921e1dc5afcb839c00f1aa43d7756ce0ef4
13 changes: 6 additions & 7 deletions src/core/scene/a-scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,8 @@ module.exports = registerElement('a-scene', {
if (window.performance) {
window.performance.mark('render-started');
}
sceneEl.render(0);
sceneEl.clock = new THREE.Clock();
sceneEl.render();
sceneEl.renderStarted = true;
sceneEl.emit('renderstart');
}
Expand Down Expand Up @@ -441,7 +442,6 @@ module.exports = registerElement('a-scene', {
tick: {
value: function (time, timeDelta) {
var systems = this.systems;

// Animations.
TWEEN.update(time);
// Components.
Expand All @@ -465,15 +465,14 @@ module.exports = registerElement('a-scene', {
* Renders with request animation frame.
*/
render: {
value: function (time) {
value: function () {
var effect = this.effect;
var timeDelta = time - this.time;

if (this.isPlaying) { this.tick(time, timeDelta); }
var delta = this.clock.getDelta() * 1000;
this.time = this.clock.elapsedTime * 1000;

if (this.isPlaying) { this.tick(this.time, delta); }
this.animationFrameID = effect.requestAnimationFrame(this.render);
effect.render(this.object3D, this.camera);
this.time = time;
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd keep the time property on the scene.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Umm do you want it even if it's accesible with this.timer.ellapsedTime?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's documented, might be being used. And if browsers ever fix the behavior, it's possible we might revert?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, good point

writable: true
}
Expand Down