From 95403f5c9b042bb8e4b8cda98bafab0b2294440f Mon Sep 17 00:00:00 2001 From: PWhiddy <14petewhidden@gmail.com> Date: Sat, 7 Nov 2015 21:28:54 -0800 Subject: [PATCH] Line and Points (not just meshes) can use instanced rendering Previously only Meshes would have the opportunity to be rendered with instancing. If a Line or Points was created with an InstancedBufferGeometry, they would not have this option. This edit to renderBufferDirect checks whether the geometry of all three of these types uses instancing, allowing them all to make use of the awesome feature. --- src/renderers/WebGLRenderer.js | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/renderers/WebGLRenderer.js b/src/renderers/WebGLRenderer.js index 9e0340a87e..fb17fbb926 100644 --- a/src/renderers/WebGLRenderer.js +++ b/src/renderers/WebGLRenderer.js @@ -864,16 +864,7 @@ THREE.WebGLRenderer = function ( parameters ) { } } - - if ( geometry instanceof THREE.InstancedBufferGeometry && geometry.maxInstancedCount > 0 ) { - - renderer.renderInstances( geometry, drawStart, drawCount ); - - } else { - - renderer.render( drawStart, drawCount ); - - } + } else if ( object instanceof THREE.Line ) { @@ -893,11 +884,18 @@ THREE.WebGLRenderer = function ( parameters ) { } - renderer.render( drawStart, drawCount ); - } else if ( object instanceof THREE.Points ) { renderer.setMode( _gl.POINTS ); + + } + + if ( geometry instanceof THREE.InstancedBufferGeometry && geometry.maxInstancedCount > 0 ) { + + renderer.renderInstances( geometry, drawStart, drawCount ); + + } else { + renderer.render( drawStart, drawCount ); } -- GitLab