瀏覽代碼

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 10 年之前
父節點
當前提交
95403f5c9b
共有 1 個文件被更改,包括 10 次插入12 次删除
  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 );
 
 		}