Browse Source

Add culling warnings for GLBufferAttribute, update the example

raub 7 years ago
parent
commit
f8f0b41d32

+ 5 - 2
examples/webgl_buffergeometry_points_glbufferattribute.html

@@ -142,13 +142,16 @@
 
 				geometry.addAttribute( 'color', new THREE.GLBufferAttribute( gl, rgb, gl.FLOAT, 3, particles ) );
 
-				geometry.computeBoundingSphere();
-
 				//
 
 				var material = new THREE.PointsMaterial( { size: 15, vertexColors: THREE.VertexColors } );
 
 				points = new THREE.Points( geometry, material );
+
+				// Choose one:
+				// geometry.boundingSphere = ( new THREE.Sphere() ).set( new THREE.Vector3(), Infinity );
+				points.frustumCulled = false;
+
 				scene.add( points );
 
 				//

+ 5 - 1
src/core/BufferGeometry.js

@@ -599,6 +599,8 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
 
 		if ( position && position.isGLBufferAttribute ) {
 
+			console.error( 'THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".', this );
+
 			this.boundingBox.set(
 				new Vector3( - Infinity, - Infinity, - Infinity ),
 				new Vector3( + Infinity, + Infinity, + Infinity )
@@ -620,7 +622,7 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
 
 		if ( isNaN( this.boundingBox.min.x ) || isNaN( this.boundingBox.min.y ) || isNaN( this.boundingBox.min.z ) ) {
 
-			console.error( 'THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.', this );
+			console.error( 'THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.', this );
 
 		}
 
@@ -643,6 +645,8 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
 
 			if ( position && position.isGLBufferAttribute ) {
 
+				console.error( 'THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".', this );
+
 				this.boundingSphere.set( new Vector3(), Infinity );
 
 				return;