Skip to content

Commit 4ebdc63

Browse files
committed
Tidied up method flow
1 parent d2c025e commit 4ebdc63

1 file changed

Lines changed: 28 additions & 26 deletions

File tree

src/renderer/webgl/WebGLRenderer.js

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,46 +1529,48 @@ var WebGLRenderer = new Class({
15291529
{
15301530
if (updateScissor === undefined) { updateScissor = false; }
15311531

1532+
if (framebuffer === this.currentFramebuffer)
1533+
{
1534+
return this;
1535+
}
1536+
15321537
var gl = this.gl;
15331538

15341539
var width = this.width;
15351540
var height = this.height;
15361541

1537-
if (framebuffer !== this.currentFramebuffer)
1542+
if (framebuffer && framebuffer.renderTexture)
15381543
{
1539-
if (framebuffer && framebuffer.renderTexture)
1540-
{
1541-
width = framebuffer.renderTexture.width;
1542-
height = framebuffer.renderTexture.height;
1543-
}
1544-
else
1545-
{
1546-
this.flush();
1547-
}
1544+
width = framebuffer.renderTexture.width;
1545+
height = framebuffer.renderTexture.height;
1546+
}
1547+
else
1548+
{
1549+
this.flush();
1550+
}
15481551

1549-
gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
1552+
gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
15501553

1551-
gl.viewport(0, 0, width, height);
1554+
gl.viewport(0, 0, width, height);
15521555

1553-
if (updateScissor)
1556+
if (updateScissor)
1557+
{
1558+
if (framebuffer)
15541559
{
1555-
if (framebuffer)
1556-
{
1557-
this.drawingBufferHeight = height;
1558-
1559-
this.pushScissor(0, 0, width, height);
1560-
}
1561-
else
1562-
{
1563-
this.drawingBufferHeight = this.height;
1564-
1565-
this.popScissor();
1566-
}
1560+
this.drawingBufferHeight = height;
1561+
1562+
this.pushScissor(0, 0, width, height);
15671563
}
1564+
else
1565+
{
1566+
this.drawingBufferHeight = this.height;
15681567

1569-
this.currentFramebuffer = framebuffer;
1568+
this.popScissor();
1569+
}
15701570
}
15711571

1572+
this.currentFramebuffer = framebuffer;
1573+
15721574
return this;
15731575
},
15741576

0 commit comments

Comments
 (0)