Skip to content

Commit

Permalink
render on per-scene basis
Browse files Browse the repository at this point in the history
  • Loading branch information
squirrelo committed May 13, 2016
1 parent c2b37b3 commit 9c0172f
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions emperor/support_files/js/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ define([
});

//Set all scenes to needing update
for (var i = 0; i < this.sceneViews.length, i++) {
for (var i = 0; i < this.sceneViews.length; i++) {
this.sceneViews[i].needsUpdate = true;
}
};
Expand All @@ -222,17 +222,15 @@ define([
*
**/
EmperorController.prototype.render = function() {
var needsRender = _.some(this.sceneViews, function(sv) {
return sv.checkUpdate();
});

if (needsRender) {
this.renderer.setViewport(0, 0, this.width, this.height);
this.renderer.clear();
for (var i = 0; i < this.sceneViews.length; i++) {
this.sceneViews[i].render();
var scope = this;
$.each(this.sceneViews, function(i, sv) {
console.log(i, sv);
if (sv.checkUpdate()) {
scope.renderer.setViewport(0, 0, scope.width, scope.height);
scope.renderer.clear();
sv.render();
}
}
});
};

/**
Expand Down

0 comments on commit 9c0172f

Please sign in to comment.