Browse Source

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.
PWhiddy 9 years ago
parent
commit
95403f5c9b
1 changed files with 10 additions and 12 deletions
  1. 10 12
      src/renderers/WebGLRenderer.js

+ 10 - 12
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 );
 
 		}