Przeglądaj źródła

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 lat temu
rodzic
commit
95403f5c9b
1 zmienionych plików z 10 dodań i 12 usunięć
  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 );
 
 		}

粤ICP备19079148号