Improved perf of previewer (remove useless clear)
This commit is contained in:
parent
36eecfad97
commit
27752fa6e3
|
@ -8,6 +8,8 @@ var Previewer = function(renderer, scene) {
|
||||||
this.renderer = renderer;
|
this.renderer = renderer;
|
||||||
this.fixed = false;
|
this.fixed = false;
|
||||||
this.scene = scene;
|
this.scene = scene;
|
||||||
|
this.drawn = false;
|
||||||
|
this.drawnBefore = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Previewer.prototype.render = function(prev, container_width, container_height) {
|
Previewer.prototype.render = function(prev, container_width, container_height) {
|
||||||
|
@ -60,10 +62,12 @@ Previewer.prototype.render = function(prev, container_width, container_height) {
|
||||||
this.renderer.setViewport(left, bottom, width, height);
|
this.renderer.setViewport(left, bottom, width, height);
|
||||||
this.renderer.render(this.scene, prev.camera);
|
this.renderer.render(this.scene, prev.camera);
|
||||||
|
|
||||||
if (!this.fixed) {
|
this.update(true);
|
||||||
this.clearNeeded = true;
|
} else {
|
||||||
|
this.update(false);
|
||||||
}
|
}
|
||||||
} else if (this.fixed) {
|
|
||||||
|
if (this.drawnBefore && !this.drawn) {
|
||||||
this.clearNeeded = true;
|
this.clearNeeded = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,3 +82,8 @@ Previewer.prototype.clear = function() {
|
||||||
Previewer.prototype.fixedRecommendation = function(bool) {
|
Previewer.prototype.fixedRecommendation = function(bool) {
|
||||||
this.fixed = bool;
|
this.fixed = bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Previewer.prototype.update = function(arg) {
|
||||||
|
this.drawnBefore = this.drawn;
|
||||||
|
this.drawn = arg;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue