computeBoundingSphere method

void computeBoundingSphere()

Implementation

void computeBoundingSphere() {
	final geometry = this.geometry;
	final count = this.count;

	boundingSphere ??= BoundingSphere();

	if (geometry?.boundingSphere == null ) {
		geometry?.computeBoundingSphere();
	}

	boundingSphere?.empty();

	for (int i = 0; i < count!; i ++ ) {
		getMatrixAt( i, _instanceLocalMatrix );
		_sphere.setFrom(geometry!.boundingSphere!).applyMatrix4( _instanceLocalMatrix );
		boundingSphere?.union( _sphere );
	}
}